为什么未在/ run目录中创建Gunicorn.socket文件?

时间:2018-07-20 00:56:40

标签: gunicorn digital-ocean systemd

完整披露我本来在run目录中有一个gunicorn.socket文件,但由于我认为它可以解决另一个问题,所以我愚蠢地删除了它。现在我似乎无法找回。我是运气不好还是有希望?

这是我的/etc/systemd/system/gunicorn.service文件:

[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target

[Service]
User=whodini
Group=www-data
WorkingDirectory=/home/whodini/project
ExecStart=/home/whodini/project/env/bin/gunicorn --access-logfile - --workers 3 --bind unix:/run/gunicorn.sock project.wsgi:application

[Install]
WantedBy=multi-user.target

这是我的/etc/systemd/system/gunicorn.socket文件:

[Unit]
Description=gunicorn socket

[Socket]
ListenStream=/run/gunicorn.sock
SocketUser=whodini
SocketGroup=www-data

[Install]
WantedBy=sockets.target

这是以下命令的输出:

root@project-server:/run# sudo systemctl status gunicorn.socket
● gunicorn.socket - gunicorn socket
   Loaded: loaded (/etc/systemd/system/gunicorn.socket; enabled; vendor preset: enabled)
   Active: active (listening) since Wed 2018-07-18 04:59:44 UTC; 1 day 19h ago
   Listen: /run/gunicorn.sock (Stream)

Jul 19 14:49:20 project-server systemd[1]: Listening on gunicorn socket.
Jul 19 15:31:42 project-server systemd[1]: Listening on gunicorn socket.
Jul 19 20:36:25 project-server systemd[1]: Listening on gunicorn socket.
Jul 19 20:41:31 project-server systemd[1]: Listening on gunicorn socket.
Jul 19 20:42:59 project-server systemd[1]: Listening on gunicorn socket.
Jul 20 00:28:12 project-server systemd[1]: Listening on gunicorn socket.
Jul 20 00:28:52 project-server systemd[1]: Listening on gunicorn socket.
Jul 20 00:34:50 project-server systemd[1]: Listening on gunicorn socket.
Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.

和随后的文件查找:

root@project-server:/run# file /run/gunicorn.sock
/run/gunicorn.sock: cannot open `/run/gunicorn.sock' (No such file or directory)

在有帮助的情况下存在此问题:

-- Logs begin at Thu 2018-07-19 08:32:24 UTC, end at Fri 2018-07-20 00:46:49 UTC. --
Jul 19 15:22:35 project-server systemd[1]: Stopped gunicorn daemon.
Jul 19 15:22:35 project-server systemd[1]: Started gunicorn daemon.
Jul 19 15:22:35 project-server systemd[1]: gunicorn.service: Main process exited, code=exited, status=203/EXEC
Jul 19 15:22:35 project-server systemd[1]: gunicorn.service: Unit entered failed state.
Jul 19 15:22:35 project-server systemd[1]: gunicorn.service: Failed with result 'exit-code'.
Jul 19 20:42:44 project-server systemd[1]: Stopped gunicorn daemon.
Jul 19 20:42:44 project-server systemd[1]: Started gunicorn daemon.
Jul 19 20:42:44 project-server systemd[1]: gunicorn.service: Main process exited, code=exited, status=203/EXEC
Jul 19 20:42:44 project-server systemd[1]: gunicorn.service: Unit entered failed state.
Jul 19 20:42:44 project-server systemd[1]: gunicorn.service: Failed with result 'exit-code'.
Jul 20 00:28:38 project-server systemd[1]: Stopped gunicorn daemon.
Jul 20 00:28:38 project-server systemd[1]: Started gunicorn daemon.
Jul 20 00:28:38 project-server systemd[1]: gunicorn.service: Main process exited, code=exited, status=203/EXEC
Jul 20 00:28:38 project-server systemd[1]: gunicorn.service: Unit entered failed state.
Jul 20 00:28:38 project-server systemd[1]: gunicorn.service: Failed with result 'exit-code'.
Jul 20 00:34:37 project-server systemd[1]: Stopped gunicorn daemon.
Jul 20 00:34:37 project-server systemd[1]: Started gunicorn daemon.
Jul 20 00:34:37 project-server systemd[1]: gunicorn.service: Main process exited, code=exited, status=203/EXEC
Jul 20 00:34:37 project-server systemd[1]: gunicorn.service: Unit entered failed state.
Jul 20 00:34:37 project-server systemd[1]: gunicorn.service: Failed with result 'exit-code'.

在过去的几天里,我一直在尝试解决此问题,包括帮助Digital Digital提供帮助,并在google上搜索类似的答案,但到目前为止没有任何效果。

0 个答案:

没有答案