Created
October 5, 2014 21:17
-
-
Save megahbite/67a78a99152e687a656a to your computer and use it in GitHub Desktop.
Capistrano 3 configuration for starting/stopping/restarting Unicorn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :deploy do | |
desc 'Start application' | |
task :start do | |
on roles(:app), in: :sequence, wait: 5 do | |
within "#{release_path}" do | |
execute :bundle, :exec, :unicorn, '-D', '-E', :production, "-c", "config/unicorn.rb" | |
end | |
end | |
end | |
desc 'Stop application' | |
task :stop do | |
on roles(:app), in: :sequence, wait: 5 do | |
within "#{fetch(:deploy_to)}" do | |
pid = capture(:cat, 'shared/tmp/pids/unicorn.pid') | |
execute :kill, '-QUIT', pid | |
end | |
end | |
end | |
desc 'Restart application' | |
task :restart do | |
on roles(:app), in: :sequence, wait: 5 do | |
within "#{fetch(:deploy_to)}" do | |
pid = capture(:cat, 'shared/tmp/pids/unicorn.pid') | |
execute :kill, '-USR2', pid | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment