jump to navigation

Multi-App Mongrel Cluster Init Script January 22, 2008

Posted by John Dewey in Capistrano, Configuration, Deployment, Mongrel, Rails.

I found the mongrel_cluster.sh script, everyone uses — doesn’t quite cut it.   Especially, when a system may host several RoR applications.  Why, you ask?  The ability to easily control, and dynamically discover applications is missing.  In most cases, this doesn’t matter.  Especially when the applications are deployed with Capistrano, since it is leveraged for various tasks (including stop, starts, and restarts).

The SAs on the other hand, usually do not use Capistrano (they should!), or have a recent version of the app checked out.  Having a standard init script across all your applications and servers becomes useful.

You get bonus points for dynamically discovering new application installs.We can make certain assumptions in our environment.

We use Capistrano, apps run as the same user,  live under the same base directory, and link to common Subversion Rake tasks.  That enables the use of a generic Rake task to control all RoR applications. Furthermore, the Rake task can be wrapped by a system init script for use under /etc/init.d/.


1. Paolo Campegiani - January 25, 2008

As a sysadmin, I have some difficulties in using a script written in something different than Bash to control a server, because at least I know that this requires a working and fixed environment to interpret it before actually running the server, and everything could happen in the startup phase.
If you need a script to control your Mongrel instances, selectively running and stopping them, already wrapped in a /etc/init.d running script, please check mine:

it’s tailored for RHEL, Fedora and derivatives, but it could fixed for other Linuxes with no real problem. And your sys admin might even enjoy using it 🙂

2. John Dewey - January 26, 2008

Hey Paolo –

That is a nice script you have. As an ex-sysadmin I understand your concerns. Development would ship the rake task with each project. SA just needs a way to call the restart tasks, which is what you are doing with mongrel_rails (and that is written in ruby :)). There are a few benefits to my solution, such as no configuration necessary, and works on all versions of unix|linux (granted my init script was just thrown together — could use the chkconfig comments; further error checking).


Leave a Reply to Paolo Campegiani Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: