Skip to content

🐛 Fixed an update leaving Caddy on its old configuration - #447

Merged
acburdine merged 1 commit into
next-dockerfrom
fix/site-caddy-reload
Nov 2, 2026
Merged

acburdine merged 1 commit into
next-dockerfrom
fix/site-caddy-reload

Conversation

@acburdine

Copy link
Copy Markdown
Member

Compose recreates a container only when its service definition changes. A release that changed only a file Caddy mounts (caddy/Caddyfile, a snippet) was written, up --wait left Caddy running, and the update was recorded as installed while Caddy kept serving its old configuration. #427's shared-Caddy self-update reloads explicitly for this reason; a site with its own Caddy had the same gap.

Change

  • manager/src/update.ts: runUpdate (shared by self-update, update and the supervisor) runs docker compose exec -T caddy caddy reload --config /etc/caddy/Caddyfile after up --wait, before verification, when the site layout is production. If Caddy refuses the config, the update fails after startup, so the existing recovery runs: services are stopped and the files put back, and the operator is told the site needs them. The error wording matches ✨ Added a shared Caddy for several production sites on one server (S13) #427's caddyUp.
  • Rollback: recover() never runs up again. It stops the services (down, or stop under the supervisor), so Caddy reads the restored files the next time it starts. That means the rollback doesn't need a reload of its own. The test checks that Caddy is stopped and the files are back.
  • docs/caddy.md: says that an update reloads Caddy. Caddyfile edits the operator hasn't reloaded yet get loaded by that reload, so a Ghost update can now fail on an invalid edit.

Tests

  • A production site's self-update reloads Caddy once, after up, and records the release.
  • A refused reload fails the update: the files and metadata are back, the launcher is still pinned to the previous image, and the services are stopped.
  • The scripted site in test/site.ts answers caddy reload (site.reloads).

format:check, lint, typecheck and the unit tests (607) pass locally. e2e is left to CI.

Not changed

The released-main migration (legacy.ts apply) also writes Caddy files and runs up. Its compose.yml replaces main's Caddy service definition, so Compose recreates Caddy there. I left it alone.

🤖 Generated with Claude Code

Compose recreates a container only when its service definition
changes. A release that changed only a file Caddy mounts, such as
caddy/Caddyfile or a snippet, was written, `up --wait` left Caddy
running, and the update was recorded as installed while Caddy kept
serving the configuration it had. The shared Caddy's self-update
(S13) reloads Caddy explicitly for the same reason; a site with its
own Caddy has had this gap since before it.

runUpdate, which self-update, `update` and the supervisor share, now
runs `caddy reload` once the services are healthy, on a production
layout. A configuration Caddy refuses fails the update after startup,
so recovery stops the services and puts the files back as for any
failed start. Stopped, Caddy reads the restored files when it starts
again, so the rollback needs no reload of its own.

- manager/src/update.ts: reloadCaddy after up, before verification.
- manager/test/site.ts: the scripted site answers `caddy reload`.
- manager/test/self-update.test.ts: a production site's update
  reloads Caddy after up; a refused reload rolls the files back.
- docs/caddy.md: an update reloads Caddy, loading unreloaded edits.
@coderabbitai

coderabbitai Bot commented Nov 2, 2026

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 4 billable files and costs up to $1.00.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 9 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available. Your 37 included PR review attempts over the past 7 days set your current allowance at 4 reviews per hour.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 886a23ef-8205-4df5-aa67-cbc33e3b5d40
Commits

Reviewing files that changed from the base of the PR and between d0c602e and b8a41c4.

Files selected for processing: 4
  • docs/caddy.md
  • manager/src/update.ts
  • manager/test/self-update.test.ts
  • manager/test/site.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@acburdine
acburdine merged commit f7899f1 into next-docker Nov 2, 2026
17 checks passed
@acburdine
acburdine deleted the fix/site-caddy-reload branch November 2, 2026 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant