我们正在使用 cap 进行部署,并使用一个脚本将 USR2 发送到 unicorn 进程进行重新加载,它通常可以工作,但偶尔会失败。当这种情况发生时,查看 unicorn 日志会发现它正在不再存在的旧版本目录中寻找 Gemfile。
例外 :
/usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/definition.rb:14:in `build': /var/www/railsapps/inventory/releases/20111128233407/Gemfile not found (Bundler::GemfileNotFound)
澄清一下,这不是当前版本,而是已被删除的旧版本。
当它工作时,它似乎工作正常 - 即它确实拾取了新代码 - 所以我不认为它在某种程度上陷入了旧版本的困境。
有任何想法吗?
在你的 unicorn.rb 中添加 before_exec 块
current_path = "/var/www/html/my project/current"
before_exec do |server|
ENV['BUNDLE_GEMFILE'] = "#{current_path}/Gemfile"
end
在这里阅读更多相关信息http://blog.willj.net/2011/08/02/fixing-the-gemfile-not-found-bundlergemfilenotfound-error/ http://blog.willj.net/2011/08/02/fixing-the-gemfile-not-found-bundlergemfilenotfound-error/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)