Skip to content

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

ItemToolStorage location
PostgreSQL databasepg_dump./backups/YYYY-MM-DD_HHMMSS/db.dump
AIV repository folderrestic 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 --build on subsequent starts — only needed on first run or after updating the backup/ 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:

VariableDefaultDescription
STARTUP_DELAY1200Seconds to wait before first backup (1200 = 20 min)
BACKUP_INTERVAL3600Seconds between backups (3600 = 1 hour)
MAX_PG_DUMP_BACKUPS24Number of database dumps to keep
MAX_RESTIC_SNAPSHOTS24Number of repository snapshots to keep
RESTIC_PASSWORDaivbackup2026Encryption password for backups

After changing any setting:

docker compose up -d

Quick Reference

ActionCommand
Start everythingdocker compose up -d --build
Stop everythingdocker compose down
Check containersdocker ps
View backup logsdocker logs aiv-backup
Take backup nowdocker exec aiv-backup bash -lc "./backup.sh"
List restore pointsdocker exec aiv-backup bash -lc "./list_restore_points.sh"
Restoredocker exec aiv-backup bash -lc "./restore.sh 2026-05-20_100000"
Restore DB onlydocker exec aiv-backup bash -lc "./restore_dbbackup.sh 2026-05-20_100000"