Sidekiq,Rails4和Capistrano3。部署时exec sidekiqctl安静时出错

时间:2014-01-22 15:02:30

标签: ruby-on-rails ruby capistrano delayed-job sidekiq

我正在使用Rails4,sidekiq和capistrano3(ruby 2.1.0)。

我的部署配置工作没有sidekiq。当我使用sidekiq时,我在此命令中遇到错误:

/usr/bin/env bundle exec sidekiqctl quiet /home/deployer/apps/getLead/current/tmp/sidekiq.pid
Tasks: TOP => sidekiq:quiet

我正在尝试在我的VPS上运行此命令,并看到“进程不存在”

我在我的Capfile中包含了'sidekiq / capistrano',并尝试使用deploy.rb中的选项:

=begin
set(:sidekiq_cmd) { "#{bundle_cmd} exec sidekiq" }
set(:sidekiqctl_cmd) { "#{bundle_cmd} exec sidekiqctl" }
set(:sidekiq_timeout) { 10 }
set(:sidekiq_role) { :app }
set(:sidekiq_pid) { "#{current_path}/tmp/pids/sidekiq.pid" }
set(:sidekiq_processes) { 1 }
=end
set :sidekiq_cmd,           ->{ "bundle exec sidekiq" }
set :sidekiqctl_cmd,        ->{ "bundle exec sidekiqctl" }

这是我的sidekiq.yml配置

:verbose: false
:pidfile: tmp/sidekiq.pid
:concurrency:  25
:queues:
  - [often, 7]
  - [default, 5]
  - [seldom, 3]

我怎样才能让它发挥作用?提前谢谢!

1 个答案:

答案 0 :(得分:1)

我遇到了类似的问题,我修复了它在部署日志中寻找其他捆绑任务的命令(例如db:migrate):

sidekiq_cmd_pre = 'cd #{current_path} && ( PATH=/home/deployer/.rvm/bin:$PATH RAILS_ENV=production ~/.rvm/bin/rvm default do'
set :sidekiq_cmd, -> { "#{sidekiq_cmd_pre} bundle exec sidekiq)" }
set :sidekiqctl_cmd, -> { "#{sidekiq_cmd_pre} bundle exec sidekiqctl" }

P.S。不漂亮,但工作)

P.P.S 需要

set :sidekiq_pid, -> { "tmp/pids/sidekiq.pid" }

删除#{current_path}