I host a few Django sites on one of my Ubuntu servers. Up until recently I've been using the Cherokee HTTPd which has the option to launch back-end applications like Django sites but I've just switched out to nginx.
Under cherokee, I just "run" Django sites (sites are stored in
cd /web/mywebsite/; python manage.py runfcgi workdir=/web/mywebsite method=threaded socket=/web/mywebsite/sock pidfile=/web/mywebsite/pid maxspare=3 maxrequests=500
And then I'd connect to the socket at
/web/mywebsite/sock. Cherokee also runs this as a user of my choice, in my case
This approach has worked well for me under Cherokee but now I'm moving to nginx, I don't have something there holding my hand for process management.
Looking around, there are literally hundreds of different ways of managing this. Init scripts, cron checks, daemontools. But as I'm on Ubuntu (and probably always will be) Upstart seems to make sense... But where do I start?
Could somebody give me an example of a upstart script that runs the above and will respawn it if it dies?
I have several django sites sitting in
/web/ (and they're the only directories in that directory) so if there's a cheaty way that I can get this one upstart script to launch them all (with the same settings) and monitor them, that would be super-extra-awesome.