[refs #510] Resque deploy refactor. Turn off bluepill

This commit is contained in:
konstantin.grabar 2012-06-07 19:13:58 +04:00
parent da9d7574d1
commit 597ac65dee
3 changed files with 42 additions and 48 deletions

View File

@ -35,9 +35,10 @@ set :deploy_via, :remote_cache
require './lib/recipes/nginx' require './lib/recipes/nginx'
require './lib/recipes/unicorn' require './lib/recipes/unicorn'
require './lib/recipes/bluepill' #require './lib/recipes/bluepill'
require './lib/recipes/delayed_job' require './lib/recipes/delayed_job'
#require './lib/recipes/resque'
require './lib/recipes/resque'
namespace :deploy do namespace :deploy do
task :stub_xml_rpc do task :stub_xml_rpc do
@ -85,9 +86,9 @@ after "deploy:update_code", "deploy:migrate"
after "deploy:setup", "deploy:symlink_pids" after "deploy:setup", "deploy:symlink_pids"
# Bluepill # Bluepill
after "deploy:restart", "bluepill:restart" # "bluepill:processes:restart_dj" # "bluepill:restart" #after "deploy:restart", "bluepill:restart" # "bluepill:processes:restart_dj" # "bluepill:restart"
after "deploy:start", "bluepill:start" #after "deploy:start", "bluepill:start"
after "deploy:stop", "bluepill:stop" #after "deploy:stop", "bluepill:stop"
# DJ # DJ
after "deploy:stop", "delayed_job:stop" after "deploy:stop", "delayed_job:stop"
@ -95,9 +96,9 @@ after "deploy:start", "delayed_job:start"
after "deploy:restart", "delayed_job:restart" after "deploy:restart", "delayed_job:restart"
# Resque # Resque
#after "deploy:stop", "resque:stop" after "deploy:stop", "resque:stop"
#after "deploy:start", "resque:start" after "deploy:start", "resque:start"
#after "deploy:restart", "resque:restart" after "deploy:restart", "resque:restart"
after "deploy:restart", "deploy:cleanup" after "deploy:restart", "deploy:cleanup"

View File

@ -23,6 +23,9 @@ Bluepill.application(app_name, :log_file => "/srv/rosa_build/shared/log/bluepill
process.pid_file = pid_path process.pid_file = pid_path
process.stop_command = "kill -QUIT {{PID}}" process.stop_command = "kill -QUIT {{PID}}"
process.daemonize = true process.daemonize = true
process.start_grace_time = 5.seconds
process.stop_grace_time = 5.seconds
process.restart_grace_time = 5.seconds
#process.monitor_children do |c| #process.monitor_children do |c|
# c.stop_command = "kill -USR1 {{PID}}" # TODO: Are we really need this? # c.stop_command = "kill -USR1 {{PID}}" # TODO: Are we really need this?

View File

@ -1,40 +1,30 @@
## -*- encoding : utf-8 -*- # -*- encoding : utf-8 -*-
#Capistrano::Configuration.instance(:must_exist).load do Capistrano::Configuration.instance(:must_exist).load do
#
# require 'resque/server' namespace :resque do
# task :start do
# namespace :resque do start_workers
# task :start do end
# start_workers
# end task :stop do
# stop_workers
# task :stop do end
# stop_workers
# end task :restart do
# stop_workers
# task :restart do start_workers
# stop_workers end
# start_workers
# end def rails_env
# fetch(:rails_env, false) ? "RAILS_ENV=#{fetch(:rails_env)}" : ''
# def rails_env end
# fetch(:rails_env, false) ? "RAILS_ENV=#{fetch(:rails_env)}" : ''
# end def stop_workers
# run "kill -QUIT `cat #{ fetch(:current_path) }/tmp/pids/resque.pid`"
# def stop_workers end
# pids = Array.new
# def start_workers
# Resque.workers.each do |worker| run "cd #{fetch :current_path} && QUEUE=fork_and_import #{ rails_env } BACKGROUND=yes PIDFILE=#{ fetch(:current_path) }/tmp/pids/resque.pid bundle exec rake resque:work"
# pids << worker.to_s.split(/:/)[1] end
# end end
# end
# if pids.size > 0
# system("kill -QUIT #{pids.join(' ')}")
# end
# end
#
# def start_workers
# run "cd #{fetch :release_path} && QUEUE=* #{ rails_env } bundle exec rake resque:work &"
# end
# end
#end