Skip to content

Add backup-tool: dockerized incremental backup with monitoring and Telegram alerts#7

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/create-backup-tool
Draft

Add backup-tool: dockerized incremental backup with monitoring and Telegram alerts#7
Copilot wants to merge 3 commits into
mainfrom
copilot/create-backup-tool

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 8, 2026

Homelab backup tool — dockerized, runs on swarm manager as a normal compose stack. Supports SSH hosts (rsync) and Docker container volumes (docker cp), with interactive config, retention policies, drive replication, and Telegram alerting.

Package structure (packages/backup-tool/)

  • backup-tool — main entry point: continuous backup loop with background monitor, or single-shot modes (once, monitor, retention, replicate)
  • setup — interactive wizard: select SSH hosts or Docker nodes, pick paths/volumes, choose drives for replication, configure Telegram bot
  • Dockerfile / docker-compose.yml — privileged container, host network, mounts docker socket + SSH keys + backup destination

Library modules (lib/)

  • backup.shrsync -a --delete --link-dest for incremental SSH backups; temp container + docker cp for volume backups
  • retention.sh — per-host/path time-based (retention_days) and size-based (retention_max_size) cleanup, always keeps at least one snapshot
  • replication.sh — copies latest important snapshots to all configured drives, compresses replicas via tar -czf (main copy stays uncompressed for rsync)
  • monitor.sh — background loop: SSH host reachability every 30s, disk space every 60s, independent of backup schedule
  • telegram.sh — stateful alerts with exponential back-off (2min → 4min → … → 8h cap), auto-resolves with recovery message
  • common.sh — INI config read/write (cfg_get/cfg_set), logging, path helpers

Config layout

config/
  backup.conf          # backup_dest, interval, important_drives/folders, telegram creds
  hosts.d/
    myhost.conf        # type=ssh|docker, address, paths, retention_days, retention_max_size

Backup directory structure

/backup/myhost/var_data/
  20250101-120000/     # full snapshot
  20250102-120000/     # incremental (hardlinked via --link-dest)
  latest -> 20250102-120000

/mnt/usb1/backup-replicas/
  myhost_var_data.tar.gz   # compressed replica

Usage

docker compose run --rm backup setup   # interactive config
docker compose up -d                    # start service

README includes full Telegram bot setup instructions (BotFather → token → chat ID → test message).

Copilot AI and others added 2 commits April 8, 2026 01:55
Copilot AI changed the title [WIP] Add backup tool with Docker and interactive config manager Add backup-tool: dockerized incremental backup with monitoring and Telegram alerts Apr 8, 2026
Copilot AI requested a review from punppis April 8, 2026 01:58
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