Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 17th, 2012  |  syntax: None  |  size: 0.85 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. set :rails_env, :production
  2. set :unicorn_binary, "/usr/bin/unicorn"
  3. set :unicorn_config, "#{current_path}/config/unicorn.rb"
  4. set :unicorn_pid, "#{current_path}/tmp/pids/unicorn.pid"
  5.  
  6. namespace :deploy do
  7.   task :start, :roles => :app, :except => { :no_release => true } do
  8.     run "cd #{current_path} && #{try_sudo} #{unicorn_binary} -c #{unicorn_config} -E #{rails_env} -D"
  9.   end
  10.   task :stop, :roles => :app, :except => { :no_release => true } do
  11.     run "#{try_sudo} kill `cat #{unicorn_pid}`"
  12.   end
  13.   task :graceful_stop, :roles => :app, :except => { :no_release => true } do
  14.     run "#{try_sudo} kill -s QUIT `cat #{unicorn_pid}`"
  15.   end
  16.   task :reload, :roles => :app, :except => { :no_release => true } do
  17.     run "#{try_sudo} kill -s USR2 `cat #{unicorn_pid}`"
  18.   end
  19.   task :restart, :roles => :app, :except => { :no_release => true } do
  20.     stop
  21.     start
  22.   end
  23. end