Add systemd service file, move Gunicorn configuration to gunicorn.cfg
This commit is contained in:
parent
3fdef90cf3
commit
77cba075f4
5
gunicorn.cfg
Normal file
5
gunicorn.cfg
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
import multiprocessing
|
||||||
|
|
||||||
|
name = "PyGPS"
|
||||||
|
bind = "127.0.0.1:6957"
|
||||||
|
workers = multiprocessing.cpu_count() * 4
|
20
pygps.service
Normal file
20
pygps.service
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
[Unit]
|
||||||
|
Description = PyGPS
|
||||||
|
After = network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
PermissionsStartOnly = true
|
||||||
|
PIDFile = /run/pygps/pygps.pid
|
||||||
|
User = gps
|
||||||
|
Group = gps
|
||||||
|
WorkingDirectory = /opt/pygps
|
||||||
|
ExecStartPre = /bin/mkdir /run/pygps
|
||||||
|
ExecStartPre = /bin/chown -R gps:gps /run/pygps
|
||||||
|
ExecStart = /usr/bin/env gunicorn -c gunicorn.cfg --pid /run/pygps/pygps.pid main
|
||||||
|
ExecReload = /bin/kill -s HUP $MAINPID
|
||||||
|
ExecStop = /bin/kill -s TERM $MAINPID
|
||||||
|
ExecStopPost = /bin/rm -rf /run/pygps
|
||||||
|
PrivateTmp = true
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy = multi-user.target
|
Loading…
Reference in a new issue