Skip to content

Instantly share code, notes, and snippets.

@1syo
Last active December 20, 2015 02:59
Show Gist options
  • Save 1syo/6060591 to your computer and use it in GitHub Desktop.
Save 1syo/6060591 to your computer and use it in GitHub Desktop.
namespace :admin do
task :host01 => :environment do
set :rails_env, :production
set :deploy_to, '/home/admin/apps'
set :domain, 'admin01'
end
task :host02 => :environment do
set :rails_env, :production
set :deploy_to, '/home/admin/apps'
set :domain, 'admin02'
end
desc "Deploys the current version to the admin server."
task :deploy do
invoke :'admin:deploy_to_host01'
invoke :'admin:deploy_to_host02'
end
task :deploy_to_host01 => :host01 do
deploy do
invoke :'git:clone'
invoke :'deploy:link_shared_paths'
invoke :'bundle:install'
invoke :'rails:db_migrate'
queue! %[bundle exec rake db:seed_fu]
queue! %[bundle exec rake assets:precompile]
to :launch do
queue! %[./script/unicorn_admin_init.sh upgrade]
end
end
end
task :deploy_to_host02 => :host02 do
deploy do
invoke :'git:clone'
invoke :'deploy:link_shared_paths'
invoke :'bundle:install'
to :launch do
queue! %[./script/rapns.sh restart]
queue! %[./script/resque_worker.sh restart]
end
end
end
end
namespace :admin do
task :deploy do
invoke :"admin01:deploy"
run!
invoke :"admin02:deploy"
end
end
namespace :admin01 do
task :host => :environment do
set :rails_env, :production
set :deploy_to, '/home/admin/apps'
set :domain, 'admin01'
end
task :deploy => :host do
deploy do
invoke :'git:clone'
invoke :'deploy:link_shared_paths'
invoke :'bundle:install'
invoke :'rails:db_migrate'
queue! %[bundle exec rake db:seed_fu]
queue! %[bundle exec rake assets:precompile]
to :launch do
queue! %[./script/unicorn_admin_init.sh upgrade]
end
end
end
end
namespace :admin02 do
task :host => :environment do
set :rails_env, :production
set :deploy_to, '/home/admin/apps'
set :domain, 'admin02'
end
task :deploy => :host do
deploy do
invoke :'git:clone'
invoke :'deploy:link_shared_paths'
invoke :'bundle:install'
to :launch do
queue! %[./script/rapns.sh restart]
queue! %[./script/resque_worker.sh restart]
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment