Technology Musings

July 05, 2009

Platforms / Migrating to Phusion Passenger


Spent the evening migrating one of my Ruby on Rails servers to Phusion Passenger.  It was a nice upgrade, but not the trouble-free upgrade they promise.  Here were the gotchas that I ran into:

  1. Remember to install all of the gems into your new enterprise ruby that were on your regular ruby.  This one is pretty obvious, but its easy to miss some
  2. Passenger preloads your application.  This means that if there were models that you never used (and thus never got loaded into Rails before), Passenger will load them for you, and if they are broken, your app will not start.  This also affected gem loading, as there was one gem which was loaded by a file that was unused, and therefore I didn't have it installed.  But Passenger required that I install the gem.
  3. Passenger basically works by default as a SetUID program.  It looks like whatever user owns the application is the user that Passenger will run it as.  This can cause all sorts of problems.  It can cause problems accessing log files and session files.  When I finally got my gem issues sorted out, I kept getting 500 errors and I found the following in my log file: file /tmp/ruby_sess.97c076be86e7dd90 not readable - This was because it was running as my development user rather than as Apache.  I had to use BOTH of the directives "PassengerUserSwitching off" and "PassengerDefaultUser apache" to get it to work.  
  4. Then I had to find and fix all of the badly-created permissions that had accrued while it was running as the wrong user
If I have any additional problems, I'll post them here.