使用rvm在乘客下运行ruby应用程序时出现问题
我已经将一个 ruby 应用程序(使用 Thoth,它又使用 Ramaze)切换到带有捆绑器的 rvm ruby@gemset 组合内工作。我可以访问它的控制台版本,所以它对它拥有的宝石感到很高兴。但是,当我尝试通过服务器访问它时(通过 nginx 下的乘客),我从乘客那里收到此错误:
无法在任何源中找到 activesupport-2.3.8 (Bundler::GemNotFound)
我不明白这一点因为我确实在 rvm 中的应用程序 gemset 中安装了 activesupport 2.3.8。也许乘客不了解RVM,或者不知道如何使用正确的RVM?我不确定乘客如何连接到我的应用程序,以及它是否需要了解 rvm 等信息。我见过的对乘客的唯一引用是在我的 nginx 配置块中,其中我说 passenger_enabled on;
还有其他人遇到过这种性质的问题吗?
max
编辑:有关我的设置的更多详细信息:
我的应用程序位于 /var/www/apps/akrotoski
这是在一个名为 ruby-1.8.7-p302@akrotoski 的 rvm/gemset 中,
我刚刚想到这可能是在 root 下运行的 nginx 的问题。如果我切换到 root 并执行 echo $PATH
我得到
/opt/ruby-enterprise-1.8.7-2011.01/bin/:/usr/local/sbin:/usr/local/ bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
如果我在应用程序的 rvm 中 echo $PATH
我得到
/home/部署/.rvm/gems/ruby-1.8.7-p302@akrotoski/bin:/home/deploy/.rvm/gems/ruby-1.8.7-p302@global/bin:/home/deploy/.rvm/rubies /ruby-1.8.7-p302/bin:/home/deploy/.rvm/bin:/opt/ruby-enterprise-1.8.7-2011.01/bin:/usr/local/sbin:/usr/local/bin: /usr/sbin:/usr/bin:/sbin:/bin:/usr/games
那么也许 nginx/passenger 的运行方式不使用 rvm?就像我说的,我对乘客实际上如何以这种方式连接到应用程序非常无知。
I've switched a ruby app (using Thoth, which uses Ramaze in turn) over to work inside an rvm ruby@gemset combo, with bundler. I can access the console version of it, so it's happy about what gems it has. However, when i try and access it via the server, (via passenger under nginx) i get this error from passenger:
Could not find activesupport-2.3.8 in any of the sources (Bundler::GemNotFound)
I don't understand this as i do have activesupport 2.3.8 installed in the app's gemset in rvm. Perhaps passenger doesn't know about rvm, or know to use the right rvm? I'm unsure how passenger hooks into my app, and whether it needs to know about the rvm for instance. The only reference to passenger i have seen is in my nginx config block, where i say passenger_enabled on;
Has anyone else had problems of this nature?
max
EDIT: some more details about my setup:
My app is in /var/www/apps/akrotoski
This is in a rvm/gemset called ruby-1.8.7-p302@akrotoski
It just occurred to me that this might be a problem with nginx running under root. If i switch to root and do echo $PATH
i get
/opt/ruby-enterprise-1.8.7-2011.01/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
If i echo $PATH
in my app's rvm i get
/home/deploy/.rvm/gems/ruby-1.8.7-p302@akrotoski/bin:/home/deploy/.rvm/gems/ruby-1.8.7-p302@global/bin:/home/deploy/.rvm/rubies/ruby-1.8.7-p302/bin:/home/deploy/.rvm/bin:/opt/ruby-enterprise-1.8.7-2011.01/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
So maybe nginx/passenger is running in such a way as to not be using the rvm? Like i say i'm quite ignorant of how passenger actually hooks into an app in this way.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要以 root 身份安装 RVM,以便它是系统范围的安装,并且安装在 /usr/local/rvm 中:
您可以阅读更多内容 这里有关安装的信息。此外,您还需要确保您的默认 rvm 是启动 nginx 应用程序的正确值。例如,您可能想要执行以下操作:
You'll need to install RVM as root so that it is a system-wide install and it is installed in /usr/local/rvm:
You can read more here about the installation. Also, you'll want to ensure that your default rvm is the correct one for starting your nginx application. For example, you might want to do the following: