I've got a server that predominantly runs Ruby 1.8.7, but now I have a Rails 3.2 app that needs 1.9.3. I've installed Passenger 4 as it supports the ability to run multiple Rubies on a per-virtual server basis.
However, it appears that while you can assign a particular Ruby, the application doesn't have access to that Ruby's gemset. So I have my virtual server configured with the 1.9.3 Ruby, as confirmed on the error page my application now gives:
Ruby interpreter command
/home/aaron/.rvm/rubies/ruby-1.9.3-p0/bin/ruby
But the GEM_HOME parameter tells a different story:
GEM_HOME = /home/aaron/.rvm/gems/ruby-1.8.7-p352
Looking through the configuration directives for Passenger 4, I see no way to specify a different gemset. Am I missing something, or is this thing just not ready for prime time?
From your gemset dir run:
$ passenger-config --ruby-command
It will tell you ruby path for Apache and Nginx.
Command: /home/deric/.rvm/wrappers/ruby-2.0.0-p247@my_gemset/ruby
Version: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]
To use in Apache: PassengerRuby /home/deric/.rvm/wrappers/ruby-2.0.0-p247@my_gemset/ruby
To use in Nginx : passenger_ruby /home/deric/.rvm/wrappers/ruby-2.0.0-p247@my_gemset/ruby
Nginx: For Passenger 4 you can specify multiple ruby versions. So for specific server config:
your_site.conf:
server {
listen 80;
root /home/aaron/web/public;
passenger_enabled on;
passenger_ruby /home/aaron/.rvm/wrappers/ruby-2.0.0-p247@your_gemset/ruby;
}
nginx.conf: (this works for new passenger 4.0.17)
http {
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
}
Just run from your gemset dir this:
$ passenger-status
It will check whether passenger_native_support.so
is available. Depending on your RVM installation, you might need to run it with rvmsudo
$ rvmsudo passenger-status
For Debian/Ubuntu there are now binary packages of nginx and passenger available which makes the installation much easier.
As Tombart pointed out: If you use the precompiled Passenger modules (in my case for for Apache2) you end up with a system up and running.
However, if using RVM I stumbled upon the fact that you need to use the "wrapper directory" to select the correct RVM ruby version and gemet like so in your Apache vhost config:
PassengerRuby /home/of_your_ruby_user/.rvm/wrappers/ruby-x.y.z-p123@gemset/ruby
This way Passenger knows how to find the correct gemset relative to this directory (../../gems/ruby-x.y.z-p123@gemset/gems
). Otherwise Passenger would use the "standard ruby gemset" which is odd if you want to run multiple apps with the same ruby version. I can only guess that this is similar for Nginx.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With