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)
# 1. Install the scriptscp scripts/ipam-backup.sh root@100.101.148.89:/usr/local/bin/ipam-backup.shssh root@100.101.148.89 chmod +x /usr/local/bin/ipam-backup.sh
# 2. Store a Gitea token (user: level147, scope: write:package) root-onlyinstall -m 600 /dev/null /root/.config/ipam-backup.envecho 'GITEA_TOKEN=xxxxxxxx' > /root/.config/ipam-backup.env
# 3. Add to root crontab — daily at 03:1717 3 * * * . /root/.config/ipam-backup.env && /usr/local/bin/ipam-backup.sh backup >> /var/log/ipam-backup.log 2>&1Browse stored versions at
https://gitea.level147.net/level147/-/packages (package ipam-backup).
Restore
. /root/.config/ipam-backup.env
# Restore the most recent backupipam-backup.sh restore
# Or a specific dayipam-backup.sh restore 2026-06-15The 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:
. /root/.config/ipam-backup.env
# 1. Force a fresh backupipam-backup.sh backup
# 2. Simulate data loss — clear the live file inside the volumedocker 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 backupipam-backup.sh restore
# 5. Confirm the dashboard serves the IPAM data again at /tools/ipamIf step 5 shows your records, the backup is real. Record the date you last ran this drill.
v0.1.0 · d0d7a20 · 2026-06-26