markdown
Production-ready backup template for Debian 12 + Docker:
- 🔐 Kopia repository (encrypted, deduplicated) with Web UI
- 🗄️ Database dumps (MariaDB/PostgreSQL) before each snapshot
- 🕒 systemd timers for scheduled backups & monthly restore drills
- 🚨 Healthchecks pings + optional Apprise (email/Telegram/push)
- 💿 ReaR (Relax‑and‑Recover) for bare‑metal host recovery
Turn this into your public boilerplate and re-use it across servers.
- Debian 12 host (root/systemd)
- Docker Engine + Docker Compose v2
-
Clone and prepare secrets:
git clone https://github.com/elightsys/debian-kopia-backup-stack.git cd debian-kopia-backup-stack cp -r secrets.example secrets # Edit secrets/kopia_repo_password.txt and secrets/kopia_ui_password.txt
-
Configure environment:
cp .env.example .env # Edit .env: set TZ (e.g., Europe/Budapest) and KOPIA_USERNAME -
Start services (Kopia, Apprise, Healthchecks):
make up
-
Trigger your first backup:
make backup
-
Open the Kopia Web UI at
http://<server>:51515
→ login with yourKOPIA_USERNAMEand the password fromsecrets/kopia_ui_password.txt.
./data/docker/→ put your Docker configs/volumes you want to include./data/etc/→ copy/rsync system config you want to preserve./data/var_lib/./data/home/./data/db_dumps/→ the DB dumps generated right before snapshots
In production, point these to your real paths (e.g.
/mnt/raid/...).
- keep latest 5
- 7 daily, 4 weekly, 12 monthly, 2 annual
- List snapshots:
docker exec kopia sh -lc 'kopia snapshots list'
- Restore the latest docker set into a temp folder inside the container:
docker exec kopia sh -lc 'kopia restore latest:/source/docker --target /tmp/restore_docker' docker cp kopia:/tmp/restore_docker ./_restores/manual-$(date +%F-%H%M)
- Healthchecks: set
HC_URLenv var forscripts/backup.shto ping on success/failure - Apprise: set
APPRISE_URLto send email/Telegram/push, e.g.http://apprise:8008/notify?tag=email,telegram
See docs/RECOVERY-ReaR.md for installing ReaR on the host and scheduling weekly ISO + NETFS backups.
- Kopia repo is password-protected (don’t lose it)
- This template includes
.gitignorerules to keep secrets out of Git - Follow the 3‑2‑1 backup rule: 3 copies, 2 media, 1 offsite
Copyright © 2025 Zoltan Vlasits. Licensed under MIT.
