Unicorn 重启 Capistrano 问题
我们正在使用 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)
澄清一下,这不是当前版本,而是已被删除的旧版本。
当它工作时,它似乎工作正常 - 即它确实拾取了新代码 - 所以我不认为它在某种程度上陷入了旧版本的困境。
有什么想法吗?
We're deploying with cap and using a script that send USR2 to the unicorn process to reload and it usually works but every once in a while it will fail. When that happens looking in the unicorn log reveals that it's looking for a Gemfile in an old release directory that no longer exists.
Exception :
/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)
To clarify that's not the current release but an older one that's since been removed.
When it works it does seem to work correctly - ie it does pickup the new code - so I don't think it's somehow stuck referring to the old release.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在你的 unicorn.rb 中添加 before_exec 块
在这里阅读更多相关信息 http://blog.willj.net/2011/08/02/fixing-the-gemfile-not-found-bundlergemfilenotfound-error/
In your unicorn.rb add the before_exec block
Read more about it here http://blog.willj.net/2011/08/02/fixing-the-gemfile-not-found-bundlergemfilenotfound-error/
您应该在启动服务器之前设置
BUNDLE_GEMFILE
环境变量,将其指向current/Gemfile
。You should set the
BUNDLE_GEMFILE
environment variable before you start the server, point it atcurrent/Gemfile
.