NEC-391: install-deployer.sh never applies a changed Caddyfile: mv breaks the single-file bind mount, and reload reads the old file #352

Merged
nectenda-agent merged 5 commits from worktree-nec-391-install-deployersh-never-applies-a-chang into main 2026-11-10 13:18:28 +00:00
Collaborator

Task: NEC-391 — https://projectron.nerchure.com/tasks/413

install-deployer.sh renamed every changed host file into place, so a Caddyfile — bind-mounted into Caddy by name on all three host kinds — reached the running Caddy never: the mount holds the old inode, and the in-container validate and reload ran on the old file and succeeded (accounts went live with feedback.nectenda.com missing from Caddy's copy, 10 Nov). Files a compose file mounts by name are now written in place; every other file, the deployer above all, is still renamed. Before reloading, the installer holds Caddy's own copy to the host's, and fails without reloading when they differ, naming the fix: validate the host's copy through the running Caddy, then restart Caddy under the deploy lock (a restart re-binds the mount and keeps the image; measured). --check makes the same comparison and keeps the stale-image line; it advises nothing for a host it could not read. Ride-along NEC-393: deploy/inventory.mjs --hosts and the console make the same comparison and show their own item. Also: deployer.sh status no longer prints 'No such file' for an env-drift file no deploy has written. No host is changed by merging; the spec's 'After merge' section lists the operator's steps.

Spec: docs/changes/NEC-391-caddyfile-in-place/spec.md

Also fixes NEC-393: inventory.mjs and the console compare only the host's Caddyfile, not the copy the running Caddy reads

Changelog

NONE

Task: NEC-391 — https://projectron.nerchure.com/tasks/413 install-deployer.sh renamed every changed host file into place, so a Caddyfile — bind-mounted into Caddy by name on all three host kinds — reached the running Caddy never: the mount holds the old inode, and the in-container validate and reload ran on the old file and succeeded (accounts went live with feedback.nectenda.com missing from Caddy's copy, 10 Nov). Files a compose file mounts by name are now written in place; every other file, the deployer above all, is still renamed. Before reloading, the installer holds Caddy's own copy to the host's, and fails without reloading when they differ, naming the fix: validate the host's copy through the running Caddy, then restart Caddy under the deploy lock (a restart re-binds the mount and keeps the image; measured). --check makes the same comparison and keeps the stale-image line; it advises nothing for a host it could not read. Ride-along NEC-393: deploy/inventory.mjs --hosts and the console make the same comparison and show their own item. Also: deployer.sh status no longer prints 'No such file' for an env-drift file no deploy has written. No host is changed by merging; the spec's 'After merge' section lists the operator's steps. Spec: `docs/changes/NEC-391-caddyfile-in-place/spec.md` Also fixes NEC-393: inventory.mjs and the console compare only the host's Caddyfile, not the copy the running Caddy reads ## Changelog NONE
Every compose file bind-mounts ./Caddyfile into Caddy by name, and such a mount
holds the inode the file had when the container started. The installer renamed
every changed file into place, so the running Caddy went on reading the old
one: `caddy validate` and `caddy reload` both ran inside the container against
that old file, both succeeded, and the installer printed "caddy reloaded".
That is how accounts went live with feedback.nectenda.com in the host's
Caddyfile and not in Caddy's on 10 November 2026.

A row its compose file mounts by name is now written into the existing file
(read from the repository's compose file, so there is no second list).
Everything else, the deployer above all, is still renamed. Before reloading,
the installer hashes Caddy's own copy and holds it to the host's. A Caddy
still on an older inode fails the install without a reload, naming the
recreate command, which is said and not run. --check makes the same comparison.

fakebin/docker models the mount as a hard link, which holds an inode exactly
as a single-file bind mount does. So the existing reload test now fails when
the rename comes back.

Task: NEC-391

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EV8ztYs9utnJt7nsLdzf8N
In `tr … < "$DRIFT_FILE" 2>/dev/null` the `<` is applied before the silencing,
so every config whose state directory no deploy had checked yet printed bash's
error on `status`. It is now tested for, as drift_note already does.

Task: NEC-391

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EV8ztYs9utnJt7nsLdzf8N
deploy/inventory.mjs --hosts, and the console built on it, hashed only the
host's copy of each file, so they would call a host's Caddyfile current while
a Caddy from before some rename read an older one. That was accounts' state
when it went live with feedback.nectenda.com.

parseMounts reads the by-name mounts from the compose file the table names, by
the installer's rule. hostScript asks the running service for its copy, with
the same seen= lines --check prints. mountDrift holds that copy to the host's
and carries the recreate command. The console shows it as its own item rather
than as config-drift, whose fix, an install, cannot reach it.

Task: NEC-391
Also-fixes: NEC-393

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EV8ztYs9utnJt7nsLdzf8N
- A stale Caddy wants a restart, not a recreate. A restart binds a single-file
  mount again from the path, measured under Compose and with a bare mount
  --bind. It keeps the image, so on the ops box it is not a Caddy upgrade by
  the back door. The named fix validates the host's copy through the running
  Caddy first (--config /dev/stdin, so its environment fills the hostnames),
  because the install that found the problem stopped short of validating.
- --check's NEEDS ATTENTION keeps the "running an image the file does not
  name" line.
- An unreachable host, or a host file that was not read, gets no restart
  advice. A dropped ssh connection is not a Caddy reading the wrong file.
- fakebin/docker answers Caddy only at /etc/caddy/Caddyfile, so the container
  path the awk finds is held by the tests: printing the wrong field fails 27.
- compose ps -q's stderr stays out of the answer. Compose warns there about
  unset .env variables, and a stopped Caddy's warning looked like a container
  id.

Task: NEC-391

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EV8ztYs9utnJt7nsLdzf8N
Name the restart in the inventory and the console, and nothing for an unread host
All checks were successful
Release note / release-note (pull_request) Successful in 17s
CI / build (pull_request) Successful in 4m23s
CI / e2e (pull_request) Successful in 17m15s
CI / promote (pull_request) Has been skipped
852c9f1e6a
The same review findings, on the ride-along's side. restartHint replaces
recreateHint word for word with the installer's restart_hint. mountDrift makes
no finding for a mount whose host copy was not read or is missing, as the
installer now does: that is fileDrift's to report, and not a Caddy to restart.

Task: NEC-391
Also-fixes: NEC-393

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EV8ztYs9utnJt7nsLdzf8N
cruelacid force-pushed worktree-nec-391-install-deployersh-never-applies-a-chang from 852c9f1e6a
All checks were successful
Release note / release-note (pull_request) Successful in 17s
CI / build (pull_request) Successful in 4m23s
CI / e2e (pull_request) Successful in 17m15s
CI / promote (pull_request) Has been skipped
to d395479628
All checks were successful
Release note / release-note (pull_request) Successful in 17s
CI / build (pull_request) Successful in 4m26s
CI / e2e (pull_request) Successful in 17m10s
CI / promote (pull_request) Has been skipped
CI / build (push) Successful in 4m41s
CI / e2e (push) Successful in 17m10s
CI / promote (push) Successful in 44s
2026-11-10 12:47:54 +00:00
Compare
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Nectenda/nectenda!352
No description provided.