Fixed supervisor-gunicorn configuration

This commit is contained in:
Felipe Martín 2013-05-23 18:55:19 +02:00
parent 3bac8469c0
commit b79b67ac09
3 changed files with 20 additions and 15 deletions

View File

@ -1,8 +1,8 @@
[program:gunicorn]
command = /home/app/server.sh
directory = /home/app
numprocs = 1
user = app
stopsignal = QUIT
autostart = true
autorestart = true
stdout_logfile = /var/log/supervisor/gunicorn.log

View File

@ -414,11 +414,11 @@ check_status(status)
# ================ SERVER =======================
title('Server')
sub('Killing all gunicorn_django instances')
status = call(['killall', 'gunicorn_django'],
stdout=open(os.devnull, 'wb'),
stderr=open(os.devnull, 'wb'))
check_status(status)
#sub('Killing all gunicorn_django instances')
#status = call(['killall', 'gunicorn_django'],
# stdout=open(os.devnull, 'wb'),
# stderr=open(os.devnull, 'wb'))
#check_status(status)
sub('Restarting with supervisor')
status = call(['sudo', 'supervisorctl', 'restart', 'gunicorn'],

View File

@ -1,12 +1,17 @@
#!/bin/bash
set -e
# CONFIG
WORKERS=2
SETTINGS="herobrine.local_settings"
LOGFILE=/home/app/logs/gunicorn.log
LOGDIR=$(dirname $LOGFILE)
NUM_WORKERS=1
USER=app
GROUP=app
SETTINGS="herobrine.settings"
# Get environment resources
source .bash_profile
source virtualenv/bin/activate
# Start
gunicorn_django app --settings=$SETTINGS -w $WORKERS
cd /home/app
source .environment
source ./virtualenv/bin/activate
test -d $LOGDIR || mkdir -p $LOGDIR
exec gunicorn_django app --settings=$SETTINGS -w $NUM_WORKERS \
--user=$USER --group=$GROUP --log-level=debug \
--log-file=$LOGFILE 2>>$LOGFILE