# Quadlet unit: alloy (rootless, boot-persistent). # # Install path on dankclaw: ~/.config/containers/systemd/alloy.container # Unit name: alloy.service (container name: alloy) # # Log shipper. This replaces the compose service of the same name in # dankclaw/compose.yaml ("Observability" block). # # IMAGE. franksdank/alloy is built locally by deploy-remote.sh # (build_compose_image) from dankclaw/alloy/Containerfile: upstream # grafana/alloy plus a static busybox for the healthcheck. Pull=never keeps a # boot from reaching for that local tag at a registry. # # NETWORK. It joins dankclaw_default so its config's loki.write endpoint # resolves the container name loki:3100. # # THE UI PORT EXISTS ON PURPOSE. Alloy's UI listens on the container's own # 127.0.0.1 by default and cannot be moved from the config file (alloy 1.x # refuses the ui block), so the compose service had no reachable health # endpoint at all: the homepage status card for alloy reported "down" # continuously and there was nothing for a deploy to wait on. The command # below therefore moves the UI to the container's wildcard address and the # port is published on host loopback only, which puts alloy in the same class # as the other three: reachable from the host, by Caddy over the private # network, and by nothing off-host. Alloy has no authentication, which is # exactly why it is not published wider. # # SOURCES. The host journald socket and the host log/container-storage trees # are bind-mounted read-only; Alloy tails them and pushes to Loki. The config # lives at /opt/alloy/config/config.alloy, installed from # shared/alloy/config.alloy on every deploy. # # ORDERING. Wants/After loki.service: without a reachable Loki, Alloy's write # client fails and its log pipeline backs up. [Unit] Description=Alloy log shipper (Dankclaw) After=network-online.target loki.service Wants=network-online.target loki.service [Container] ContainerName=alloy Image=localhost/franksdank/alloy:latest Pull=never Network=dankclaw_default Exec=run --server.http.listen-addr=0.0.0.0:12345 /etc/alloy/config.alloy PublishPort=127.0.0.1:12345:12345 Volume=/opt/alloy/config:/etc/alloy Volume=/run/systemd/journal/socket:/run/systemd/journal/socket:ro Volume=/var/log:/var/log:ro Volume=/var/lib/containers:/var/lib/containers:ro HealthCmd=/usr/local/bin/busybox wget --spider -q http://localhost:12345/-/healthy HealthInterval=30s HealthTimeout=10s HealthRetries=3 HealthStartPeriod=30s [Service] Restart=always RestartSec=10 [Install] WantedBy=default.target