Sha256: 94327142ed10d8d23ff7bec875d8f3c16899c5ecc05b7b4decbe09349cef629b

Contents?: true

Size: 1.33 KB

Versions: 17

Compression:

Stored size: 1.33 KB

Contents

namespace :rubber do

  namespace :unicorn do
  
    rubber.allow_optional_tasks(self)
    
    before "deploy:stop", "rubber:unicorn:stop"
    after "deploy:start", "rubber:unicorn:start"
    after "deploy:restart", "rubber:unicorn:reload"
    
    desc "Stops the unicorn server"
    task :stop, :roles => :unicorn do
      rsudo "if [ -f /var/run/unicorn.pid ]; then pid=`cat /var/run/unicorn.pid` && kill -TERM $pid; fi"
    end
    
    desc "Starts the unicorn server"
    task :start, :roles => :unicorn do
      rsudo "cd #{current_path} && bundle exec unicorn_rails -c #{current_path}/config/unicorn.rb -E #{Rubber.env} -D"
    end
    
    desc "Restarts the unicorn server"
    task :restart, :roles => :unicorn do
      stop
      start
    end
  
    desc "Reloads the unicorn web server"
    task :reload, :roles => :unicorn do
      rsudo "if [ -f /var/run/unicorn.pid ]; then pid=`cat /var/run/unicorn.pid` && kill -USR2 $pid; else cd #{current_path} && bundle exec unicorn_rails -c #{current_path}/config/unicorn.rb -E #{Rubber.env} -D; fi"
    end

    desc "Display status of the unicorn web server"
    task :status, :roles => :unicorn do
      # "service unicorn status" always returns "unicorn stop/waiting"
      rsudo "ps -eopid,user,cmd | grep [u]nicorn || true"
      rsudo "netstat -tupan | grep unicorn || true"
    end

  end

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
rubber-2.6.5 templates/unicorn/config/rubber/deploy-unicorn.rb
rubber-2.6.4 templates/unicorn/config/rubber/deploy-unicorn.rb
rubber-2.6.3 templates/unicorn/config/rubber/deploy-unicorn.rb
rubber-2.6.2 templates/unicorn/config/rubber/deploy-unicorn.rb
rubber-2.6.1 templates/unicorn/config/rubber/deploy-unicorn.rb
rubber-2.6.0 templates/unicorn/config/rubber/deploy-unicorn.rb
rubber-2.5.5 templates/unicorn/config/rubber/deploy-unicorn.rb
rubber-2.5.4 templates/unicorn/config/rubber/deploy-unicorn.rb
rubber-2.5.3 templates/unicorn/config/rubber/deploy-unicorn.rb
rubber-2.5.2 templates/unicorn/config/rubber/deploy-unicorn.rb
rubber-2.5.1 templates/unicorn/config/rubber/deploy-unicorn.rb
rubber-2.5.0 templates/unicorn/config/rubber/deploy-unicorn.rb
rubber-2.4.2 templates/unicorn/config/rubber/deploy-unicorn.rb
rubber-2.4.1 templates/unicorn/config/rubber/deploy-unicorn.rb
rubber-2.4.0 templates/unicorn/config/rubber/deploy-unicorn.rb
rubber-2.3.1 templates/unicorn/config/rubber/deploy-unicorn.rb
rubber-2.3.0 templates/unicorn/config/rubber/deploy-unicorn.rb