pal: Multiuser Wrapper for Mongrel, Release 1.0.2

pal is a Ruby script for *NIX which assists administrators in running and managing instances of Mongrel for multi-user hosting environments. It includes the ability to restart all registered Mongrel instances on system boot, and complete ownership of each Mongrel process by separate users. It is intended to be simple enough for a semi-technical customer to use via SSH.

pal was originally written out of necessity - we currently host a few Ruby on Rails applications on our server, however all of them we control. Recently though, we've started hosting RobotOz, which we don't develop. This has caused a few challenges, as the developer obviously needs to restart the Ruby on Rails site during development and new when he wishes to make a new release. (Remember kids, Rails caches a lot of your code in memory in the production environment).

In all honesty, we needed to revise the way in which we hosted our Rails apps anyway - previously we were using mod_fcgi, was more than painful with Apache and very, very unreliable. Also, to restart a Rails application, we needed restart the entire Apache process - a big problem, as we would have needed to give our friendly developer our root login. Not really optimal. Mongrel and a reverse-proxy setup is all the rage these days, so it sounded like the way to go.

My main goals in writing pal were simple:

  • Provide a way for the developer of RobotOz to quickly and simply restart his Mongrel processes, without requiring any of us to do anything, or him to need anything other than his standard user privileges;
  • Allow me to specify what port his Mongrel instance should be running on, according to what Apache is expecting;
  • Provide a mechanism to restart all Mongrel processes on server boot;
  • Provide a mechanism to stop, start and restart all Mongrel processes as root, in case of server upgrades or the such.

We have been using pal on our production server for well over a week now, and so far we have had no trouble with it - RobotOz's developer is pleased that he can now manage his site on his own, and I can more simply manage the other Rails apps which we host ourselves. Moving to Mongrel has also seriously improved the reliability of our sites.

So now, for your sysadmin edification, go and check out pal. Feed free to let me know what you think.