Backup & Restore
This page provides one simple and reliable approach: stopped full backup and restore. Run both backup and restore from a deployment directory named asp-compose, so the Docker Compose project name and volume names stay unchanged.
Do not run
docker compose down -v. The-vflag deletes Docker named volumes for PostgreSQL, Redis, RustFS, and other persistent data.
Backup files contain
.env, certificates, databases, object storage, and logs. They may include secrets, API Keys, alert data, and investigation records. Encrypt backups and restrict access.
1. Full backup
Run this in the asp-compose/ directory:
BACKUP_DIR="$PWD/backups/asp-full-$(date +%Y%m%d%H%M%S)"
mkdir -p "$BACKUP_DIR"
docker compose stop
tar -czf "$BACKUP_DIR/files.tar.gz" \
--exclude='./backups' \
.env .env.example compose*.yaml scripts custom certs logs
docker run --rm \
-v asp-compose_postgres-data:/volumes/postgres-data:ro \
-v asp-compose_redis-data:/volumes/redis-data:ro \
-v asp-compose_rustfs-data:/volumes/rustfs-data:ro \
-v asp-compose_custom-python-packages:/volumes/custom-python-packages:ro \
-v asp-compose_static-files:/volumes/static-files:ro \
-v "$BACKUP_DIR:/backup" \
alpine sh -lc 'cd /volumes && tar -czf /backup/volumes.tar.gz postgres-data redis-data rustfs-data custom-python-packages static-files'
docker compose up -d
./scripts/doctor.shThe backup contains:
files.tar.gz:.env,compose.yaml,compose.override.yamlwhen present,scripts/,custom/,certs/, and the log directory.volumes.tar.gz: Docker named volumes for PostgreSQL, Redis, RustFS, custom Python packages, and static files.
2. Full restore
Restore overwrites data in the current deployment directory and Docker named volumes. Confirm that the current environment can be replaced by the backup contents before continuing.
Before restoring, confirm:
- The restore directory name is still
asp-compose. - The directory referenced by
BACKUP_DIRcontainsfiles.tar.gzandvolumes.tar.gz. - If restoring to a new machine, Docker and Docker Compose are already installed.
Run this in the target asp-compose/ directory:
BACKUP_DIR=/path/to/asp-full-backup
tar -xzf "$BACKUP_DIR/files.tar.gz" -C .
docker compose down --remove-orphans
docker run --rm \
-v asp-compose_postgres-data:/volumes/postgres-data \
-v asp-compose_redis-data:/volumes/redis-data \
-v asp-compose_rustfs-data:/volumes/rustfs-data \
-v asp-compose_custom-python-packages:/volumes/custom-python-packages \
-v asp-compose_static-files:/volumes/static-files \
-v "$BACKUP_DIR:/backup" \
alpine sh -lc '
for dir in postgres-data redis-data rustfs-data custom-python-packages static-files; do
rm -rf "/volumes/$dir"/* "/volumes/$dir"/.[!.]* "/volumes/$dir"/..?*
done
tar -xzf /backup/volumes.tar.gz -C /volumes
'
docker compose up -d
./scripts/doctor.shIf the restore directory is not named
asp-compose, Docker Compose generates different default volume names, for example no longerasp-compose_postgres-data. Services will then not see the restored data.
Next Steps
- Upgrade — Run backups and health checks before and after upgrades.
- Restart & Operations — View service status, logs, and common restart commands.