fix(observability): give loki an exec-form healthcheck in its image
The loki unit came up 'unhealthy' after the quadlet cutover. Cause: a unit's HealthCmd reaches podman as CMD-SHELL, i.e. /bin/sh -c, and the loki image is distroless — no shell exists in it. The busybox command itself works (probed by hand: /ready answers 'ready'); it was the shell wrapper that could not run. podman does not accept an exec-form command through --health-cmd either: it stores a JSON array as one literal argument. The command therefore moves into dankclaw/loki/Containerfile as a HEALTHCHECK ... CMD [...] exec form, which is what that image exists for — it already ships the static busybox solely so a healthcheck has something to run. podman reads the image's healthcheck when the unit declares none.
This commit is contained in:
1 parent
fe4eeaa03a
commit
b96359e628
5 files changed
+53
-22
No files matched your search
@@ -43,11 +43,11 @@ Exec=-config.file=/etc/loki/loki-config.yaml
|
||||
PublishPort=127.0.0.1:3100:3100
|
||||
Volume=/opt/loki/config:/etc/loki
|
||||
Volume=/opt/loki/data:/loki
|
||||
HealthCmd=/usr/local/bin/busybox wget --spider -q http://localhost:3100/ready
|
||||
HealthInterval=30s
|
||||
HealthTimeout=10s
|
||||
HealthRetries=3
|
||||
HealthStartPeriod=30s
|
||||
# No HealthCmd here on purpose. A unit's HealthCmd reaches podman as
|
||||
# CMD-SHELL, which means `/bin/sh -c <command>` — and this image is
|
||||
# distroless, with no shell at all. The healthcheck therefore ships in the
|
||||
# image (dankclaw/loki/Containerfile) in exec form, where it also carries its
|
||||
# interval, timeout, start period and retry count.
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
|
||||
Reference in new issue
Block a user