I\'ve got following settings in deploy.rb to restart my server:
namespace :deploy do
task :restart do
run \"if [ -f #{unicorn_pid} ] &&
You should give capistrano-unicorn a try, that's what I currently use with the default hooks mentioned below.
Add the library to your Gemfile
:
ruby
group :development do
gem 'capistrano-unicorn', :require => false
end
And load it into your deployment script config/deploy.rb
:
ruby
require 'capistrano-unicorn'
Add unicorn restart task hook:
ruby
after 'deploy:restart', 'unicorn:reload' # app IS NOT preloaded
after 'deploy:restart', 'unicorn:restart' # app preloaded
after 'deploy:restart', 'unicorn:duplicate' # before_fork hook implemented (zero downtime deployments)