Supervisor has been getting a lot of press lately, but I couldn't find a standard way of starting it on Ubuntu. This seemed like a chicken and egg problem. Furthermore, I knew my buddy Mike Orr was having a hard time getting log rotation working with it.
I wanted something that could restart my process as necessary, so I decided against a standard rc script, even though I knew Paster has a --monitor-restart option. I eventually settled on runit. I had used it in the past, the directions were clear, and it just "felt right". My buddy Allan Bailey even gave me a quick cheat sheet.
If anyone can show me a nice comparison of all of these options, I'd love to read it. I wasn't able to find much on Google that compared them all.
Anyway, here's what I did in outline form:
Setup myapp under runit:
mkdir -p /etc/sv/myapp/log
mkdir -p /var/log/myapp
cat > /etc/sv/myapp/log/run << __END__
exec chpst -u www-data:www-data svlogd -tt /var/log/myapp
chmod +x /etc/sv/myapp/log/run
chown -R www-data:www-data /var/log/myapp
cat > /etc/sv/myapp/run << __END__
exec chpst -u www-data:www-data paster serve production.ini
chmod +x /etc/sv/myapp/run
ln -s /etc/sv/myapp /etc/service/
Setup /var for the app:
chown -R www-data:www-data /var/run/myapp
Edited various directory settings in production.ini.