Skip to content

Instantly share code, notes, and snippets.

@rust
Created January 20, 2012 06:47
Show Gist options
  • Save rust/1645813 to your computer and use it in GitHub Desktop.
Save rust/1645813 to your computer and use it in GitHub Desktop.
set :bundle_cmd, "/opt/local/ruby193/bin/bundle"
set :unicorn_binary, "unicorn"
set :unicorn_config, "config/unicorn.rb"
set :unicorn_pid, "tmp/pids/unicorn.pid"
namespace :deploy do
task :start, :roles => :app, :except => { :no_release => true } do
try_sudo "sh -c 'cd #{current_path} && PATH=#{binary_path}:$PATH #{ruby_path} #{unicorn_rails_path} -c #{current_path}/#{unicorn_config} -E #{deploy_environment} -D'"
end
task :stop, :roles => :app, :except => { :no_release => true } do
try_sudo "kill `cat #{current_path}/#{unicorn_pid}` 2> /dev/null || :"
end
task :graceful_stop, :roles => :app, :except => { :no_release => true } do
try_sudo "kill -s QUIT `cat #{current_path}/#{unicorn_pid} 2> /dev/null || :"
end
task :reload, :roles => :app, :except => { :no_release => true } do
try_sudo "kill -s USR2 `cat #{current_path}/#{unicorn_pid} 2> /dev/null || :"
end
task :restart, :roles => :app, :except => { :no_release => true } do
stop
start
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment