Sha256: 991eb9bb15b67d16ba2d55430f9bbb31ddd6f42c396351d9a2864088d42c174d
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
require "capistrano-unicorn-methods/version" Capistrano::Configuration.instance.load do namespace :unicorn do # Lazy setting these variables, as they (might) depend on other settings set(:unicorn_pid) { "#{current_path}/tmp/pids/unicorn.pid" } set(:unicorn_old_pid) { "#{current_path}/tmp/pids/unicorn.pid.oldbin" } set(:unicorn_config) { "#{current_path}/config/unicorn.rb" } set(:unicorn_port) { 3000 } set(:use_bundler) { true } desc "Zero-downtime restart of Unicorn" task :restart do unicorn.cleanup run "touch #{unicorn_pid}" pid = capture("cat #{unicorn_pid}").to_i run "kill -s USR2 #{pid}" if pid > 0 end desc "Starts unicorn" task :start do unicorn.cleanup run "cd #{current_path} ; #{'bundle exec' if use_bundler} unicorn_rails -c #{unicorn_config} -D -p #{unicorn_port}" end desc "Stop unicorn" task :stop do run "touch #{unicorn_pid}" pid = capture("cat #{unicorn_pid}").to_i run "kill -s QUIT #{pid}" if pid > 0 end desc "Cleans up the old unicorn processes" task :cleanup do run "touch #{unicorn_old_pid}" pid = capture("cat #{unicorn_old_pid}").to_i run "kill -s QUIT #{pid}" if pid > 0 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
capistrano-unicorn-methods-0.0.3 | lib/capistrano-unicorn-methods.rb |