Backup and Restore
This guide covers how to back up and restore an OpenCodeHub instance.
Backup Strategy
1. Database
For PostgreSQL, use pg_dump:
pg_dump -U opencodehub -d opencodehub_db > opencodehub_backup.sql
2. Git Repositories
The Git repositories are stored in the path defined by GIT_REPOS_PATH (default: ./data/repos).
You can back this up using rsync or tar:
tar -czvf repos_backup.tar.gz ./data/repos/
3. Object Storage
If you are using S3 or another object storage provider for artifacts, ensure you have enabled versioning and standard bucket backups through your cloud provider. If using local storage, back up the configured ./data/storage directory.
Restore Strategy
To restore:
- Stop the application and worker processes.
- Restore the database using
psql. - Extract the Git repositories to
GIT_REPOS_PATH. - Restore object storage data.
- Restart the application.