Passenger 3 has been out since last October, so for most folks this will all be very, very old news. For those of you who haven’t upgraded yet, version 3 touts faster, more stable performance over version 2. It’s also very easy to set up on your development computer so you can have multiple Rails projects running in development simultaneously. For my setup I’m also using RVM to manage project-specific gemsets (read more about why I think this is a great idea), but standardizing on one Ruby version.
To start, it probably wouldn’t hurt to make sure you’ve got the latest version of RVM on your computer. At this writing, that’s version 1.2.4. The following should take care of the upgrade:
$ rvm update
$ rvm reloadNext, install the new Passenger gem (at 3.0.2 as I write this). This is very well documented on the RVM website, if you need more detail. I keep the Passenger gem in my @global RVM gemset.
$ gem install passengerNow run the Passenger module installer:
$ rvm passenger-install-apache2-module(Note: Earlier I’d incorrectly listed the above command as rvmsudo. This isn’t necessary. Thank you to Oldřich Vetešník for pointing this out.)
Follow the instructions, including making sure you copy the Apache configuration directives provided into your own Apache config files. The good news here is these lines already point to your RVM-specified Ruby (the Ruby you were using when you installed the Passenger gem), so Apache is all set.
Also note the suggested virtual host configuration provided; you may need it later depending on whether you’ve been using Passenger before or are using any supporting utilities for Passenger.
From here, it’s just a matter of preparing your Rails applications to take advantage of RVM’s gemsets feature. Again, I’ll refer you to an earlier post about adding a setup_load_paths.rb file to each new app’s config directory. You’ll also need to set up a virtual host for each new app. If you were using Passenger 2.2.x before, your existing virtual hosts should work fine. (The OS X Passenger Preference Pane, while still only 32-bit, is still working for me on my setup.)
I haven’t done this myself, but if you need to use this general setup with multiple versions of Ruby, refer to this post on Phusion’s blog about using proxies with Passenger and RVM
Join me on a thought experiment: How does my time-tested approach to testing Ruby on Rails applications apply to the tools we get from the framework? Whether you're new to Rails testing, or curious about the default testing stack, Testing Rails from Scratch gives you a pragmatic, end-to-end introduction to test-driven development. Covers Rails 8.1 and Ruby 4.0. Early release now available for sale on Leanpub!
Software development news and tips, and other ideas and surprises from Aaron at Left of the Dev. Delivered to your inbox on no particular set schedule.