Skip to content

IPAM Backup & Restore

IPAM Backup & Restore

data/ipam.json is the only mutable, loss-able data in the dashboard. Everything else is a read-through view of another service. The file lives in the ipam-data Docker volume on the web VPS, which survives deploys and --force-recreate — but not VPS loss or an accidental docker volume rm.

scripts/ipam-backup.sh pushes a copy off-host to the Gitea generic package registry every day (a per-day version plus a rolling latest), and restores it back on demand.

Install the daily backup (web VPS, 100.101.148.89)

Terminal window
# 1. Install the script
scp scripts/ipam-backup.sh root@100.101.148.89:/usr/local/bin/ipam-backup.sh
ssh root@100.101.148.89 chmod +x /usr/local/bin/ipam-backup.sh
# 2. Store a Gitea token (user: level147, scope: write:package) root-only
install -m 600 /dev/null /root/.config/ipam-backup.env
echo 'GITEA_TOKEN=xxxxxxxx' > /root/.config/ipam-backup.env
# 3. Add to root crontab — daily at 03:17
17 3 * * * . /root/.config/ipam-backup.env && /usr/local/bin/ipam-backup.sh backup >> /var/log/ipam-backup.log 2>&1

Browse stored versions at https://gitea.level147.net/level147/-/packages (package ipam-backup).

Restore

Terminal window
. /root/.config/ipam-backup.env
# Restore the most recent backup
ipam-backup.sh restore
# Or a specific day
ipam-backup.sh restore 2026-06-15

The restore installs the file atomically (copy to a temp path in the volume, then mv over the live file from inside the container). The dashboard re-reads ipam.json on the next request — no restart needed.

Restore drill (do this once, then after any change to the backup path)

An untested backup is a hope, not a backup. Prove the whole loop works:

Terminal window
. /root/.config/ipam-backup.env
# 1. Force a fresh backup
ipam-backup.sh backup
# 2. Simulate data loss — clear the live file inside the volume
docker exec level147-net sh -c ': > /app/data/ipam.json'
# 3. Confirm the dashboard is now broken (GET /tools/ipam returns 500)
# — this proves step 2 actually destroyed the data.
# 4. Restore from the latest backup
ipam-backup.sh restore
# 5. Confirm the dashboard serves the IPAM data again at /tools/ipam

If step 5 shows your records, the backup is real. Record the date you last ran this drill.

v0.1.0 · d0d7a20 · 2026-06-26