Skip to content

docs(dr): make the runbook's rclone step work as written - #36

Merged
thinkbig1979 merged 1 commit into
mainfrom
fix/dr-runbook-rclone-config
Jul 31, 2026
Merged

docs(dr): make the runbook's rclone step work as written#36
thinkbig1979 merged 1 commit into
mainfrom
fix/dr-runbook-rclone-config

Conversation

@thinkbig1979

Copy link
Copy Markdown
Owner

Part of agent-os-36o. Found by re-running the destroy-and-recover drill end to end against the fixed agent-os-qqw code.

The defect

Step 2 of the DR runbook — the one that retrieves the only copy of the restic repository that survived losing the data volume — fails for anyone following it verbatim.

The capstan-tools alias mounts rclone.conf at /home/appuser/.config/rclone/rclone.conf, but --entrypoint sh skips the entrypoint that would drop to appuser. The throwaway container therefore runs as root with HOME=/root, and rclone never opens the file that was just mounted:

$ docker run --rm --entrypoint sh capstan:drill -c 'echo "id=$(id -un) HOME=$HOME"'
id=root HOME=/root

$ capstan-tools 'rclone sync offsite:/offsite/capstan-repo /app/data/restic-repo --stats-one-line'
NOTICE: Config file "/root/.config/rclone/rclone.conf" not found - using defaults
CRITICAL: Failed to create file system for "offsite:/offsite/capstan-repo":
          didn't find section in config file ("offsite")

The runbook already knows the container runs as root — step 4 says so, and that is why it ends in chown appuser:appuser. The alias just never accounted for it.

What makes this worth a fix rather than a footnote: the error names the remote, not the config file. During an outage that sends you checking credentials and connectivity for a remote that is fine.

The fix

-e RCLONE_CONFIG=/home/appuser/.config/rclone/rclone.conf on the alias — correct whichever user ends up running it — with the reason documented inline so it does not get tidied away later.

Also notes that a local-filesystem remote needs its own bind mount on the alias, since the path resolves inside the container.

Verified: the same command, with the variable set, completes and lands restic-repo/ in the data volume. Steps 3, 4 and 5 then run exactly as written, and the drill reaches a working restored instance.

Scope

README only. No code changes.

Step 2 of the disaster-recovery runbook failed for anyone following it
verbatim. The capstan-tools alias mounts rclone.conf at the appuser path, but
--entrypoint sh skips the entrypoint that drops privileges, so the throwaway
container runs as root with HOME=/root and rclone never opened the file:

    NOTICE: Config file "/root/.config/rclone/rclone.conf" not found - using defaults
    CRITICAL: Failed to create file system for "offsite:/offsite/capstan-repo":
              didn't find section in config file ("offsite")

The message points at the remote, not at the config, so it sends you
debugging the wrong thing during an outage — and step 2 is the one that
retrieves the only copy of the repository that survived losing the volume.

Setting RCLONE_CONFIG explicitly fixes it regardless of which user runs, and
the reason is documented next to it so nobody "tidies" the variable away.
Also notes that a local-filesystem remote needs its own bind mount, since the
path is resolved inside the container.

Observed while re-running the destroy-and-recover drill for agent-os-36o.

agent-os-36o
@thinkbig1979
thinkbig1979 merged commit 71bf497 into main Jul 31, 2026
8 checks passed
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