AIV Backup with Docker — Setup & Usage Guide
This guide explains how to set up and use the automated backup system included with the AIV Hub Docker deployment.
What Gets Backed Up
| Item | Tool | Storage location |
|---|---|---|
| PostgreSQL database | pg_dump | ./backups/YYYY-MM-DD_HHMMSS/db.dump |
| AIV repository folder | restic snapshots | ./backups/restic_repo/ |
Prerequisites
- Docker and Docker Compose installed
- The AIV Docker package extracted on your machine
Getting Started
Step 1 — Extract the zip
Extract the AIV Docker zip file. You will get a folder with this structure:
docker-aiv-main/
├── docker-compose.yml
├── .env
├── backup/
├── repository/
├── config/
└── ... (other files)
Step 2 — Open a terminal in the folder
Windows: Open Command Prompt or PowerShell and navigate to the extracted folder:
cd path\to\docker-aiv-main
Linux / macOS:
cd path/to/docker-aiv-main
Step 3 — Start all services
docker compose up -d --build
This will:
- Pull all required Docker images (first run takes a few minutes)
- Build the backup container
- Start all 5 services:
postgres,aiv,aiv-ai,pgadmin,aiv-backup
Step 4 — Verify all containers are running
docker ps
Expected output:
NAMES STATUS
postgres Up (healthy)
aiv Up
aiv-ai Up
pgadmin Up
aiv-backup Up
Step 5 — Access AIV
Open your browser and go to:
http://localhost:8080/aiv
Default credentials:
- Username:
Admin - Password:
password
Backup Behaviour
- The backup container starts automatically with
docker compose up - It waits 20 minutes after startup before taking the first backup — this gives AIV time to fully initialize
- After the first backup, subsequent backups run every 1 hour automatically
- The last 24 backups are kept — older ones are deleted automatically
- Backup files are stored in the
./backups/folder inside your project directory
Taking a Manual Backup
To trigger a backup immediately without waiting for the schedule:
docker exec aiv-backup bash -lc "./backup.sh"
You will see output like:
=== Full backup started at 2026-05-20_100000 ===
Starting pg_dump...
Starting restic backup...
snapshot a1b2c3d4 saved
pg_dump finished.
=== Backup completed: /backups/2026-05-20_100000 ===
Viewing Backup Logs
docker logs aiv-backup
Restoring
Step 1 — List available restore points
docker exec aiv-backup bash -lc "./list_restore_points.sh"
Sample output:
--- PostgreSQL dumps ---
2026-05-20_110000
2026-05-20_100000
2026-05-19_180000
--- Restic snapshots ---
ID Time Paths
a1b2c3d4 2026-05-20 11:00:00 /data/repo
Step 2 — Restore
Full restore — restores both repository files and database:
docker exec aiv-backup bash -lc "./restore.sh 2026-05-20_110000"
Replace 2026-05-20_110000 with the timestamp you want to restore to.
Database only:
docker exec aiv-backup bash -lc "./restore_dbbackup.sh 2026-05-20_110000"
Stopping and Starting
Stop all services:
docker compose down
Start again:
docker compose up -d
The backup container does not need
--buildon subsequent starts — only needed on first run or after updating thebackup/folder.
Folder Structure After First Run
After running docker compose up -d, Docker automatically creates these folders:
docker-aiv-main/
├── docker-compose.yml
├── .env
├── backup/ ← backup scripts (included in zip)
├── repository/ ← AIV data (included in zip)
├── config/ ← AIV config (included in zip)
├── pg_data/ ← PostgreSQL data (auto-created)
├── backups/ ← backup files (auto-created)
│ ├── 2026-05-20_100000/
│ │ └── db.dump
│ └── restic_repo/
├── logs/ ← AIV logs (auto-created)
└── dataloc/ ← AIV temp files (auto-created)
Configuration
To change backup settings, edit the backup service environment in docker-compose.yml:
| Variable | Default | Description |
|---|---|---|
STARTUP_DELAY | 1200 | Seconds to wait before first backup (1200 = 20 min) |
BACKUP_INTERVAL | 3600 | Seconds between backups (3600 = 1 hour) |
MAX_PG_DUMP_BACKUPS | 24 | Number of database dumps to keep |
MAX_RESTIC_SNAPSHOTS | 24 | Number of repository snapshots to keep |
RESTIC_PASSWORD | aivbackup2026 | Encryption password for backups |
After changing any setting:
docker compose up -d
Quick Reference
| Action | Command |
|---|---|
| Start everything | docker compose up -d --build |
| Stop everything | docker compose down |
| Check containers | docker ps |
| View backup logs | docker logs aiv-backup |
| Take backup now | docker exec aiv-backup bash -lc "./backup.sh" |
| List restore points | docker exec aiv-backup bash -lc "./list_restore_points.sh" |
| Restore | docker exec aiv-backup bash -lc "./restore.sh 2026-05-20_100000" |
| Restore DB only | docker exec aiv-backup bash -lc "./restore_dbbackup.sh 2026-05-20_100000" |