执行几次的部署之后(完成 5 次部署),就会部署失败,报错信息:Bundler::GemfileNotFound,报错语句:passenger-config restart-app /XXX/XXX/XXX --ignore-app-not-running
背景: 使用 passenger 作为 app server, capistrano 作部署工具 使用了 gem 'capistrano-passenger'完成 restart app 的任务,实际执行命令为:passenger-config restart-app /XXX/XXX/XXX --ignore-app-not-running
找的答案如下:https://stackoverflow.com/questions/15393462/what-can-i-do-about-a-bundlergemfilenotfound-error
“In my experience, this will occur when your code is not executing in the directory you think it is (hence the previous answer), or the directory containing the Gemfile has been moved or deleted.
I experienced this when I had been running unicorn on a server running an app that had been deployed with Capistrano. After cleaning up some old "releases" folders, I got this error when I tried to cap deploy a new release.
Because unicorn had been started with bundle exec, it was still using the Gemfile from the directory it was started in; sending the USR2 signal would tell it to reload the application, but it will still use the old Gemfile before loading the newly-deployed app. Of course, I had deleted that Gemfile when I deleted the old releases.
The solution was to restart unicorn with a new bundle exec in the new directory, to load the new Gemfile and then the new app.
So, the answer above is correct. You just need to figure out why the Gemfile you thought you were using is not being used.”
有人遇到这种情况吗?如何解决的?