自从我试图解决这个问题以来已经有 12 个小时了......这里是:
在我的控制器内部,我有一个这样的方法:
def restart_workers system("cd /var/www/sts/current && bundle exec rake RAILS_ENV=#{Rails.env.to_s} resque:restart_workers") redirect_to presets_path, :notice=>"Worker'lar yeniden yuklendi. Yeniden acilmalari birkac saniye surebilir." end
我想要的只是使用该 rake 任务来重新启动我的 Resque 工作人员......该任务在应用程序初始化期间完美运行。
当我在控制台中尝试时,这条线完美运行:
system("cd /var/www/sts/current && bundle exec rake RAILS_ENV=#{Rails.env.to_s} resque:restart_workers")
但是当我通过我的应用程序调用这个方法时,我在我的下面看到了错误unicorn.log
:
/home/deployer/.rvm/gems/ruby-2.0.0-p0/gems/bundler-1.3.5/lib/bundler/definition.rb:16:in `build': /var/www/sts/releases/20130422190645/Gemfile not found (Bundler::GemfileNotFound)
from /home/deployer/.rvm/gems/ruby-2.0.0-p0/gems/bundler-1.3.5/lib/bundler.rb:148:in `definition'
from /home/deployer/.rvm/gems/ruby-2.0.0-p0/gems/bundler-1.3.5/lib/bundler.rb:116:in `setup'
from /home/deployer/.rvm/gems/ruby-2.0.0-p0/gems/bundler-1.3.5/lib/bundler/setup.rb:17:in `<top (required)>'
from /home/deployer/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /home/deployer/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
我真的被困住了。
任何帮助表示赞赏,谢谢!
仅供参考,我正在使用:RVM、Capistrano、Unicorn、nginx