I am following this How To Set Up Django with Postgres, Nginx, and Gunicorn on Ubuntu 18.04 guide.
I have created the following file .socket
sudo nano /etc/systemd/system/gunicorn.socket
[Unit]
Description=gunicorn socket
[Socket]
ListenStream=/run/gunicorn.sock
[Install]
WantedBy=sockets.target
I have created the following file .service. How I have formatted my own version
sudo nano /etc/systemd/system/gunicorn.service
[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target
[Service]
User=guilhermenog
Group=www-data
WorkingDirectory=/home/guilhermenog/projetoagenda
ExecStart=/home/guilhermenog/projetoagenda/venv/bin/gunicorn \
--access-logfile - \
--workers 3 \
--bind unix:/run/gunicorn.sock \
agenda.wsgi:application
[Install]
WantedBy=multi-user.target
Than I have tried to execute the following code
sudo systemctl start gunicorn.socket
And i have recibed this message error
Job for gunicorn.socket failed
See "systemctl status gunicorn.socket" and "journalctl -xe" for details.
After i tried the recommended code
● gunicorn.socket - gunicorn socket
Loaded: loaded (/etc/systemd/system/gunicorn.socket; enabled; vendor preset: enabled)
Active: inactive (dead)
Listen: /run/gunicorn.sock (Stream)
Apr 26 18:41:45 projetoagenda systemd[1]: gunicorn.socket: Socket service gunicorn.service not
loaded, refusing.
Apr 26 18:41:45 projetoagenda systemd[1]: Failed to listen on gunicorn socket.
Apr 26 18:48:41 projetoagenda systemd[1]: gunicorn.socket: Socket service gunicorn.service not
loaded, refusing.
Apr 26 18:48:41 projetoagenda systemd[1]: Failed to listen on gunicorn socket.
Apr 26 18:52:53 projetoagenda systemd[1]: gunicorn.socket: Socket service gunicorn.service not
loaded, refusing.
Apr 26 18:52:53 projetoagenda systemd[1]: Failed to listen on gunicorn socket.
Apr 26 18:53:27 projetoagenda systemd[1]: gunicorn.socket: Socket service gunicorn.service not
loaded, refusing.
Apr 26 18:53:27 projetoagenda systemd[1]: Failed to listen on gunicorn socket.
Apr 26 19:02:09 projetoagenda systemd[1]: gunicorn.socket: Socket service gunicorn.service not
loaded, refusing.
Apr 26 19:02:09 projetoagenda systemd[1]: Failed to listen on gunicorn socket.
i have followed this sugetions but nothing happen Failed to start gunicorn.service: Unit gunicorn.service not found. Ubunto 18.04
sorry for this question, it´s my firts time asking help in english.