closes #875. add full working systemd configuration example

This commit is contained in:
Eduard Iskandarov 2014-09-13 14:15:16 +04:00
parent 8b80fee749
commit 52bade631b

View File

@ -253,34 +253,43 @@ systemd:
[Unit] [Unit]
Description=gunicorn daemon Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target
[Service] [Service]
Type=forking PIDFile=/run/gunicorn/pid
PIDFile=/home/urban/gunicorn/gunicorn.pid
User=someuser User=someuser
WorkingDirectory=/home/urban/gunicorn/bin Group=someuser
ExecStart=/home/someuser/gunicorn/bin/gunicorn -p /home/urban/gunicorn/gunicorn.pid- test:app WorkingDirectory=/home/someuser
ExecStart=/home/someuser/gunicorn/bin/gunicorn --pid /run/gunicorn/pid test:app
ExecReload=/bin/kill -s HUP $MAINPID ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID ExecStop=/bin/kill -s TERM $MAINPID
PrivateTmp=true PrivateTmp=true
[Install]
WantedBy=multi-user.target
**gunicorn.socket**:: **gunicorn.socket**::
[Unit] [Unit]
Description=gunicorn socket Description=gunicorn socket
[Socket] [Socket]
ListenStream=/run/gunicorn.sock ListenStream=/run/gunicorn/socket
ListenStream=0.0.0.0:9000 ListenStream=0.0.0.0:9000
ListenStream=[::]:8000 ListenStream=[::]:8000
[Install] [Install]
WantedBy=sockets.target WantedBy=sockets.target
**tmpfiles.d/gunicorn.conf**::
d /run/gunicorn 0755 someuser someuser -
After running curl http://localhost:9000/ gunicorn should start and you After running curl http://localhost:9000/ gunicorn should start and you
should see something like that in logs:: should see something like that in logs::
2013-02-19 23:48:19 [31436] [DEBUG] Socket activation sockets: unix:/run/gunicorn.sock,http://0.0.0.0:9000,http://[::]:8000 2013-02-19 23:48:19 [31436] [DEBUG] Socket activation sockets: unix:/run/gunicorn/socket,http://0.0.0.0:9000,http://[::]:8000
Logging Logging
======= =======