pkg/alertmanager: Configure state directory
All checks were successful
dustin/metricspi/pipeline/head This commit looks good

AlertManager is a stateful service, and as such needs a writable
location for its data.  Using the `StateDirectory` service unit
directive, we can configure systemd to create this directory
automatically, if it does not already exist when the service starts.

In order for the service to be able to write to the state directory, it
must have a stable UID.  This means it cannot use the `DynamicUser`
service unit directive.
This commit is contained in:
2022-08-10 18:19:24 -05:00
parent 276bcce2a4
commit e3a349e3a1

View File

@@ -15,11 +15,13 @@ ExecStart=/usr/sbin/alertmanager \
--web.listen-address=${WEB_LISTEN_ADDRESS}
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
User=alertmanager
StateDirectory=alertmanager
WorkingDirectory=/var/lib/alertmanager
CapabilityBoundingSet=
DeviceAllow=
DevicePolicy=closed
DynamicUser=yes
LockPersonality=yes
MemoryDenyWriteExecute=yes
NoNewPrivileges=yes