From a8bc08de43033acead223ba7e6149bd715fac376 Mon Sep 17 00:00:00 2001 From: Hermenix Date: Mon, 9 Nov 2026 15:04:30 +0000 Subject: [PATCH] container-services: queue the env-reload restart instead of blocking on it The env-reload unit is a oneshot whose ExecStart was a blocking systemctl restart of the group unit. When the stack's cold start failed transiently (container-services-buzz on minipc1, where buzz-relay-1 came up unhealthy and compose exited 1), the group unit recovered on its own a few seconds later through its own Restart=on-failure, but the reload unit had already exited 1 with no restart policy and stayed failed until the next env file write. The trigger unit should queue the restart, not own the health of the whole stack: pass --no-block. Real failures still surface on the group unit, which carries Restart=on-failure and the start limit and is what the fleet scan reports. --- modules/nixos/common/containers/container-services/ABOUTME.md | 4 +++- .../nixos/common/containers/container-services/systemd.nix | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/nixos/common/containers/container-services/ABOUTME.md b/modules/nixos/common/containers/container-services/ABOUTME.md index 6bab152..4a473d5 100644 --- a/modules/nixos/common/containers/container-services/ABOUTME.md +++ b/modules/nixos/common/containers/container-services/ABOUTME.md @@ -52,5 +52,7 @@ If adding a new per-service option: - The group's unit sets `restartTriggers` to the files-write script, so editing any `files` entry restarts the stack on the next switch (services that read files at startup, like Gitea templates, otherwise keep serving the old content) -- Env file changes trigger a path unit that restarts the stack (`container-services--env-reload.*`) +- Env file changes trigger a path unit that restarts the stack (`container-services--env-reload.*`); + the restart is queued with `systemctl restart --no-block`, so the reload unit does not wait for or + inherit the health of the stack it restarted - Compose files are rendered to the store and staged to `/var/lib/container-services//compose.yml` diff --git a/modules/nixos/common/containers/container-services/systemd.nix b/modules/nixos/common/containers/container-services/systemd.nix index 456d52c..6f7cb32 100644 --- a/modules/nixos/common/containers/container-services/systemd.nix +++ b/modules/nixos/common/containers/container-services/systemd.nix @@ -108,7 +108,7 @@ description = "Restart container service group '${groupName}' on env file changes"; serviceConfig = { Type = "oneshot"; - ExecStart = "${pkgs.systemd}/bin/systemctl restart container-services-${groupName}.service"; + ExecStart = "${pkgs.systemd}/bin/systemctl restart --no-block container-services-${groupName}.service"; }; }; };