from the desk of michael nutt

mod_rails

The webserver stack for Rails-based projects changes every 6 months or so.  First it was apache+fastcgi, then lighttpd+fastcgi, then apache+mongrel, then nginx+mongrel.  Our production servers for limespot.com are using nginx+mongrel, but there's a new deployment option out now: Phusion Passenger, otherwise known as mod_rails.

At last week's hackfest I decided to try out mod_rails to see how easy it was.  The website advertised it as the easiest deployment option, so here it is:

Installation is really as simple as gem install phusion-passenger and then passenger-install-apache2-module while following its instructions.  I'm using Leopard so I already had apache and simply edited /etc/apache2/httpd.conf and added the three required lines.

From there it got a little bit weird.  I think mod_rails' ideal use in development would be to be able to point it to ~/Sites and have it rails-ify each of the sub-directories.  I tried setting Apache's DocumentRoot to /Users/michael/Sites, but mod_rails didn't pick up the sub-directories as rails apps.  I had to link each public directory to my webserver's DocumentRoot and use the RailsBaseURI directive in order to manually specify each rails app.

The first rails app I tried was my company's intranet app.  I was quickly presented with a beautiful error page telling me I had failed.  It wasn't very helpful, but wow did it look good!  It wasn't hitting rails at all and the only apache log message was "define INLINE_DIR or HOME in your environment"  ImageScience was to blame, and I never could figure out how to get it to find INLINE_DIR on its own.

I figured I would go ahead and try LimeSpot, and to my pleasant surprise it just worked (mostly).  Rails' stylesheet caching didn't work properly, but after I turned it off the stylesheets came down just fine and everything was rewritten with the "/limespot" prefix.  Our custom mongrel handlers didn't work, obviously, so it will be a while before LimeSpot switches to mod_rails.

All in all, mod_rails is looking to be a really promising deployment solution, even in a development environment. It would be great if it could be made to detect all rails projects in a directory and automagically serve them from subdomains or subdirectories.

Update: mod_rails supposedly supports Rack now, though I haven't looked into it.

Comments

Loading Plugin
Loading Plugin
Loading Plugin
Loading Plugin
Loading Plugin

Valid HTML 4.01 Strict