2012-09-19 62 views
1

我有一些問題讓Sidekiq在我的VPS上運行。一切都在本地工作正常,但一旦我部署我碰到下面的錯誤在我的麒麟日誌:Rails,Sidekiq&Unicorn

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 

任何想法錯誤?

+0

嘗試需要在工人文件 –

+0

我想每個那些,但得到的「sidekiq」或「sidekiq /工人」'沒有這樣的文件load' –

+0

是否使用捆綁來管理依賴條件?如果是這樣,在你的Gemfile中是'gem'sidekiq「」嗎? – rossta

回答

0

這看起來像你的Gemfile中缺少gem 'sidekiq'

+0

我在我的Gemfile中有sidekiq,如果我做'bundle exec irb'然後'require'sidekiq 「'它加載得很好,並且它在我本地運行應用程序時正常工作 –

+0

當你運行'$ bundle show'時它會出現嗎?它在正確的組嗎?(即不是開發/測試)在Rails啓動過程中('config/{application,boot,environment} .rb')相關? – willglynn

0

如果它適用於dev而不是生產,那聽起來bundler並未在生產環境中加載gem。這取決於您的Gemfile中列出了哪些組以及您如何部署(您如何在生產中安裝您的寶石?)。

那麼,你可以發佈你的Gemfile,還有你的部署腳本中的相關位?

再次檢查sidekiq procs是否正在使用bundle exec啓動。

0

你是否在運行獨角獸?

bundle exec unicorn