# Usage:
# ------
#
# 1. Place this file under /etc/systemd/system/
# 2. Adjust the paths and other settings below if necessary
# 3. Activate using: sudo systemctl enable dokk.service

[Unit]
Description=DOKK wsgi server
After=network.target

[Service]
# Edit environment variables to match your installation
# Environment=VAR1=...
# Environment=VAR2=...

# Edit to match your installation
ExecStart=/srv/dokk/venv/bin/gunicorn --config /srv/dokk/gunicorn.py dokk:application

# Run as user "dokk"
User=dokk
Group=dokk

# If set to on-abort, the service will be restarted only if the service process
# exits due to an uncaught signal not specified as a clean exit status. If set
# to on-watchdog, the service will be restarted only if the watchdog timeout
# for the service expires. If set to always, the service will be restarted
# regardless of whether it exited cleanly or not, got terminated abnormally by
# a signal, or hit a timeout.
Restart=always

# Configures the time to sleep before restarting a service (as configured with
# Restart=). Takes a unit-less value in seconds, or a time span value such as
# "5min 20s". Defaults to 100ms.
RestartSec=1

# Takes a list of exit status definitions that, when returned by the main service
# process, will be considered successful termination, in addition to the normal
# successful exit code 0 and the signals SIGHUP, SIGINT, SIGTERM, and SIGPIPE.
# SuccessExitStatus=

### By default, the service logs to journalctl only.
### If additional logging to a file is required, uncomment the following three lines
# StandardOutput=syslog
# StandardError=syslog
# SyslogIdentifier=dokk

### This logs to syslog. If, e.g., rsyslogd is used, you can provide a file
### /etc/rsyslog.d/dokk.conf, consisting of the following two lines (uncommented)
### if $programname == 'dokk' then /var/log/dokk/stderrout.log
### if $programname == 'dokk' then stop

[Install]
WantedBy=multi-user.target
