0

Full disclosure I originally had a gunicorn.socket file in the run directory, but I stupidly deleted it because I thought it might solve another issue. Now I can't seem to get it back. Am I out of luck or is there hope?

This is my /etc/systemd/system/gunicorn.service file:

[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

This is my /etc/systemd/system/gunicorn.socket file:

[Unit]
Description=gunicorn socket

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

[Install]
WantedBy=sockets.target

This is the output of the following command:

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.

and the subsequent file lookup:

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

and there is this in case it helps:

-- 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'.

I've been trying to troubleshoot this for the past few days including help form Digital Ocean and scouring google for similar answers, but nothing has worked so far.

3
  • Did you restart gunicorn.socket? What happened? Jul 20, 2018 at 19:18
  • Yes, I did. When I restart it I get active: failed Main PID: 29786 (code=exited, status=203/EXEC). But if I go ahead and start and enable gunicorn.socket I get active (listening), but still nothing in the run directory.
    – user479767
    Jul 20, 2018 at 19:30
  • @Whodini You should restart gunicorn.**socket**, not gunicorn.service... If you do that, systemd should recreate the socket file for you...
    – filbranden
    Aug 1, 2018 at 6:57

0

You must log in to answer this question.