我一直试图通过重新加载gunicorn和主管来对我的Flask应用程序进行一些更改。我已经使用了诸如rainbow-saddle之类的脚本和软件包来完成了几个教程。似乎没有什么工作,甚至没有重启整个服务器。
烧瓶应用程序正在虚拟环境中运行,我怀疑这可能是问题所在。
以下是gunicorn和烧瓶app的启动脚本。
#!/bin/bash
NAME="Simon"
FLASKDIR=/var/www/Simon
SOCKFILE=/var/www/Simon/simon.sock
USER=glen
GROUP=glen
NUM_WORKERS=3
FLASK_SETTINGS_MODULE=config.py
FLASK_WSGI_MODULE=Simon_wsgi.wsgi
echo "Starting $NAME as `whoami`"
# Activate the virtual environment
cd $FLASKDIR
source Simon/bin/activate
export FLASK_SETTINGS_MODULE=$FLASK_SETTINGS_MODULE
export PYTHONPATH=$FLASKDIR:$PYTHONPATH
# Create the run directory if it doesn't exist
RUNDIR=$(dirname $SOCKFILE)
test -d $RUNDIR || mkdir -p $RUNDIR
exec gunicorn Simon:simon \
--name $NAME \
--workers $NUM_WORKERS \
--user=$USER --group=$GROUP \
--bind=unix:$SOCKFILE \
--log-level=debug \
--pid=$FLASKDIR/gunicorn.pid
--log-file=$FLASKDIR/logs/gunicorn.log
--chdir=/var/www/Simon
这是主管日志的输出片段。
2017-08-20 19:31:56,789 WARN received SIGHUP indicating restart request
2017-08-20 19:31:56,790 INFO waiting for simon to die
2017-08-20 19:31:56,886 INFO stopped: simon (exit status 0)
2017-08-20 19:31:56,890 INFO supervisord started with pid 1438
2017-08-20 19:31:57,892 INFO spawned: 'simon' with pid 2751
2017-08-20 19:31:59,308 INFO success: simon entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
我已经尝试过将.pid用于主管和gunicorn来kill -HUP
他们。我所做的一切似乎都没有刷新正在使用的代码。
编辑:/etc/supervisor/supervisord.conf中的conf
[supervisord]
logfile=/var/www/Simon/logs/supervisord.log
loglevel=info
[program:simon]
command= bash /var/www/Simon/Simon/bin/gunicorn_start.bash Simon:simon --bind 0.0.0.0
directory=/var/www/Simon
user=glen
autostart=true
autorestart=true
redirect_stderr=true
priority=500
;
[program:simonreload]
autostart=true
autorestart=false
directory=/tmp
command=watchmedo shell-command --patterns="*.py;*.html;*.css;*.js" --recursive -HUP $(cat /var/www/Simon/supervisord.pid)'