I'm trying to run a gunicorn_django process in supervisor but it always exits immediately, giving this error:
INFO exited: my_app (exit status 1; not expected)
INFO received SIGCLD indicating a child quit
INFO gave up: my_app entered FATAL state, too many start retries too quickly
My server script looks like this:
#!/bin/bash
set -e
LOGFILE=/var/log/gunicorn/my_app.log
LOGDIR=$(dirname $LOGFILE)
NUM_WORKERS=3
USER=my-www-user
GROUP=my-www-user
cd /home/my-www-user/my_app
source /home/my-www-user/.virtualenvs/my_app/bin/activate
test -d $LOGDIR || mkdir -p $LOGDIR
gunicorn_django -w $NUM_WORKERS --debug \
--user=$USER --group=$GROUP \
--log-level=debug --log-file=$LOGFILE 2>>$LOGFILE\
--pythonpath=my_app --settings=settings.active \
my_app.wsgi:application
And my supervisor config looks like this:
[program:my_app]
directory=/home/my-www-user/my_app/
user=my-www-user
command=/home/my-www-user/my_app/server.sh
stdout_logfile=/var/log/supervisor/my_app.log
stderr_logfile=/var/log/supervisor/my_app-error.log
autostart=true
autorestart=true
When I su
into the my-www-user
account the server starts normally.
When I do sudo supervisorctl start my_app
it simply hangs until I do CTRL-c, then I find the error above in the supervisord.log file.
Does anyone have a clue about what I am missing?