用flask mongodb开发了内部工具,部署在了ucloud centos上
已经稳定的跑了半个月了
现在记录一下部署的过程
使用gunicorn怪兽作为wsgi 指定gevent 协程作为其worker-class
使用supervisor来管理和自动重启,使用nginx来反向代理
#supervisor
###supervisor #web ui [inet_http_server] ; inet (TCP) server disabled by default port=*:9002 ; (ip_address:port specifier, *:port for all iface) username=root007 ; (default is no username (open server)) password[email protected] ; (default is no password (open server)) #co.xxxx.com [program:co] command = gunicorn --worker-class=gevent -w5 -b0.0.0.0:3000 run:app directory=/home/www/co.xxxx.com/ autostart=true user=www redirect_stderr=true stdout_logfile=/home/www/datas/supervisorlog/co.log stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) stdout_logfile_backups=10 ; # of stdout logfile backups (default 10)
#nginx
#/usr/local/nginx/conf/vhost server { listen 80; server_name co.xxxx.com; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header Cookie $http_cookie; proxy_pass http://127.0.0.1:3000; proxy_set_header Host $http_host; } location ^~ /static/ { root /home/www/co.xxxx.com/; expires 30d; } }
#启动过程
#supervisorsupervisord #supervosirctl #supervisor> status co
#nginx /usr/local/nginx/sbin/nginx -s reload
;)
时间: 2024-09-30 21:47:28