Setting up server environment for twisted application

Hello.
Can you tell me what are the best practices for setting up a twistd daemon in a linux (centos) environment on a server. The server should be always uptime and relaunch on fatal error. I am sure there is a common procedure for this.
Also I'm interested in providing secure access to twisted application services. I set up twisted in a python virtualenv and my application is running under user 'nobody'. What else could be done? What about permissions of the python script files and static server resources?
Also, is it a good idea to listen (HTTP and HTTPS) on ports 8081 and 8083 and set up apache to redirect port 80 and port 443 on a subdomain to the appropriate twistd daemon ports?
Thank you, Viatcheslav Gachkaylo Crystalnix

On Fri, Jul 15, 2011 at 10:49 PM, Viatcheslav Gachkaylo < vgachkaylo@gmail.com> wrote:
Hello.
Can you tell me what are the best practices for setting up a twistd daemon in a linux (centos) environment on a server. The server should be always uptime and relaunch on fatal error. I am sure there is a common procedure for this.
I like using Supervisor (http://supervisord.org/) for this purpose, running with "twistd -n".

On 16 July 2011 04:58, Christopher Armstrong radix@twistedmatrix.com wrote:
On Fri, Jul 15, 2011 at 10:49 PM, Viatcheslav Gachkaylo vgachkaylo@gmail.com wrote:
be always uptime and relaunch on fatal error. I am sure there is a common procedure for this.
I like using Supervisor (http://supervisord.org/) for this purpose, running with "twistd -n".
Also don't forget twisted.runner.procmon and twistd procmon - it hasn't got all the features of supervisord, but it may be enough. eg twistd --logfile=procmon.log --pidfile=procmon.pid procmon \ twistd --logfile=web.log --pidfile=web.pid -n web --path .
{{{ $ twistd procmon --help Usage: twistd [options] procmon [procmon options] commandline Options: -t, --threshold= How long a process has to live before the death is considered instant, in seconds. [default: 1] -k, --killtime= How long a process being killed has to get its affairs in order before it gets killed with an unmaskable signal. [default: 5] -m, --minrestartdelay= The minimum time (in seconds) to wait before attempting to restart a process [default: 1] -M, --maxrestartdelay= The maximum time (in seconds) to wait before attempting to restart a process [default: 3600] --version --help Display this help and exit.
procmon runs processes, monitors their progress, and restarts them when they die.
procmon will not attempt to restart a process that appears to die instantly; with each "instant" death (less than 1 second, by default), it will delay approximately twice as long before restarting it. A successful run will reset the counter. }}}
-RichardW.
participants (3)
-
Christopher Armstrong
-
Richard Wall
-
Viatcheslav Gachkaylo