Running Starling under DaemonTools

I've been playing with Starling quite a bit recently. Like most of my deployed tools, I like to be sure that it's running. Here's a run script for Starling under DeamonTools:

#!/bin/sh
# This is /home/starling/service/run

exec 2>&1

echo "Starting..."

PORT=22122
IP=0.0.0.0
USER=starling
HOME=/home/starling

exec setuidgid $USER \
     starling -v -v -v -h $IP -p $PORT -P $HOME/starling.pid -q $HOME/queue 2>&1

You'll want to keep the logs too. Here's the log/run script:

#!/bin/sh
# This is /home/starling/service/log/run

exec multilog t s1000000 n10 ./main

Note that you'll have to create the starling user to use these scripts (or just change the scripts).

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.

Packaging and deployment with Ubuntu

After extensively customising some software on one of our hosts I decided that instead of repeating the procedure another 20 times I'd package the customisations and install that package onto the appropriate hosts. Only one problem: I had no idea how to create Ubuntu packages or distribute them.

After several hours gathering information from a lot of sources that never seem to tell you quite enough to get your software packaged and deployable I've pulled together two articles. Hopefully they'll be helpful to others. Oh, and please do feel free to correct my mistakes - that's the philosophy behind a Wiki after all.

About the boy

A picture of Craig in grayscale

Craig Webster is a software engineer living in London. He usually works with Ruby although sometimes he sneaks in some Erlang or JavaScript. He's into rock climbing, snowboarding, skating, photography and fencing. Yes, this does mean he has a sword.

Near here you'll find Craig's homepage, contact details, PGP key and keysigning policy, and talks.

Licence

The entire content of this blog is public domain. Use it however you fancy. You don't even need to attribute it to me, although it would be nice if you did. Just don't sue me and we'll all be happy.

I Work With Rails

Recommend Me

My Travels

I go places. Do you go places too? Let's meet up!.