0
votes

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.

1
How are you starting passenger/nginx? What command are you using and what directory are you running it from? - Pan Thomakos
Hi pan. I'm starting nginx with /etc/init.d/nginx restart. Because i have the passenger_enabled on; block in my nginx config for this app then it should pick it up automatically. I can restart the passenger-enabled app with touch tmp/restart.txt in the application's root folder. I'll add some more details to my OP about folders etc. - Max Williams
Did you install rvm as sudo and system-wide or just for a specific user? - Pan Thomakos
Just for a specific user - i guess that was my mistake? (see edit to OP). I just switched to root and did 'rvm' and it didn't recognise the command. There's a .bashrc hack you need to do to be able to use the rvm command http://www.christopherirish.com/2010/08/25/how-to-install-rvm-on-ubuntu-10-04/comment-page-1/#comment-103 and i tried that in root's .bashrc and that didn't help. So, i guess i screwed up. What's the best way to fix this do you think, ie to give root access to rvm as well? Should i just install it again as root? Will that cause conflict? - Max Williams

1 Answers

1
votes

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