Use daemontools to keep Pylons applications running
WARINING - THIS IS WORK IN PROGRESS - DON'T RELY ON THIS YET.
Daemontools is a little utility to help keeping services running. (It's not related to the Windoze tools that mounts CD ISO images.) Using the following configuration it's easy to keep a Pylons application running with it and restart it if it dies.
On Debian you can install the daemontools software using:
$> aptitude install daemontoolsCreate a user for your service:
$> adduser myappService definitions are stored in /etc/service. Create a directory for your application there (e.g. "/etc/service/myapp/"). Inside the new directory create a file called "run" containing:
#!/bin/sh export PYTHON_EGG_CACHE=/home/myapp/.python-eggs cd /home/myapp exec setuidgid myapp /home/myapp/bin/paster serve /home/myapp/foobar.iniThis "run" script runs the Pylons application in the context of the "myapp" user you created before. The call is just the "paster serve foobar.ini" call you always use to start your Pylons application with the Paster web server. The interesting part is that "paster" is run from "/home/myapp/bin/paster". This helps if you run your application in a "virtualenv" environment. Make it executable:
$> chmod a+rx /etc/service/myapp/runBefore you start your service you should create a log directory and create a "run" file there, too (e.g. /etc/service/myapp/log/run):
#!/bin/sh exec 2>&1 exec setuidgid myapp multilog t /home/myapp/daemontools.logNow try to start your application:
$> supervisorctl restart myapp:paster
The contents of this web site is Copyright © 2000-2011 Christoph Haas - Impressum/Imprints - Donations welcome
Drupal theme by Kiwi Themes.
Recent comments
1 day 2 hours ago
1 day 2 hours ago
2 days 14 hours ago
2 days 23 hours ago
3 days 20 hours ago
4 days 3 hours ago
4 days 9 hours ago
4 days 9 hours ago
4 days 19 hours ago
4 days 20 hours ago