Passenger 4 with passenger cargo and another set of precious stones

I have a server that mainly works with Ruby 1.8.7, but now I have a Rails 3.2 application that needs version 1.9.3. I installed Passenger 4 because it supports the ability to run multiple Rubies based on a virtual server.

However, it seems that although you can assign a specific Ruby, the application does not have access to this Ruby gemset. So I have my virtual server configured with 1.9.3 Ruby, as confirmed on the error page that my application now provides:

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 it just not ready for prime time?

+7
source share
2 answers

From running gemset dir:

  $ passenger-config --ruby-command 

It will tell you the 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 several ruby ​​versions. Therefore, for a specific server configuration:

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 the 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 if passenger_native_support.so is available. Depending on your RVM installation, you may need to run it using rvmsudo

  $ rvmsudo passenger-status 

Debian / Ubuntu now has nginx binary packages available for passengers , which greatly simplifies installation.

+21
source

As Tombart pointed out: If you use pre-compiled passenger modules (in my case for Apache2) you end up starting the system.

However, if I use RVM , I stumbled upon the fact that you need to use the "wrapper directory" to select the correct RVM ruby ​​version and hemet , for example, in your Apache vhost configuration:

 PassengerRuby /home/of_your_ruby_user/.rvm/wrappers/ ruby-x.y.z-p123@gemset /ruby 

Thus, the passenger knows how to find the correct gemset regarding this directory ( ../../gems/ ruby-x.y.z-p123@gemset /gems ). Otherwise, the passenger would use the “standard ruby ​​gemset”, which is odd if you want to run several applications with the same ruby ​​version. I can only guess that this is similar to Nginx.

+6
source

All Articles