I just moved camelcamelcamel from an Apache mod_proxy + Mongrels architecture to Apache + mod_rails (Passenger) and Ruby Enterprise, a couple of pimp tricks I read about recently…unfortunately I ran into some problems and they are probably worth noting just in case anyone else has the same issues.
Pro tip: if you’re going to use Ruby Enterprise, install it first. Otherwise you’ll end up installing Passenger and configuring Apache twice, like I did.
First of all, I couldn’t dpkg -i the Ruby Enterprise (REE) .deb they provide for Ubuntu, as I’m running the amd64 release and the REE package is x86 only. There might be some way to force it, but installing from the source worked just fine.
I had no other problems until it came time to restart my newly-configured Apache. While it restarted without error, attempting to access the site revealed missing gems! It turns out REE keeps its own copies of all Ruby gems (and Ruby Gems itself), so you’ll need to use its copy of Ruby Gems via its full path (replace the version and date as necessary): sudo /opt/ruby-enterprise-1.8.6-20080624/bin/gem install <gem>. Do this for all of the gems required by your Rails projects, then restart Apache.
Coming from the mod_proxy environment, I needed to add a <Directory> entry for camelcamelcamel’s DocumentRoot in my vhost config. I came to this conclusion due to favicon.ico requests returning 500s. I config’d thusly:
<Directory “DocumentRoot Here”>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
At this point, things just worked for me. Quite a better experience than figuring out how to setup mod_proxy, to say nothing of the un-automated way I was managing my 10 Mongrels; I don’t even want to consider how often I’ve had to ‘stroke the following times 10: svn up followed by CTRL+A N, CTRL+C, up arrow, enter, my password, enter). I would be ashamed to be so lazy, but shame takes a lot of work (after all, I’m not Catholic.)
In addition to removing that shit from my plate, the new setup will launch more processes if necessary! Being limited to 10 requests per second was hurting the site’s responsiveness at times, so this should help quite a bit. Initial benchmarks suggest the homepage can handle ~62 reqs/s; this seems much more capable than 10 Mongrels, but I’ll have to wait and see how it goes before I really know. I’ve tweaked Apache with the same settings we use on the Shup / Stashbox server, so we should be able to serve a veritable boat load of requests at a time.
Note to self: donate to the makers of Passenger and REE as soon as they offer a non-Paypal method of payment and/or WAMU unfucks my checking account.
