Running Mongrel under DaemonTools
I've installed DaemonTools to make sure that the various services I run are up and behaving reasonably nicely. Since I also run plenty of Rails applications I use this DaemonTools script to keep Mongrel running.
#!/bin/sh exec 2>&1 echo "Starting..." ENVIRONMENT=production PORT=8000 IP=0.0.0.0 CHDIR=/var/www/www.application.com USER=application_user exec softlimit -m 134217728 \ setuidgid $USER \ env HOME=$CHDIR \ mongrel_rails start -e $ENVIRONMENT -p $PORT -a $IP -c $CHDIR 2>&1
Create a separate service for each Mongrel you'd like to run and change the PORT variable in the script.
Disagree? Found a typo? Got a question? If you'd like to have a conversation about this post, email email@example.com. I don't bite.