- Python 100%
The daily backup stops and restarts media containers for a consistent snapshot, which previously tripped the deep media checks and their failure alerting every night. Write a local maintenance marker at the start of the daily run, refresh it as each stack is processed, and remove it when the run finishes. The media checks read the marker's mtime and skip their run while it is fresh, so the planned downtime window no longer generates false alerts. |
||
|---|---|---|
| tests | ||
| .gitignore | ||
| docker-stack-backup.py | ||
| LICENSE | ||
| README.md | ||
docker-stack-backup
Back up Docker Compose definitions and appdata to a remote host with hardlink deduplication between snapshots.
Retention
The retention policy keeps the union of:
- 14 newest daily snapshots
- newest snapshot in each of the latest 8 ISO weeks
- newest snapshot in each of the latest 12 represented calendar months
- 8 newest snapshots in each generated-media series
Manual and emergency namespaces are never considered because retention only accepts timestamp-shaped direct children of configured backup directories. Future backups receive an incomplete marker when they start and an atomic JSON completion marker when they finish. Incomplete snapshots are always retained.
Report all scopes without running a backup:
python3 docker-stack-backup.py \
--retention-only \
--retention-mode report \
--retention-scope all
Run a normal daily backup followed by a retention report:
python3 docker-stack-backup.py --retention-mode report
--retention-mode apply is accepted only following a successful backup in the
same locked process. Standalone apply is deliberately rejected. Apply mode must
not be enabled until a fresh report has been reviewed and deletion approved.
Tests
python3 -m unittest discover -s tests -v