What to backup
A complete Infrahub backup includes:- Neo4j database - All graph data, schemas, branches, and version history
- Prefect PostgreSQL database - Task execution history and workflow state
- Artifact storage - Generated artifacts, files, and Git repositories
- Configuration - Environment variables and configuration files
Backup strategies
Full backup
Capture all components at a consistent point in time:- Best for disaster recovery
- Ensures data consistency across all services
- Requires stopping or pausing services
- Suitable for scheduled maintenance windows
Hot backup
Backup while services are running:- Minimizes downtime
- May have slight inconsistencies
- Suitable for continuous operations
- Requires careful coordination
Incremental backup
Backup only changed data since last backup:- Reduces backup size and time
- Requires baseline full backup
- More complex restoration process
- Best for large deployments
Backup tools
infrahub-backup CLI (recommended)
Theinfrahub-backup tool provides automated backup and restore:
- Automatic Neo4j and PostgreSQL backup
- Integrity verification with SHA256 checksums
- Coordinated service shutdown and restart
- Metadata preservation
- Artifact storage backup not yet included
- Requires Docker Compose deployment
Manual backup procedures
For custom backup workflows or Kubernetes deployments:Backup procedures
Docker Compose backup
Step 1: Stop task workers Prevent new tasks from starting:Kubernetes backup
For Kubernetes deployments, see the dedicated backup guide: Kubernetes Backup GuideRestore procedures
Docker Compose restore
Step 1: Stop servicesNeo4j cluster backup and restore
For Neo4j Enterprise clusters, follow these specialized procedures:Backup from cluster node
Restore to cluster node
Step 1: Transfer backupserverId for the target node.
Step 6: Recreate database from seed
Backup automation
Scheduled backups with cron
Create a backup script:backup.sh
Kubernetes CronJob
Create a Kubernetes CronJob:backup-cronjob.yaml
Backup retention
Retention policy example
- Hourly backups: Keep for 24 hours
- Daily backups: Keep for 7 days
- Weekly backups: Keep for 4 weeks
- Monthly backups: Keep for 12 months
Implement retention with script
retention.sh
Testing backups
Verify backup integrity
Test restoration
Periodically test restoration in a separate environment:- Deploy fresh Infrahub instance
- Restore from backup
- Verify data integrity
- Test API functionality
- Document any issues
Related resources
- Database backup guide - Detailed backup procedures
- Docker Compose deployment - Deployment configuration
- Kubernetes deployment - Kubernetes-specific backups
- Monitoring - Monitor backup health