Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Gunicorn Systemd documentation From the following link:
- http://docs.gunicorn.org/en/stable/deploy.html
- /etc/systemd/system/gunicorn.service:
- [Unit]
- Description=gunicorn daemon
- Requires=gunicorn.socket
- After=network.target
- [Service]
- PIDFile=/run/gunicorn/pid
- User=someuser
- Group=someuser
- RuntimeDirectory=gunicorn
- WorkingDirectory=/home/someuser/applicationroot
- ExecStart=/usr/bin/gunicorn --pid /run/gunicorn/pid \
- --bind unix:/run/gunicorn/socket applicationname.wsgi
- ExecReload=/bin/kill -s HUP $MAINPID
- ExecStop=/bin/kill -s TERM $MAINPID
- PrivateTmp=true
- [Install]
- WantedBy=multi-user.target
- /etc/systemd/system/gunicorn.socket:
- [Unit]
- Description=gunicorn socket
- [Socket]
- ListenStream=/run/gunicorn/socket
- [Install]
- WantedBy=sockets.target
- /etc/tmpfiles.d/gunicorn.conf:
- d /run/gunicorn 0755 someuser somegroup -
- Next enable the socket so it autostarts at boot:
- systemctl enable gunicorn.socket
- Either reboot, or start the services manually:
- systemctl start gunicorn.socket
- After running curl --unix-socket /run/gunicorn/socket http, Gunicorn should start and you should see some HTML from your server in the terminal.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement