Skip to content

Instantly share code, notes, and snippets.

Revisions

  1. vvalgis revised this gist May 7, 2010. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions Capistrano tasks for starting unicorn.rb
    Original file line number Diff line number Diff line change
    @@ -1,20 +1,20 @@
    set :rails_env, :production
    set :unicorn_binary, "/usr/bin/unicorn"
    set :unicorn_config, "#{current_path}/config/unicorn.rb"
    set (:unicorn_pid) { File.read "#{current_path}/tmp/pids/unicorn.pid" }
    set :unicorn_pid, "#{current_path}/tmp/pids/unicorn.pid"

    namespace :deploy do
    task :start, :roles => :app, :except => { :no_release => true } do
    run "#{try_sudo} #{unicorn_binary} -c #{unicorn_config} -E #{rails_env} -D"
    run "cd #{current_path} && #{try_sudo} #{unicorn_binary} -c #{unicorn_config} -E #{rails_env} -D"
    end
    task :stop, :roles => :app, :except => { :no_release => true } do
    run "#{try_sudo} kill #{unicorn_pid}"
    run "#{try_sudo} kill `cat #{unicorn_pid}`"
    end
    task :graceful_stop, :roles => :app, :except => { :no_release => true } do
    run "#{try_sudo} kill -s QUIT #{unicorn_pid}"
    run "#{try_sudo} kill -s QUIT `cat #{unicorn_pid}`"
    end
    task :reload, :roles => :app, :except => { :no_release => true } do
    run "#{try_sudo} kill -s USR2 #{unicorn_pid}"
    run "#{try_sudo} kill -s USR2 `cat #{unicorn_pid}`"
    end
    task :restart, :roles => :app, :except => { :no_release => true } do
    stop
  2. vvalgis revised this gist May 7, 2010. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Capistrano tasks for starting unicorn.rb
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    set :rails_env, :production
    set :unicorn_binary, "/usr/bin/unicorn"
    set :unicorn_config, "#{current_path}/config/unicorn.rb"
    set :unicorn_pid, { File.read "#{current_path}/tmp/pids/unicorn.pid" }
    set (:unicorn_pid) { File.read "#{current_path}/tmp/pids/unicorn.pid" }

    namespace :deploy do
    task :start, :roles => :app, :except => { :no_release => true } do
  3. vvalgis renamed this gist May 7, 2010. 1 changed file with 0 additions and 0 deletions.
  4. @invalid-email-address Anonymous revised this gist May 7, 2010. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions Capistrano tasks for starting unicorn
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,8 @@
    set :rails_env, :production
    set :unicorn_binary, "/usr/bin/unicorn"
    set :unicorn_config, "#{current_path}/config/unicorn.rb"
    set :unicorn_pid, { File.read "#{current_path}/tmp/pids/unicorn.pid" }

    namespace :deploy do
    task :start, :roles => :app, :except => { :no_release => true } do
    run "#{try_sudo} #{unicorn_binary} -c #{unicorn_config} -E #{rails_env} -D"
  5. @invalid-email-address Anonymous created this gist May 7, 2010.
    18 changes: 18 additions & 0 deletions Capistrano tasks for starting unicorn
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    namespace :deploy do
    task :start, :roles => :app, :except => { :no_release => true } do
    run "#{try_sudo} #{unicorn_binary} -c #{unicorn_config} -E #{rails_env} -D"
    end
    task :stop, :roles => :app, :except => { :no_release => true } do
    run "#{try_sudo} kill #{unicorn_pid}"
    end
    task :graceful_stop, :roles => :app, :except => { :no_release => true } do
    run "#{try_sudo} kill -s QUIT #{unicorn_pid}"
    end
    task :reload, :roles => :app, :except => { :no_release => true } do
    run "#{try_sudo} kill -s USR2 #{unicorn_pid}"
    end
    task :restart, :roles => :app, :except => { :no_release => true } do
    stop
    start
    end
    end