Capistrano的Unicorn Restart问题
-
26-10-2019 - |
题
我们正在使用CAP部署,并使用将USR2发送到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)
为了澄清这不是当前版本,而是较旧的版本,此后已被删除。
当它起作用时,它似乎确实可以正常工作 - 即它确实拾取了新代码 - 因此,我认为它并不是以某种方式指代旧版本。
有任何想法吗?
解决方案
你应该设置 BUNDLE_GEMFILE
在启动服务器之前,环境变量,将其指向 current/Gemfile
.
其他提示
在您的Unicorn.rb中添加tre_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-the-gemfile-not-found-found-bundlergemfilenotfound-error/
不隶属于 StackOverflow