Update capistrano's restart unicorn task
Our current unicorn task wasn't working in some cases. We also had a version in the `capistrano` branch, which was the one we recommended. However, that version assumed RVM, a certain ruby version and a certain deploy folder were used. This version uses `bundle exec` and variables like `release_path`, so it does not depend on any specific configuration. Even if we're replacing unicorn with puma, I wanted to make this change in case we need it as a reference in the future.
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
namespace :deploy do
|
namespace :deploy do
|
||||||
desc 'Commands for unicorn application'
|
desc "Restart Unicorn"
|
||||||
%w(start stop force-stop restart upgrade reopen-logs).each do |command|
|
task :restart do
|
||||||
task command.to_sym do
|
on roles(:app) do
|
||||||
on roles(:app), in: :sequence, wait: 5 do
|
execute "kill -QUIT `cat #{deploy_to}/pids/unicorn.pid`; true"
|
||||||
execute "/etc/init.d/unicorn_#{fetch(:full_app_name)} #{command}"
|
execute "kill -QUIT `cat #{shared_path}/pids/unicorn.pid`; true"
|
||||||
end
|
execute "kill -QUIT `cat #{shared_path}/tmp/pids/unicorn.pid`; true"
|
||||||
|
execute "cd #{release_path} && bundle exec unicorn -c config/unicorn.rb -E production -D"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user