我尝试用systemd启动Gunicorn服务器。你知道吗
服务定义如下:
[Unit]
Description=Gunicorn instance to serve Flask application using gunicorn
After=network.target
[Service]
PIDFile=/home/username/application/app.pid
User=username
Group=nginx
WorkingDirectory=/home/username/application
Environment=PATH=/opt/venv/bin/
ExecStart=/opt/venv/bin/gunicorn --pid /home/username/application/app.pid --workers 3 --bind unix:socket.sock -m 007 app:app
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID
[Install]
WantedBy=multi-user.target
问题是,有时应用程序在启动时崩溃,journalctl中会显示以下消息
gunicorn[28376]: [2019-08-22 15:01:48 +0300] [28379] [INFO] Worker exiting (pid: 28379)
gunicorn[28376]: [2019-08-22 15:01:48 +0300] [28381] [INFO] Worker exiting (pid: 28381)
gunicorn[28376]: [2019-08-22 15:01:48 +0300] [28376] [INFO] Shutting down: Master
gunicorn[28376]: [2019-08-22 15:01:48 +0300] [28376] [INFO] Reason: Worker failed to boot.
systemd[1]: urzchat-dev.service: main process exited, code=exited, status=3/NOTIMPLEMENTED
systemd[1]: urzchat-dev.service: control process exited, code=exited status=1
systemd[1]: Unit urzchat-dev.service entered failed state.
systemd[1]: urzchat-dev.service failed.
这种行为大约发生在所有启动的1/3。你知道吗
告诉我,为什么会这样,怎么解决?你知道吗
Environment
指令应包含为字符串:此外,您还可以在启动前为网络连接到internet添加一个条件:
相关问题 更多 >
编程相关推荐