rosa-build/lib/recipes/unicorn.rb

27 lines
1.1 KiB
Ruby
Raw Normal View History

2012-01-30 20:39:34 +00:00
# -*- encoding : utf-8 -*-
2011-12-06 18:35:19 +00:00
Capistrano::Configuration.instance(:must_exist).load do
namespace :deploy do
set :unicorn_binary, "bundle exec unicorn"
2012-03-20 18:47:09 +00:00
set(:unicorn_pid) { "#{fetch :shared_path}/pids/unicorn.pid" }
# set :unicorn_port, 8080
2011-12-06 18:35:19 +00:00
task :start, :roles => :app, :except => { :no_release => true } do
run "cd #{fetch :current_path} && #{try_sudo} #{unicorn_binary} -l /tmp/#{fetch :application}_unicorn.sock -E #{rails_env} -c config/unicorn.rb -D" # -p #{unicorn_port}
2011-12-06 18:35:19 +00:00
end
task :stop, :roles => :app, :except => { :no_release => true } do
2011-12-06 19:33:35 +00:00
run "#{try_sudo} kill `cat #{unicorn_pid}`" rescue warn 'deploy:stop FAILED'
2011-12-06 18:35:19 +00:00
end
task :graceful_stop, :roles => :app, :except => { :no_release => true } do
2012-03-20 18:47:09 +00:00
run "#{try_sudo} kill -QUIT `cat #{unicorn_pid}`" rescue warn 'deploy:graceful_stop FAILED'
2011-12-06 18:35:19 +00:00
end
task :reload, :roles => :app, :except => { :no_release => true } do
2012-03-20 18:47:09 +00:00
run "#{try_sudo} kill -USR2 `cat #{unicorn_pid}`" rescue warn 'deploy:reload FAILED'
2011-12-06 18:35:19 +00:00
end
task :restart, :roles => :app, :except => { :no_release => true } do
2012-03-19 14:48:54 +00:00
reload
#stop
#start # blue pill will do it?
2011-12-06 18:35:19 +00:00
end
end
end