sidekiq当前进程和capistrano会发生什么

时间:2013-06-20 20:01:44

标签: capistrano sidekiq

在进行部署时,使用capistrano进行部署时,运行的sidekiq进程是否受到影响,停止或被杀?

1 个答案:

答案 0 :(得分:6)

require 'sidekiq/capistrano放入deploy.rb将在部署时添加these default tasks

如果你做的事情不是纯粹的香草,例如。使用monit,那么你可能不想添加require 'sidekiq/capistrano语句并编写自己的任务和钩子。

例如

Capistrano::Configuration.instance(:must_exist).load do
  before "deploy:update_code", "sidekiq:quiet"
  after "deploy:stop",    "sidekiq:stop"
  after "deploy:start",   "sidekiq:start"
  before "deploy:restart", "sidekiq:restart"

  namespace :sidekiq do    
    desc "Quiet sidekiq (stop accepting new work)"
    task :quiet, :roles => :app, :on_no_matching_servers => :continue do
      run "/usr/sbin/service sidekiq quiet"
    end

    desc "Stop sidekiq"
    task :stop, :roles => :app, :on_no_matching_servers => :continue do
      run "sudo /usr/bin/monit stop sidekiq"
    end

    desc "Start sidekiq"
    task :start, :roles => :app, :on_no_matching_servers => :continue do
      run "sudo /usr/bin/monit start sidekiq"
    end

    desc "Restart sidekiq"
    task :restart, :roles => :app, :on_no_matching_servers => :continue do
      run "sudo /usr/bin/monit restart sidekiq"
    end
  end  
end