`build':/ home / releases /#{release_number} /找不到Gemfile(Bundler :: GemfileNotFound)

时间:2014-07-14 15:00:01

标签: ruby-on-rails ruby unicorn capistrano3

INFO -- : executing ["/home/shared/bundle/ruby/2.1.0/bin/unicorn", "-c", "/home/current/config/unicorn/production.rb", "-E", "deployment", "-D", {12=>#<Kgio::UNIXServer:fd 12>}] (in /home/releases/20140714144301)
DEBUG[b59ba27c]     I, [2014-07-14T14:43:33.495683 #27897]  INFO -- : forked child re-executing...
DEBUG[b59ba27c]     /home/
DEBUG[b59ba27c]     lic/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.3/lib/bundler/definition.rb:23:in `build': /home/releases/20140710032913/Gemfile not found (Bundler::GemfileNotFound)

我很确定问题源于这样一个事实,即零停机部署,unicorn正在缓存此版本号:20140710032913。我有capistrano设置保留5个版本。在5次部署之后,旧的版本号将被下载。如何强制unicorn使用当前的Gemfile?

可能重复:Unicorn restart issue with capistrano

1 个答案:

答案 0 :(得分:0)

在我需要的#{Rails.root}/config/unicorn/#{environment}.rb文件中:

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