Skip to content

Backups: make docker compose exec runs work; name logs by service - #40

Merged
davior merged 2 commits into
mainfrom
claude/wonderful-goldberg-ifbtdt
Oct 22, 2026
Merged

davior merged 2 commits into
mainfrom
claude/wonderful-goldberg-ifbtdt

Conversation

@davior

@davior davior commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

Why

Two failures hit while following the backup guide on the server:

  1. Fatal: Please specify repository location when starting the first backup with docker compose exec -d backup sh -c '/usr/local/bin/backup.sh …', the guide's own instruction. exec starts a fresh process with only the container's configured environment, so the RESTIC_REPOSITORY and RCLONE_CONFIG_NAS_* exports made in entrypoint.sh never reached it. Scheduled runs inherit those exports from crond and were unaffected.
  2. No such container: backup from docker logs -f backup. Compose names the container gam-backup-1; backup is only the service name.

Changes

  • New ops/backup/env.sh, installed as /usr/local/lib/backup-env.sh. It holds the derived exports (the restic repository and the rclone nas remote), and both entrypoint.sh and backup.sh source it. Every way of starting a run now gets the same settings. The SSH config is still written by the entrypoint; it's a file, so exec already saw it.
  • Docs: every docker logs [-f] backup is now docker compose logs [-f] backup, and docker inspect names gam-backup-1. The archive's backend container in Container Manager is gam-archive-backend-1.

Testing

  • Reproduced (1) locally: with an exec-like environment (container env only, via env -i), main's backup.sh hands restic RESTIC_REPOSITORY=UNSET.
  • With this branch under the same environment, restic gets sftp:synology-backup:/GeckoNotes/gam/restic and rclone gets type=sftp host=…. The full run, mirror included, completes against a local remote.
  • sh -n passes on all three scripts.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XWoa1a1upTria7ntq56x3B

`docker logs backup` fails: Compose names the container gam-backup-1.
`docker compose logs backup` takes the service name and works however
Compose names things. Same slip for the archive's backend container.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XWoa1a1upTria7ntq56x3B
…tory

The README's way to start a first backup by hand, `docker compose exec
backup backup.sh`, failed with "Please specify repository location":
exec starts a fresh process with only the container's configured
environment, so the RESTIC_REPOSITORY and RCLONE_CONFIG_NAS_* exports
made in the entrypoint never reached it. Cron runs inherit them and
were unaffected.

Those exports move to env.sh, sourced by the entrypoint and by
backup.sh itself, so every way of starting a run gets them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XWoa1a1upTria7ntq56x3B
@davior davior changed the title Backups docs: name logs by service, not a nonexistent container Backups: make docker compose exec runs work; name logs by service Oct 22, 2026
@davior
davior marked this pull request as ready for review October 22, 2026 03:36
@davior
davior merged commit 8d0348a into main Oct 22, 2026
3 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.

2 participants