From da5bc17c7fc766383cb2e7d5be3d2efdbc3dd8d8 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Fri, 9 Oct 2026 00:17:14 +0200 Subject: [PATCH] fix(web-app-hermes): take the seed paths from the volume registry The hook declared /opt/seed/config.yaml itself and defaulted the write target to ${HERMES_HOME:-/opt/data}. Both restated meta/volumes.yml, and the second is the shell-side path default that tests/lint/filesystem/shell/test_no_path_defaults.py rejects: a copy that drifts once the mount moves. Neither was visible while the hook was a template. env.j2 now derives HERMES_CONFIG_SEED from the hermes_config mount target and HERMES_CONFIG_TARGET from the hermes_data target, so volumes.yml declares each path once. The service already carries that env file through has_env, and the with-contenv shebang imports it into the cont-init stage, so the hook reads both. The image sets HERMES_HOME=/opt/data, which is the hermes_data target, so the rendered target is what the old default resolved to. The hook reads bare ${VAR} rather than ${VAR:?msg} on purpose: a non-zero cont-init script aborts container start, so an unset path must not take the gateway down. The copy stays guarded and the script still exits 0. Co-Authored-By: Claude Opus 5 (1M context) --- roles/web-app-hermes/files/shell/config-seed.sh | 4 ++-- roles/web-app-hermes/templates/env.j2 | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/roles/web-app-hermes/files/shell/config-seed.sh b/roles/web-app-hermes/files/shell/config-seed.sh index 579232c92d..70259d2017 100644 --- a/roles/web-app-hermes/files/shell/config-seed.sh +++ b/roles/web-app-hermes/files/shell/config-seed.sh @@ -3,8 +3,8 @@ # nocheck: mirrored-unit-test - runs inside the image's s6 cont-init.d stage, before # 01-hermes-setup; there is no host-side interpreter to exercise it against -seed="/opt/seed/config.yaml" -target="${HERMES_HOME:-/opt/data}/config.yaml" +seed="${HERMES_CONFIG_SEED}" +target="${HERMES_CONFIG_TARGET}" [ -f "$seed" ] || exit 0 diff --git a/roles/web-app-hermes/templates/env.j2 b/roles/web-app-hermes/templates/env.j2 index d1fa19269f..ee3a34ee8d 100644 --- a/roles/web-app-hermes/templates/env.j2 +++ b/roles/web-app-hermes/templates/env.j2 @@ -1,6 +1,8 @@ {% include 'roles/sys-svc-container/templates/env.j2' %} HERMES_SKIP_CONFIG_MIGRATION=true +HERMES_CONFIG_SEED={{ lookup('volume', application_id, 'hermes_config').target | dotenv_quote }} +HERMES_CONFIG_TARGET={{ [ lookup('volume', application_id, 'hermes_data').target, 'config.yaml' ] | path_join | dotenv_quote }} API_SERVER_ENABLED=true API_SERVER_HOST=0.0.0.0