Multi-App Mongrel Cluster Init Script January 22, 2008Posted 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/.