Fixed supervisor-gunicorn configuration
This commit is contained in:
parent
3bac8469c0
commit
b79b67ac09
|
@ -1,8 +1,8 @@
|
||||||
[program:gunicorn]
|
[program:gunicorn]
|
||||||
command = /home/app/server.sh
|
command = /home/app/server.sh
|
||||||
directory = /home/app
|
directory = /home/app
|
||||||
|
numprocs = 1
|
||||||
user = app
|
user = app
|
||||||
stopsignal = QUIT
|
|
||||||
autostart = true
|
autostart = true
|
||||||
autorestart = true
|
autorestart = true
|
||||||
stdout_logfile = /var/log/supervisor/gunicorn.log
|
stdout_logfile = /var/log/supervisor/gunicorn.log
|
||||||
|
|
|
@ -414,11 +414,11 @@ check_status(status)
|
||||||
|
|
||||||
# ================ SERVER =======================
|
# ================ SERVER =======================
|
||||||
title('Server')
|
title('Server')
|
||||||
sub('Killing all gunicorn_django instances')
|
#sub('Killing all gunicorn_django instances')
|
||||||
status = call(['killall', 'gunicorn_django'],
|
#status = call(['killall', 'gunicorn_django'],
|
||||||
stdout=open(os.devnull, 'wb'),
|
# stdout=open(os.devnull, 'wb'),
|
||||||
stderr=open(os.devnull, 'wb'))
|
# stderr=open(os.devnull, 'wb'))
|
||||||
check_status(status)
|
#check_status(status)
|
||||||
|
|
||||||
sub('Restarting with supervisor')
|
sub('Restarting with supervisor')
|
||||||
status = call(['sudo', 'supervisorctl', 'restart', 'gunicorn'],
|
status = call(['sudo', 'supervisorctl', 'restart', 'gunicorn'],
|
||||||
|
|
|
@ -1,12 +1,17 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
# CONFIG
|
LOGFILE=/home/app/logs/gunicorn.log
|
||||||
WORKERS=2
|
LOGDIR=$(dirname $LOGFILE)
|
||||||
SETTINGS="herobrine.local_settings"
|
NUM_WORKERS=1
|
||||||
|
USER=app
|
||||||
|
GROUP=app
|
||||||
|
SETTINGS="herobrine.settings"
|
||||||
|
|
||||||
# Get environment resources
|
cd /home/app
|
||||||
source .bash_profile
|
source .environment
|
||||||
source virtualenv/bin/activate
|
source ./virtualenv/bin/activate
|
||||||
|
test -d $LOGDIR || mkdir -p $LOGDIR
|
||||||
# Start
|
exec gunicorn_django app --settings=$SETTINGS -w $NUM_WORKERS \
|
||||||
gunicorn_django app --settings=$SETTINGS -w $WORKERS
|
--user=$USER --group=$GROUP --log-level=debug \
|
||||||
|
--log-file=$LOGFILE 2>>$LOGFILE
|
||||||
|
|
Loading…
Reference in New Issue