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