source /home/projectuser/project_ve/bin/activate
and then calls start-myproject.py
This seems to work fine, I can cd to /etc, and then call the script
directly as root:
/home/projectuser/project_ve/project/start_project
And the app starts up fine.
But when I add the same command to my supervisord.conf file, it won't
stay running and just exits. In both cases I am running as root. Anyone
know what I might have missed that would make the start up script exit
early?
Thanks
Iain
Most probably the supervisord cleans the environment bevore inoking the
script.
Instead of sourcing, you should be able to simply use the VE python
interpreter directly. I had no troubles doing that.
Diez
This had me puzzled a while ago too. At some point (don't know which
version exactly), supervisor started to clear the ebvironment for the
processes it starts. So you have to set the USER, LOGNAME and HOME
environment variables explicitely for the user under which your TG app
runs. Here's a snippet from one of my supervisor configurations:
[program:pybook_trac]
command=/home/pybook/bin/start-trac /home/pybook/trac/pybook
autostart=true
autorestart=true
user=pybook
startsecs=5
startretries=3
stopsignal=TERM
stopwaitsecs=10
log_stdout=true
log_stderr=true
logfile=/home/pybook/var/log/trac-supervisor.log
logfile_maxbytes=10MB
logfile_backups=10
environment=HOME=/home/pybook,USER=pybook,LOGNAME=pybook
HTH, Chris
Thanks Chris, I'll try that out. Is the above for a setup running out of
a virtual env?
Iain
Yes, the start script sources the "activate" script or runs the webapp
through the interpreter in $VIRTUAL_ENV/bin/python.
Chris
I'd replace the last line with:
exec "$@"
This will handle arguments with spaces in them correctly.
Chris