1

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

4

1 回答 1

7

放入您的deploy.rbrequire 'sidekiq/capistrano将在部署时添加这些默认任务

如果您正在做的事情不是纯粹的香草,例如。使用 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
于 2013-06-21T08:56:11.813 回答