Phusion Passenger with Ruby 1.8 and 1.9? - ruby-on-rails

How would I go about running two separate Rails applications using Phusion Passenger with one using Ruby 1.8.x and the other using Ruby 1.9.x ? I'm running Redmine which isn't Ruby 1.9.x compatible, and the other application is a home grown app.
I'm using Apache 2.2.x with Passenger 2.2.4.
Is this even possible ?

I ended up running Nginx with Passenger and Ruby 1.9 on port 80, and then proxying off my other virtual hosts to Apache 2.2 on port 8080 with Passenger and Ruby 1.8. Win!

Just a little late but I found this thanks to Google: Phusion Passenger & running multiple Ruby versions Must be the necromancer in me.

Use the PassengerRuby directive.

Passenger supports multiple Ruby interpreters as of version 4.0.0 (February 2013). The PassengerRuby config option has been made a per-virtual host option, so you can customize your Ruby interpreter on a per-application basis. See here for details.

Related

Is it possible to run puma and passenger in a same nginx server

We have a production machine runs on Nginx + phusion passenger. Passenger is pointing to ruby verions 2.3. Want to deploy another application into the same server in which we require, ruby version 2.4+.
I believe, we cannot use that with the passenger any more as it is already pointing to a ruby version. So thinking to use puma for the other app with ruby version 2.4.
Is it possible to run puma and passenger in a same nginx server ?

Passenger stand alone uses wrong ruby version?

Hello im using rails 4 with rvm - ruby verison 2.0.
But when i try to start passenger (stand alone) im getting syntax-errors.
It tells me:
Ruby interpreter command
/usr/bin/ruby1.8
How can i change it to the rvm 2.0 version?
I had the same problem: passenger standalone uses nginx, and after upgrading my app to use ruby 2.1.1 (specified in the .ruby-version), I saw similar errors.
On my production server, I know where the nginx configuration lives, so I could fix the path to the ruby interpreter.
However on the standalone setup I couldn't find it in less a minute, so I did a gem uninstall passenger followed by gem install passenger to have it recompile nginx.
Now it works, at least until the next ruby interpreter bump.
you need to use ruby first:
rvm use ruby
it might display additional instructions - make sure to read them

Switch ruby when restarting rails app deployed on Passenger

Is it possible to switch from Ruby 1.8.7 to 1.9.2 when restarting a Rails app that is deployed on Passenger? It should be possible to change PassengerRuby in httpd.conf and restarting Apache. I want to know how it can be done without restarting Apache every time.
More info: We have two different apps, one on Rails 2.3.8 and one on 3.0.5 with the same name, and want to switch between them for testing purposes.
Thanks.
Yes you can switch which versions of ruby you use. Life is easy when you use rvm (http://rvm.beginrescueend.com/). Then you can install the passenger gem in different ruby environments, and when you do it in each environment, the passenger-install-apache2-module command will tell you what to put in the apache config file. For example, mine is now (mac osx - should be similar in other *nixes):
### system ruby and passenger
#LoadModule passenger_module /Library/Ruby/Gems/1.8/gems/passenger-3.0.7/ext/apache2/mod_passenger.so
#PassengerRoot /Library/Ruby/Gems/1.8/gems/passenger-3.0.7
#PassengerRuby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
### rvm gemset 1.8.7#rails2.3.11 ruby and passenger
LoadModule passenger_module /Users/matt/.rvm/gems/ruby-1.8.7-p334#rails2.3.11/gems/passenger-3.0.7/ext/apache2/mod_passenger.so
PassengerRoot /Users/matt/.rvm/gems/ruby-1.8.7-p334#rails2.3.11/gems/passenger-3.0.7
PassengerRuby /Users/matt/.rvm/wrappers/ruby-1.8.7-p334#rails2.3.11/ruby
I can comment/uncomment the appropriate one and restart apache with the different version of ruby. This also works for ruby 1.9.2 and ruby enterprise edition too.
You don't need a recompile. You just just need to change the PassengerRuby option in the web server. You do need to restart the web server however, just touching restart.txt is not enough.
You can also use Passenger Standalone as a replacement for the Thin/Mongrel/Unicorn reverse proxy setup that bioneuralnet has mentioned. In fact we have a blog post dedicated to running multiple Ruby versions with Passenger Standalone: http://blog.phusion.nl/2010/09/21/phusion-passenger-running-multiple-ruby-versions/
Since Passenger kind of "embeds" itself into Apache, I don't it's possible to switch ruby interpreters without a restart (and possibly even a recompile of Passenger?). To achieve that level of flexibility you may need to look into some kind of reverse-proxy setup involving a stand-alone app server like Thin, Unicorn or Mongrel, running behind Apache or Nginx.
If that's out of the question, then it is strictly possible for Rails 2.3.8 and 3.0.5 apps to both run on Ruby 1.8.7. I have several Rails 3 apps deployed on 1.8.7, though hopefully that will change soon. Assuming your 3.0.5 app doesn't have explicit 1.9 dependencies, why can't you just run them both side by side on 1.8 in separate virtual hosts?

manually compiling ruby 1.8.7 on ubuntu hardy

running two rails 2.3.8 apps on two virtual servers in ubuntu 8.04 with apache and passenger. the ruby version is 1.8.6
we are upgrading one of the apps to rails 3.0.4. my understanding is that we need ruby 1.8.7 to run the app. with this version of ubuntu we will need to compile ruby 1.8.7 manually.
never compiled manually before. if you know of any resources i should check out that would be great.
i have not been able to determine the version of passenger and am trying to make sure it will be compatible with rails 3.0.4. any suggestions?
the application we are leaving in 2.3.8 is our core business application and i need to make sure i don't mess it up.
Thanks!
Just use RVM. Almost everybody use it now.
Early Passenger versions for Apache had some bugs so my suggestion is to simply upgrade Passenger to the newest version.

with RVM, can multiple rails sites using different rvm's with nginx and passenger?

with RVM, can multiple rails sites using different rvm's with nginx and passenger?
Passenger 3 has support for this. You need to set up reverse proxying, pick which will be your default ruby, and use Passenger Standalone on a different port for each non-default version of ruby you want to use.
Have a read of this article on the Phusion blog - it explains it better than me.
See Installing RVM System Wide and Deployment Best Practices.

Resources