简体   繁体   English

乘客没有此类文件可加载配置/环境

[英]Passenger No Such File To Load config/environment

I was trying to make some simple changes to an old app of mine (Rails 3.0.0, Ruby 1.8.7) last night and ran into a number of issues upon deploy. 昨晚,我试图对我的旧应用程序(Rails 3.0.0,Ruby 1.8.7)进行一些简单的更改,并在部署时遇到了许多问题。 I'm using Moonshine to handle deploys. 我正在使用Moonshine处理部署。

I can run cap deploy without error, but then I get the following Passenger error 我可以运行cap deploy而不会出错,但是随后出现以下乘客错误

no such file to load -- /srv/BBRatboard/releases/20130409025824/config/environment

I'm not sure if it's relevant, but when I ssh into the box, the whole config folder under /srv/BBRatboard/current/config is empty. 我不确定是否相关,但是当我将ssh放入框中时, /srv/BBRatboard/current/config下的整个config文件夹为空。 Is this by design or is something going wrong in my deploy? 这是设计使然,还是我的部署出现问题?

A number of people have been able to solve this by adjusting the permissions on the environment.rb file ( https://www.sit.auckland.ac.nz/Ruby_on_Rails_deployment ), but I'm not even able to see it on my production server. 许多人已经能够通过调整environment.rb文件( https://www.sit.auckland.ac.nz/Ruby_on_Rails_deployment )的权限来解决此问题,但我什至无法在我的网站上看到它生产服务器。

I can provide any details necessary, any help would be GREATLY appreciated as the app is currently in a broken state. 我可以提供必要的任何详细信息,由于该应用程序当前处于损坏状态,因此将不胜感激。

Thanks so much. 非常感谢。

You definitely need files to be present within your config directory. 您肯定需要在config目录中包含文件。 It looks like your cap deploy output shows it it is deleting the release's config directory: 好像您的cap deploy输出显示它正在删除发行版的config目录:

executing "chmod -R -- g+w /srv/BBRatboard/releases/20130409032459 && rm -rf -- /srv/BBRatboard/releases/20130409032459/system && ln -s -- /srv/BBRatboard/shared/system /srv/BBRatboard/releases/20130409032459/system && rm -rf -- /srv/BBRatboard/releases/20130409032459/log && ln -s -- /srv/BBRatboard/shared/log /srv/BBRatboard/releases/20130409032459/log && rm -rf -- /srv/BBRatboard/releases/20130409032459/pids && ln -s -- /srv/BBRatboard/shared/pids /srv/BBRatboard/releases/20130409032459/pids && rm -rf -- /srv/BBRatboard/releases/20130409032459/config && ln -s -- /srv/BBRatboard/shared/config /srv/BBRatboard/releases/20130409032459/config" 执行“ chmod -R-g + w / srv / BBRatboard / releases / 20130409032459 && rm -rf-/ srv / BBRatboard / releases / 20130409032459 / system && ln -s-/ srv / BBRatboard / shared / system / srv / BBRatboard / releases / 20130409032459 / system && rm -rf-/ srv / BBRatboard / releases / 20130409032459 / log && ln -s-/ srv / BBRatboard / shared / log / srv / BBRatboard / releases / 20130409032459 / log && rm -rf-/ srv / BBRatboard / releases / 20130409032459 / pids && ln -s-/ srv / BBRatboard / shared / pids / srv / BBRatboard / releases / 20130409032459 / pids && rm -rf-/ srv / BBRatboard / releases / 20130409032459 / config && ln -s-/ srv / BBRatboard / shared / config / srv / BBRatboard / releases / 20130409032459 / config“

(look at the end, rm -ff -- /srv/BBRatboard/releases/20130409032459/config ). (最后看一下rm -ff -- /srv/BBRatboard/releases/20130409032459/config )。 Although its also trying to symlink the config directory to the shared/config directory ( ln -s -- /srv/BBRatboard/shared/config /srv/BBRatboard/releases/20130409032459/config ) 尽管它也尝试将config目录符号链接到shared/config目录( ln -s -- /srv/BBRatboard/shared/config /srv/BBRatboard/releases/20130409032459/config

I'm guessing that the shared/config directory is created during cap deploy:setup (based on the Moonshine docs which recommend running it before cap deploy ). 我猜想shared/config目录是在cap deploy:setup期间创建的(基于Moonshine文档 ,建议在cap deploy之前运行它)。 I would ensure you have run the cap deploy:setup task beforehand, and check that your shared/config directory has contents such as the environment.rb file it claims is missing. 我将确保您事先运行了cap deploy:setup任务,并检查您的shared/config目录中是否包含诸如声称缺少的environment.rb文件的内容。

After a little more digging, it looks like this is an issue of differing versions of capistrano/moonshine and the way they handle the shared assets. 经过进一步的挖掘后,看起来这是一个不同版本的capistrano / moonshine及其处理共享资产的方式的问题。

I followed a suggestion at https://github.com/railsmachine/moonshine/wiki/Moonshine.yml-files-not-being-loaded-or-configuration-object-appears-empty 我在https://github.com/railsmachine/moonshine/wiki/Moonshine.yml-files-not-being-loaded-or-configuration-object-appears-empty中遵循了一个建议

namely replacing config with tmp and it seems to work for now! 即用tmp代替config,现在看来可以了!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM