为什么没有在 /run 目录中创建 gunicorn.socket 文件?

为什么没有在 /run 目录中创建 gunicorn.socket 文件?

全面披露 我最初在运行目录中有一个 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 Ocean 寻求帮助以及在谷歌上搜索类似的答案,但到目前为止都没有任何效果。

相关内容