Sha256: 914cd9ed675781a560ffbc1d8bb3e741b815274bd0a429c6ee8506fb5db63084

Contents?: true

Size: 1.17 KB

Versions: 11

Compression:

Stored size: 1.17 KB

Contents

module CapistranoDeployManagement
  module Unicorn
    def self.load_into(configuration)
      configuration.load do

        set(:unicorn_config)  { "#{current_path}/config/unicorn.rb" }
        set(:unicorn_pidfile) { "#{deploy_to}/shared/pids/unicorn.pid" }
        set(:unicorn_pid)     { "cat #{deploy_to}/shared/pids/unicorn.pid" }

        namespace :unicorn do
          desc 'Restart unicorn.'
          task :restart, :roles => :app do
            # FIXME: PID does not exist, thus restarting fails
            # run "cd #{current_path} && kill -s USR2 #{unicorn_pid}"
            unicorn.stop
            unicorn.start
          end

          desc 'Start unicorn.'
          task :start, :roles => :app do
            run "cd #{current_path} && unicorn -c #{unicorn_config} -E #{rails_env} -D"
          end

          desc 'Stop unicorn.'
          task :stop, :roles => :app do
            # run "cd #{current_path} && kill $(#{unicorn_pid})"
            run "cd #{current_path} && test -s #{unicorn_pidfile} && kill $(#{unicorn_pid}) || echo 'Unicorn not running. Nothing to kill.'"
          end
        end

        after 'deploy:restart', 'unicorn:restart'

      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
capistrano-deploy-management-0.1.33 lib/capistrano-deploy-management/unicorn.rb
capistrano-deploy-management-0.1.32 lib/capistrano-deploy-management/unicorn.rb
capistrano-deploy-management-0.1.31 lib/capistrano-deploy-management/unicorn.rb
capistrano-deploy-management-0.1.30 lib/capistrano-deploy-management/unicorn.rb
capistrano-deploy-management-0.1.29 lib/capistrano-deploy-management/unicorn.rb
capistrano-deploy-management-0.1.28 lib/capistrano-deploy-management/unicorn.rb
capistrano-deploy-management-0.1.25 lib/capistrano-deploy-management/unicorn.rb
capistrano-deploy-management-0.1.24 lib/capistrano-deploy-management/unicorn.rb
capistrano-deploy-management-0.1.23 lib/capistrano-deploy-management/unicorn.rb
capistrano-deploy-management-0.1.22 lib/capistrano-deploy-management/unicorn.rb
capistrano-deploy-management-0.1.21 lib/capistrano-deploy-management/unicorn.rb