Problem running ruby app under passenger with 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.


You'll need to install RVM as root so that it is a system-wide install and it is installed in /usr/local/rvm:

sudo bash < <(curl -s https://rvm.beginrescueend.com/install/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:

sudo rvm --default 1.8.7@akrotoski
sudo /etc/init.d/nginx restart
链接地址: http://www.djcxy.com/p/32526.html

上一篇: Sinatra宝石不会安装

下一篇: 在rvm下运行ruby app的问题