Files
blockbook/build/templates/backend/debian/service
2026-01-26 09:01:25 +01:00

52 lines
1.3 KiB
Plaintext

{{define "main" -}}
[Unit]
Description={{.Coin.Name}} backend daemon
After=network.target
[Service]
ExecStart={{template "Backend.ExecCommandTemplate" .}}
User={{.Backend.SystemUser}}
Restart=on-failure
# Allow enough time for graceful shutdown/flush work before SIGKILL.
TimeoutStopSec=300
# Be explicit about the signal used for graceful shutdown.
KillSignal=SIGTERM
WorkingDirectory={{.Env.BackendInstallPath}}/{{.Coin.Alias}}
{{if eq .Backend.ServiceType "forking" -}}
Type=forking
RuntimeDirectory={{.Coin.Alias}}
PIDFile=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid
{{else -}}
Type=simple
{{end}}
{{template "Backend.ServiceAdditionalParamsTemplate" .}}
# Resource limits
LimitNOFILE=2000000
# Hardening measures
####################
# Provide a private /tmp and /var/tmp.
PrivateTmp=true
# Mount /usr, /boot/ and /etc read-only for the process.
ProtectSystem=full
# Disallow the process and all of its children to gain
# new privileges through execve().
NoNewPrivileges=true
# Use a new /dev namespace only populated with API pseudo devices
# such as /dev/null, /dev/zero and /dev/random.
PrivateDevices=true
{{if .Backend.ProtectMemory -}}
# Deny the creation of writable and executable memory mappings.
MemoryDenyWriteExecute=true
{{end}}
[Install]
WantedBy=multi-user.target
{{end}}