diff --git a/config/deploy.rb b/config/deploy.rb index b730c6c76..5adbb33ef 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -62,8 +62,9 @@ namespace :deploy do end after "deploy:update_code", "deploy:symlink_all", "deploy:migrate" +after "deploy:update", "bluepill:quit", "bluepill:start" after "deploy:setup", "deploy:symlink_pids" -after "deploy:restart", "bluepill:start" # "bluepill:processes:restart_dj" # "bluepill:restart" +after "deploy:restart", "bluepill:quit", "bluepill:start" after "deploy:restart", "deploy:cleanup" require 'cape' diff --git a/config/production.pill b/config/production.pill index 3199e382a..1d9f23340 100644 --- a/config/production.pill +++ b/config/production.pill @@ -9,9 +9,8 @@ Bluepill.application(app_name) do |app| process.stop_grace_time = 10.seconds process.restart_grace_time = 10.seconds - process.start_command = "/usr/bin/env RAILS_ENV=production script/delayed_job start" - process.stop_command = "/usr/bin/env RAILS_ENV=production script/delayed_job stop" - process.restart_command = "/usr/bin/env RAILS_ENV=production script/delayed_job restart" + process.start_command = "/usr/bin/env ruby script/delayed_job start" + process.stop_command = "/usr/bin/env ruby script/delayed_job stop" process.pid_file = File.join(app.working_dir, 'tmp', 'pids', 'delayed_job.pid') end diff --git a/lib/recipes/bluepill.rb b/lib/recipes/bluepill.rb index 969728664..5b23601f2 100644 --- a/lib/recipes/bluepill.rb +++ b/lib/recipes/bluepill.rb @@ -36,7 +36,8 @@ Capistrano::Configuration.instance(:must_exist).load do end desc "Quit bluepill" - task :stop, :roles => [:app] do + task :quit, :roles => [:app] do + run "cd #{fetch :current_path} && #{try_sudo} #{bluepill_binary} #{fetch :application} stop" run "cd #{fetch :current_path} && #{try_sudo} #{bluepill_binary} #{fetch :application} quit" end diff --git a/script/delayed_job b/script/delayed_job index edf195985..da53fc1ff 100755 --- a/script/delayed_job +++ b/script/delayed_job @@ -1,5 +1,6 @@ #!/usr/bin/env ruby +ENV['RAILS_ENV'] ||= "production" require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment')) require 'delayed/command' Delayed::Command.new(ARGV).daemonize