Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve the "You need to add gem 'daemons' to your Gemfile if you wish to use it" error in production mode?

I am trying to properly use Capistrano and RVM in order to deploy my Ruby on Rails 3.2.2 application to the remote machine that is running Ubuntu 10.04 LTS. It seams that I solved my previous problem related to the "Rvm - Capistrano integration on Linux Ubuntu". However, on deploying I get the following error related to the DelayedJob gem:

    ...
  * executing "cd /srv/www/<APP_NAME>/releases/20120314135318 && bundle install"
    servers: ["<DOMAIN>"]
    [<DOMAIN>] executing command
    [<DOMAIN>] rvm_path=/usr/local/rvm /usr/local/rvm/bin/rvm-shell 'ruby-1.9.3-p125' -c 'cd /srv/www/<APP_NAME>/releases/20120314135318 && bundle install'     ** [out :: <DOMAIN>] Using rake (0.9.2.2)
 ** [out :: <DOMAIN>] Using builder (3.0.0)
    ...
 ** [out :: <DOMAIN>] Using daemons (1.1.8)
 ** [out :: <DOMAIN>] Using delayed_job (3.0.1)
 ** [out :: <DOMAIN>] Using delayed_job_active_record (0.3.2)
    ...
 ** [out :: <DOMAIN>] Your bundle is complete! It was installed into /srv/www/<APP_NAME>/shared/bundle
    ...
    [<DOMAIN>] executing command
    [<DOMAIN>] rvm_path=/usr/local/rvm /usr/local/rvm/bin/rvm-shell 'ruby-1.9.3-p125' -c 'cd /srv/www/<APP_NAME>/current;  RAILS_ENV=production script/delayed_job stop'
*** [err :: <DOMAIN>] /usr/local/rvm/gems/ruby-1.9.3-p125/gems/delayed_job-3.0.1/lib/delayed/command.rb:4:in `rescue in <top (required)>'
*** [err :: <DOMAIN>] :
*** [err :: <DOMAIN>] You need to add gem 'daemons' to your Gemfile if you wish to use it.
*** [err :: <DOMAIN>] (
*** [err :: <DOMAIN>] RuntimeError
*** [err :: <DOMAIN>] )
*** [err :: <DOMAIN>] from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/delayed_job-3.0.1/lib/delayed/command.rb:1:in `<top (required)>'
*** [err :: <DOMAIN>] from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `require'
*** [err :: <DOMAIN>] from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `block in require'
*** [err :: <DOMAIN>] from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:236:in `load_dependency'
*** [err :: <DOMAIN>] from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `require'
*** [err :: <DOMAIN>] from script/delayed_job:4:in `<main>'
    command finished in 7512ms
*** [deploy:update_code] rolling back
    ...

failed: "rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell 'ruby-1.9.3-p125' -c 'cd /srv/www/<APP_NAME>/releases && tar xzf /tmp/20120314140345.tar.gz && rm /tmp/20120314140345.tar.gz'" on <DOMAIN>

Even if the error explanation is "You need to add gem 'daemons' to your Gemfile if you wish to use it", I already added the daemons gem to my Gemfile (from the above output you can even note that I am "Using daemons (1.1.8)"):

...
gem 'delayed_job'
gem 'delayed_job_active_record'
gem 'daemons'
...

So, what is the problem? How can I solve that?


In my deploy.rb file I have:

$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require 'rvm/capistrano'
set :rvm_ruby_string, 'ruby-1.9.3-p125'
set :rvm_type, :user
require 'bundler/capistrano'
...

P.S.: Terminal window output:

 $ ruby -v
 > ruby 1.9.3p125 (2012-02-16 revision 34643) [i686-linux]
 $ which ruby
 > /usr/local/rvm/rubies/ruby-1.9.3-p125/bin/ruby
like image 352
user502052 Avatar asked Nov 04 '22 03:11

user502052


1 Answers

Run script/delayed_job with bundler: bundle exec script/delayed_job start

like image 54
betamatt Avatar answered Nov 09 '22 11:11

betamatt