Skip to content

Instantly share code, notes, and snippets.

@megahbite
Created October 5, 2014 21:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save megahbite/67a78a99152e687a656a to your computer and use it in GitHub Desktop.
Save megahbite/67a78a99152e687a656a to your computer and use it in GitHub Desktop.
Capistrano 3 configuration for starting/stopping/restarting Unicorn
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