Skip to content

Instantly share code, notes, and snippets.

@sentientmonkey
Created April 8, 2011 01:01
Show Gist options
  • Save sentientmonkey/909114 to your computer and use it in GitHub Desktop.
Save sentientmonkey/909114 to your computer and use it in GitHub Desktop.
Our deploy for unicorn. It also has magical powers.
set :unicorn_pid, "#{current_path}/tmp/pids/unicorn.pid"
namespace :unicorn do
desc "start unicorn"
task :start, :roles => :app, :except => { :no_release => true } do
run "cd #{current_path} && #{try_sudo} bundle exec unicorn_rails -c #{current_path}/config/unicorn-#{rails_env}.rb -E #{rails_env} -D"
end
desc "stop unicorn"
task :stop, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} kill `cat #{unicorn_pid}`"
end
desc "graceful stop unicorn"
task :graceful_stop, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} kill -s QUIT `cat #{unicorn_pid}`"
end
desc "reload unicorn"
task :reload, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} kill -s USR2 `cat #{unicorn_pid}`"
end
after "deploy:restart", "unicorn:reload"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment