Step 9 - Backup and Restore Authentik
Authentik stores everything in PostgreSQL. Back it up with pg_dump:
#!/bin/bash
/usr/local/bin/backup-authentik.sh
DATE=$(date +%Y%m%d_%H%M%S)
BACKUP_DIR="/backups/authentik"
mkdir -p "$BACKUP_DIR"
Dump PostgreSQL from the authentik-postgresql container
docker exec authentik-postgresql-1 pg_dump -U authentik authentik \
| gzip > "${BACKUP_DIR}/authentik-db-${DATE}.sql.gz"
Also backup the media directory (profile pictures, certificates)
tar czf "${BACKUP_DIR}/authentik-media-${DATE}.tar.gz" \
/opt/authentik/media/ 2>/dev/null || true
Retain last 30 backups
find "$BACKUP_DIR" -name "*.sql.gz" -o -name "*.tar.gz" | sort | head -n -30 | xargs rm -f
echo "Authentik backup complete: ${BACKUP_DIR}/authentik-db-${DATE}.sql.gz"
Restore:
Stop Authentik, restore the DB, restart
docker compose -f /opt/authentik/docker-compose.yml stop server worker
gunzip -c /backups/authentik/authentik-db-20260322_120000.sql.gz | \
docker exec -i authentik-postgresql-1 psql -U authentik authentik
docker compose -f /opt/authentik/docker-compose.yml start server worker
Related Reading
- How to Set Up Caddy with Automatic HTTPS
- How to Set Up Nebula Mesh VPN for Teams
- How To Set Up Mobile Device Management Profile For Personal
- AI Coding Assistant Session Data Lifecycle
-
AI Tools for Automated Secrets Rotation and Vault Management
Related Articles
- Set Up Mail In A Box Private Email Server Complete 2026
- Best Privacy-Focused Email Aliases Service Comparison 2026
- How to Check If Your Email Server Has Been Blacklisted
- 1Password Masked Email Feature Review: A Developer Guide
- How to Set Up Self-Hosted Password Manager Vaultwarden 2026 Built by theluckystrike. More at zovo.one