rosa-build/lib/recipes/unicorn.rb

26 lines
1.1 KiB
Ruby
Raw Normal View History

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
2014-01-21 04:51:49 +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
2014-01-21 04:51:49 +00:00
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
2014-01-21 04:51:49 +00:00
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
2014-01-21 04:51:49 +00:00
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
2014-01-21 04:51:49 +00:00
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