Add a systemd startup unit

This commit is contained in:
jvoisin 2020-03-21 12:57:15 +01:00 committed by Deluan Quintão
parent 0d8a2b310f
commit ad63b8b1b4
2 changed files with 44 additions and 0 deletions

View file

@ -135,6 +135,12 @@ user.
For more options, run `navidrome --help`
### Running as a service
Check the [contrib](https://github.com/deluan/navidrome/tree/master/contrib)
folder for startup files for your init system.
## Screenshots
<p align="center">

38
contrib/navidrome.service Normal file
View file

@ -0,0 +1,38 @@
# This file ususaly goes in /etc/systemd/system
[Unit]
Description=Navidrome Daemon
After=network.target
[Service]
User=navidrome
Group=navidrome
Type=simple
ExecStart=/opt/navidrome/navidrome
WorkingDirectory=/opt/navidrome
TimeoutStopSec=20
KillMode=process
Restart=on-failure
# See https://www.freedesktop.org/software/systemd/man/systemd.exec.html
DevicePolicy=closed
NoNewPrivileges=yes
PrivateTmp=yes
PrivateUsers=yes
ProtectControlGroups=yes
ProtectKernelModules=yes
ProtectKernelTunables=yes
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
RestrictNamespaces=yes
RestrictRealtime=yes
SystemCallFilter=~@clock @debug @module @mount @obsolete @privileged @reboot @setuid @swap
ReadWritePaths=/opt/navidrome/
PrivateDevices=yes
ProtectSystem=full
ProtectHome=true
MemoryDenyWriteExecute=yes
[Install]
WantedBy=multi-user.target