1

我在让 Sidekiq 在我的 VPS 上运行时遇到了一些问题。在本地一切正常,但一旦我部署,我的独角兽日志中出现以下错误:

E, [2012-09-18T21:41:19.670672 #1308] ERROR -- : uninitialized constant MailchimpWorker::Sidekiq (NameError)
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/ext/module.rb:36:in `const_missing'
/home/deployer/production/releases/20120919013128/app/workers/mailchimp_worker.rb:3:in `<class:MailchimpWorker>'
/home/deployer/production/releases/20120919013128/app/workers/mailchimp_worker.rb:1:in `<top (required)>'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:439:in `block (2 levels) in eager_load!'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:438:in `each'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:438:in `block in eager_load!'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:436:in `each'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:436:in `eager_load!'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/application/finisher.rb:53:in `block in <module:Finisher>'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `instance_exec'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `run'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `each'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `run_initializers'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/application.rb:136:in `initialize!'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
/home/deployer/production/releases/20120919013128/config/environment.rb:5:in `<top (required)>'
config.ru:4:in `require'
config.ru:4:in `block in <main>'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
/home/deployer/production/shared/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
config.ru:1:in `new'
config.ru:1:in `<main>'

这是我的工作文件的内容:

class MailchimpWorker

  include Sidekiq::Worker

  LIST_ID = '844161948b'

  def perform(email)
    Gibbon.listSubscribe id: LIST_ID, email_address: email
  end

end

关于我做错了什么的任何想法?

4

3 回答 3

0

如果它适用于开发但不适用于生产,听起来捆绑器没有在生产环境中加载 gem。这取决于 Gemfile 中列出的 gem 的哪个组以及您的部署方式(您如何让 bundler 在生产环境中安装您的 gem?)。

那么,您可以发布您的 Gemfile 以及部署脚本中的相关位吗?

还要仔细检查 sidekiq procs 是否正在使用 bundle exec 启动。

于 2012-09-25T15:57:20.133 回答
0

这看起来像是gem 'sidekiq'您的 Gemfile 中缺少的。

于 2012-09-21T23:13:56.020 回答
0

你在捆绑器中运行独角兽吗?

bundle exec unicorn
于 2012-09-28T10:53:59.077 回答