Repository navigation
Description
What happens
After a restore (backup.sh restore, ADR 0026), the control plane is back at the time of the backup, but the servers still run what was deployed after it. For an application deployed in between:
- Its next deployment fails at
createContainer, which is compensated. The deployment saysStep create compensated: action failed. The timeline's action hasreason: null, and the agent logs nothing. - A second attempt succeeds. The container of the lost deployment keeps running, unknown to the control plane, and nothing removes it.
Reproduction
Found while verifying the published v0.1.0-alpha.5 for #480. Reproduced twice in test containers (Ubuntu 24.04 with systemd):
- single machine on alpha.5, with an alpha.5 agent;
- alpha.3 upgraded to alpha.5, with a separate server on an alpha.3 agent.
- Deploy an application. Its release is
n, its containersk-<app>-r<n>-0. sudo ./backup.sh create b.age.- Deploy it again: release
n+1, containersk-<app>-r<n+1>-0, still running. printf 'replace\n' | sudo ./backup.sh restore b.age identity.txt, then sign in again.- Deploy again. The restored database gives this release the number
n+1again, and the container name already exists with another specification. The agent refuses witherrSpecConflict("container exists with a different specification",agent/internal/actions/container.go), and the step is compensated. - Deploy once more: release
n+2succeeds.sk-<app>-r<n+1>-0is still up, and still uses its share of the server.
What the database showed in the alpha.3 lab: before the restore it had releases 1 and 2, after it release 1 only, and the next release was numbered 2 again.
Why it matters
This is the case a restore is for: nightly backups, deployments during the day, the machine is lost, and its backup is restored on a new one. Every application deployed since that backup fails its next deployment without a reason, and leaves a container nobody tracks.
Possible directions
- Show the agent's cause. The agent knows it; the control plane shows
action failedwith no reason. This is worth doing whatever else is chosen. - Keep names apart: derive container names from the release id rather than its number, so a restored database never reuses a live name. That avoids the failure, but not the untracked container.
- Reconcile after a restore: agents already report their containers. Containers of a known application that belong to no known release could be reported, then removed or adopted. Release numbering could also resume after the highest number a server reports.
The last one is a design change (what the control plane trusts after a restore). It probably needs an ADR, or an addition to ADR 0026.
Until then
INSTALL.md (Back up and restore) will say that a deployment made after the backup leaves its container running, and that the next deployment of that application fails once.
Activity
docs: the alpha.5 rescan and what installing and upgrading to it show…
fix: a create refused for a taken container name says so (part of #501)…
feat(api): a server's untracked containers are listed and removed on …