mongrel and launchd alternatives

i used an excellent article a while back to set up a launch daemon for
my rails apps on my mac.

now i am at the point where i am ready to move a few things over to
production and i'm wondering what the best way of doing this is on
other operating systems. currently i am using CentOS 3.8 i686.

what are other people doing to keep their apps running? if one goes
down or i have to restart, i'm basically having to go in and start
mongrel for every app i have running on the site.

Use monit: and add monit to your init. Assuming you’re using mongrel, it’ll watch them and restart them if necessary.


someone just posted this to the Mongrel list:

Whats new?

Beside the things added in previous announcement [1], this version add
basic process monitoring.

What that means?

If for some reason the mongrel process (also a ruby process) suddenly

dies (maybe a runtime error), the service will automatically re-create
a new process.

So, in intervals of 5 seconds, if your process die, it will be recreated.

That will reduce the uptime problems of your applications, right?

Later this weekend will add the cluster capability, so Windows no
longer envy users running *nix or OSX :wink:

Oh, BTW, if you don’t want to add a service in windows, you could
“simulate” it using console command:

mongrel_service console single -c “c:/path/to/my/rails/app” -p 4000 -e

Please, all the folks on Windows environment try the latest build of
the gem and report problems (if any was found).


Vishnu Gopal wrote:

Use monit: and add monit to your init.
Assuming you're using mongrel, it'll watch them and restart them if

I have to second this recommendation. We just started using monit to
monitor our mongrels this past week, and we couldn't be happier. Not
only does it monitor whether the service is up or not, it also monitors
cpu and memory usage, allowing you to take action appropriately. If
that isn't enough, it also provides a simple web interface, giving you
up to the minute info on all your processes, allowing you to restart
them right from the interface.

Here is an example of the configuration syntax:

check process mongrel_8000 with pidfile /path/to/
     start program "/usr/bin/mongrel_rails cluster::start -C
     stop program "/usr/bin/mongrel_rails cluster::stop -C
     # alert me if memory is greater than 40MB
     if totalmem > 40.0 MB for 2 cycles then alert
     # restart if memory is greater than 50MB
     if totalmem > 50.0 MB for 4 cycles then restart