Unicorn 重启 Capistrano 问题

发布于 2024-12-18 17:29:18 字数 461 浏览 4 评论 0原文

我们正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

跨年 2024-12-25 17:29:18

在你的 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/

In your unicorn.rb add the before_exec block

current_path = "/var/www/html/my project/current"

before_exec do |server|
  ENV['BUNDLE_GEMFILE'] = "#{current_path}/Gemfile"
end

Read more about it here http://blog.willj.net/2011/08/02/fixing-the-gemfile-not-found-bundlergemfilenotfound-error/

思念满溢 2024-12-25 17:29:18

您应该在启动服务器之前设置 BUNDLE_GEMFILE 环境变量,将其指向 current/Gemfile

You should set the BUNDLE_GEMFILE environment variable before you start the server, point it at current/Gemfile.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文