fix(deploy): recreate Caddy for a changed Caddyfile, as a reload can't see it
The deploy reloaded Caddy when deploy/Caddyfile changed, but a reload reads the file the container sees, and that is the old one: Docker mounts a single file by its inode, and git writes a changed file anew. The first deploy of the assistant connector showed it (the container still had the Caddyfile without the connector's routes). A changed Caddyfile now recreates the Caddy container, which mounts the new file; its certificates are kept in their volume, and the instance is away for a few seconds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MMm7usAo6q9ZZRoPkWjoxi Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
695cc0de2f
commit
51023469d3
1 changed files with 6 additions and 3 deletions
|
|
@ -68,10 +68,13 @@ main() {
|
|||
docker compose run --rm --no-deps -e role=maintenance server --apply-migrations
|
||||
docker compose up -d --remove-orphans
|
||||
# Caddy reads its Caddyfile when it starts, and `up` doesn't restart it for a
|
||||
# changed file it mounts: a changed one is reloaded in place, without dropping
|
||||
# connections.
|
||||
# changed file it mounts. Nor would `caddy reload` see the change: Docker
|
||||
# mounts a single file by its inode, and git writes a changed file anew, so
|
||||
# the container keeps the old one (found 2026-10-10). A changed Caddyfile
|
||||
# therefore recreates the container, which mounts the new file; the
|
||||
# certificates are in a volume, and the instance is away for seconds.
|
||||
if ! git diff --quiet "$deployed" "$commit" -- Caddyfile; then
|
||||
docker compose exec -T caddy caddy reload --config /etc/caddy/Caddyfile
|
||||
docker compose up -d --force-recreate --no-deps caddy
|
||||
fi
|
||||
wait_until_answering
|
||||
trap - EXIT
|
||||
|
|
|
|||
Loading…
Reference in a new issue