配置了一个机器学习模型的服务,用的nginx+gunicorn + python + supervisord
里面关键的配置:
supervisor.conf
==============
[unix_http_server] file=/tmp/supervisor.sock ; (the path to the socket file)
[inet_http_server] ; inet (TCP) server disabled by default port=127.0.0.1:9001 ; (ip_address:port specifier, *:port for all iface)
[supervisord] logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)
[program:bestcoupon] command=/path/bin/gunicorn -w11 -b0.0.0.0:8099 bestcoupon:app directory=/path/to/web ;user=nobody startsecs=0 stopwaitsecs=0 autostart=true autorestart=true stdout_logfile=/path/to/web/log/gunicorn.log stderr_logfile=/path/to/web/log/gunicorn.err
start.sh
===========
echo " start service ..."
ps aux | grep gunicorn | awk '{print $2;}' | xargs kill -9
ps aux | grep supervisor | awk '{print $2;}' | xargs kill -9
sleep 1
supervisord -c conf/supervisor.conf
echo "deone"
restart.sh
===========
supervisorctl status
supervisorctl restart bestcoupon