Skip to content

Instantly share code, notes, and snippets.

pool :sandbox do
cloud :hello_world do
instances 1..1
using :ec2
# Update with the path to your EC2 keypair
# If you don't have one, create with:
# $ ec2-create-keypair NAME > /path/to/your/keypairs/<NAME>
keypair "/root/.ect/sv_keypair"
root@domU-12-31-39-03-49-02:/opt/poolparty/poolparty# /usr/lib/ruby/gems/1.8/gems/poolparty-1.4.7/bin/cloud-show
PoolParty core loadtime: 0.750003
Cloud: hello_world
----------------------------
Running Instances: 0
Minimum instances: 1
Maximum instances: 1
Running on: ec2
Keypair: sv_keypair
Security group: sandbox-hello_world
root@domU-12-31-39-07-49-D2:/var/run# chef-client -l debug
INFO: Starting Chef Run
DEBUG: Loading plugin os
DEBUG: Loading plugin ruby
DEBUG: Loading plugin languages
DEBUG: Loading plugin kernel
DEBUG: ---- Begin uname -s STDOUT ----
DEBUG: Linux
DEBUG: ---- End uname -s STDOUT ----
DEBUG: ---- Begin uname -s STDERR ----
{
"validation_token": "my token",
"attributes": {
"run_list": [
"role[app_server]"
]
},
"chef_server": "path to my chef server"
}
{
"run_list": [
"role[app_server, app_server_db]"
]
}
# complain if no snapshot id provided
#
snapshot_id = node[:channels][:database][:snapshot_id] rescue nil
raise "No snapshot id specified." if snapshot_id.blank?
device = node[:channels][:database][:device] rescue nil
raise "No device specified for the database volume" if device.blank?
# mount ebs volume
#
aws_ebs_volume "my_ebs_volume" do
aws_access_key node[:aws][:aws_access_key_id]
aws_secret_access_key node[:aws][:aws_secret_access_key]
size 50
device "/dev/sdi"
volume_id node[:ebs][:volume_id]
action [ :create, :attach ]
provider "aws_ebs_volume"
end
deploy "/home/amsrv/app/Cornice" do
repo "git@github.com:Aslan/TestApp.git"
revision "HEAD" # or "HEAD" or "TAG_for_1.0" or (subversion) "1234"
user "amsrv"
group "amsrv"
enable_submodules true
migrate true
migration_command "rake db:migrate --trace"
symlink_before_migrate "config/database.yml" => "config/database.yml"
environment "RAILS_ENV" => "production"
pool "cornice" do
cloud "app" do
using :ec2
user_data File.read('app_server_user_data.json')
image_id 'ami-879d71ee'
instances 1..1
security_group "cornice-security" do
authorize :from_port => 22, :to_port => 22
authorize :from_port => 80, :to_port => 80
authorize :from_port => 0, :to_port => 65535, :protocol => 'tcp', :group_name => 'default'
AppUser Load (44.0ms) SELECT * FROM `app_users` WHERE (id = 17480)
AppUserContribution Load (44.9ms)
select sum(direct_amount + karmic_amount) as total
from app_user_contributions
where app_charity_goal_id = 244 and app_user_id in (17480)
AppUser Load (33.7ms) SELECT * FROM `app_users` WHERE (id = 17480)
AppUserContribution Load (46.9ms)
select sum(app_user_contributions.direct_amount + app_user_contributions.karmic_amount) as total
from app_user_contributions inner join app_charity_goals on app_user_contributions.app_charity_goal_id = app_charity_goals.id
where app_charity_goals.app_charity_id = 10 and app_user_contributions.app_user_id in (17480)