A container reflects its config: restart-on for containers (issue 009) #2

Merged
jschoubben merged 1 commits from issue/009-container-restart-on into initialization 2026-09-05 01:07:11 +00:00
Owner

Fixes novox/hq issue 009.

A container reads a mounted file once, at start. Its spec — image, env, ports, volumes, args — does not include a mounted file's content, so a settings change that re-renders the file left the running process holding the old value while every check passed (the file on disk is right, the container is up). Services already have restart-on for exactly this; containers did not.

This gives Container the same restart-on field, and applyContainer recreates the container when one of those resources changed this pass, even when the spec matches. The reason is reported in the outcome ("recreated to pick up ...").

  • internal/declaration/declaration.go — RestartOn on Container.
  • internal/apply/apply.go — applyContainer takes the changed set; recreate when a restart-on resource changed; shared restartedBy helper (service reflected now delegates to it).
  • internal/apply/apply_test.go — recreated-on-change, and restartedBy fires only for changed resources.

Proven end-to-end in the mesh-lab (novox/mesh-catalog + mesh-lab): a running grafana tool runtime picked up a token change on the next push — the container was replaced (new id) and the rendered config carried the new value. The catalogue side (runtimes declaring restart-on: ["runtime-config"]) is on mesh-catalog events/audit-logger-assigned.

https://claude.ai/code/session_01LrgweAeERJYBg88c5cKDzF

Fixes novox/hq issue 009. A container reads a mounted file once, at start. Its spec — image, env, ports, volumes, args — does not include a mounted file's *content*, so a settings change that re-renders the file left the running process holding the old value while every check passed (the file on disk is right, the container is up). Services already have `restart-on` for exactly this; containers did not. This gives `Container` the same `restart-on` field, and `applyContainer` recreates the container when one of those resources changed this pass, even when the spec matches. The reason is reported in the outcome ("recreated to pick up ..."). - `internal/declaration/declaration.go` — `RestartOn` on `Container`. - `internal/apply/apply.go` — `applyContainer` takes the `changed` set; recreate when a restart-on resource changed; shared `restartedBy` helper (service `reflected` now delegates to it). - `internal/apply/apply_test.go` — recreated-on-change, and `restartedBy` fires only for changed resources. Proven end-to-end in the mesh-lab (novox/mesh-catalog + mesh-lab): a running grafana tool runtime picked up a token change on the next push — the container was replaced (new id) and the rendered config carried the new value. The catalogue side (runtimes declaring `restart-on: ["runtime-config"]`) is on mesh-catalog `events/audit-logger-assigned`. https://claude.ai/code/session_01LrgweAeERJYBg88c5cKDzF
jschoubben added 1 commit 2026-09-04 21:40:57 +00:00
A container reads a mounted file once, at start; its spec (image, env, volumes)
does not include a mounted file's content, so a settings change that re-renders the
file left the running process holding the old value while every check passed. Give
Container the restart-on field a Service already has, and recreate the container
when a named resource changed this pass. Unit-tested (recreated on change, left
alone otherwise) and proven in the mesh-lab: a running grafana runtime picked up a
token change on the next push.

Claude-Session: https://claude.ai/code/session_01LrgweAeERJYBg88c5cKDzF
jschoubben merged commit 652984b09d into initialization 2026-09-05 01:07:11 +00:00
jschoubben deleted branch issue/009-container-restart-on 2026-09-05 01:07:11 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: novox/mesh-host#2