Use absolute PID path. Ignore errors if bluepill is not runing. Refs #1

This commit is contained in:
Pavel Chipiga 2011-12-14 14:34:44 +02:00
parent 3379419eae
commit 326fe3f998
3 changed files with 4 additions and 4 deletions

View File

@ -11,7 +11,7 @@ Bluepill.application(app_name) do |app|
process.start_command = "bundle exec script/delayed_job -e production start" process.start_command = "bundle exec script/delayed_job -e production start"
process.stop_command = "bundle exec script/delayed_job -e production stop" process.stop_command = "bundle exec script/delayed_job -e production stop"
process.pid_file = File.join('tmp', 'pids', 'delayed_job.pid') process.pid_file = File.join(app.working_dir, 'tmp', 'pids', 'delayed_job.pid')
end end
app.process("unicorn") do |process| app.process("unicorn") do |process|
@ -22,7 +22,7 @@ Bluepill.application(app_name) do |app|
process.start_command = "bundle exec unicorn -l /tmp/#{app_name}_unicorn.sock -c config/unicorn.rb -D" process.start_command = "bundle exec unicorn -l /tmp/#{app_name}_unicorn.sock -c config/unicorn.rb -D"
process.stop_command = "kill -QUIT {{PID}}" process.stop_command = "kill -QUIT {{PID}}"
process.restart_command = "kill -USR2 {{PID}}" process.restart_command = "kill -USR2 {{PID}}"
process.pid_file = File.join('tmp', 'pids', 'unicorn.pid') process.pid_file = File.join(app.working_dir, 'tmp', 'pids', 'unicorn.pid')
process.monitor_children do |child_process| process.monitor_children do |child_process|
child_process.stop_command = "kill -QUIT {{PID}}" child_process.stop_command = "kill -QUIT {{PID}}"

View File

@ -3,7 +3,7 @@ Capistrano::Configuration.instance(:must_exist).load do
set :bluepill_binary, "bundle exec bluepill --no-privileged" set :bluepill_binary, "bundle exec bluepill --no-privileged"
desc "Stop processes that bluepill is monitoring and quit bluepill" desc "Stop processes that bluepill is monitoring and quit bluepill"
task :quit, :roles => [:app] do task :quit, :roles => [:app], :on_error => :continue do
run "cd #{fetch :current_path} && #{try_sudo} #{bluepill_binary} stop APP_NAME=#{fetch :application}" run "cd #{fetch :current_path} && #{try_sudo} #{bluepill_binary} stop APP_NAME=#{fetch :application}"
run "cd #{fetch :current_path} && #{try_sudo} #{bluepill_binary} quit APP_NAME=#{fetch :application}" run "cd #{fetch :current_path} && #{try_sudo} #{bluepill_binary} quit APP_NAME=#{fetch :application}"
end end

View File

@ -8,7 +8,7 @@ Capistrano::Configuration.instance(:must_exist).load do
task :generate_configuration, :roles => :web, :except => { :no_release => true } do task :generate_configuration, :roles => :web, :except => { :no_release => true } do
config = %Q{ config = %Q{
upstream #{application}_backend { upstream #{application}_backend {
# server 127.0.0.1:#{unicorn_port}; # server 127.0.0.1:#{unicorn_port rescue 8080};
server unix:/tmp/#{fetch :application}_unicorn.sock; server unix:/tmp/#{fetch :application}_unicorn.sock;
} }