From 7e28e72c2961e5917312789756832b2e634481a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ullrich=20Sch=C3=A4fer?= Date: Sun, 26 Apr 2026 20:09:43 +0200 Subject: [PATCH] cd-apps: reload Caddy after deploy so Caddyfile changes take effect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cd-apps already scp's `infrastructure/Caddyfile` to the server alongside docker-compose.yml — but the running Caddy container doesn't auto-pick-up config changes. cd-infra is the workflow that calls `caddy reload`, and it only triggers on `infrastructure/` paths. So any Caddyfile edit shipped through cd-apps (e.g. the `lb_try_duration` block in PR #329, deployed as part of an apps push) sits on disk unapplied until the next cd-infra run. This was real today: PR #329 added `lb_try_duration 30s` to silence deploy-time 502s. PR #331 (a vite.config edit, apps path) merged right after and triggered cd-apps, which copied the new Caddyfile but didn't reload Caddy. The very next planner restart in that deploy promptly produced three 502s — the exact thing #329 was supposed to prevent. We applied the reload manually via SSH after the fact. This commit makes that reload happen on every cd-apps deploy. The operation is idempotent (Caddy validates first, swaps live, no downtime) so doing it even when Caddyfile is unchanged costs nothing. `|| true` keeps the deploy from failing if Caddy is unhealthy at deploy time. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/cd-apps.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/cd-apps.yml b/.github/workflows/cd-apps.yml index cc6d706..3fd046c 100644 --- a/.github/workflows/cd-apps.yml +++ b/.github/workflows/cd-apps.yml @@ -111,6 +111,19 @@ jobs: # from the compose file, matching cd-infra's behaviour. docker compose --env-file app.env up -d --remove-orphans journal planner + # Reload Caddy with the Caddyfile we just scp'd. cd-apps + # ships infrastructure/Caddyfile alongside docker-compose.yml + # (see scp step above), but containers don't auto-pick-up + # config changes. cd-infra reloads Caddy as part of its + # deploy; cd-apps did NOT, which meant any Caddyfile change + # touching only `apps/`/`packages/` paths sat on disk + # unapplied until the next cd-infra run. The reload is + # idempotent (Caddy validates first, swaps live, no + # downtime) so doing it on every cd-apps deploy is safe + # even when Caddyfile is unchanged. `|| true` keeps the + # deploy from failing if Caddy itself is unhealthy. + docker compose exec -T caddy caddy reload --config /etc/caddy/Caddyfile || true + # Clean up docker image prune -af docker compose ps