-
Notifications
You must be signed in to change notification settings - Fork 36
Restore a database backup (manual)
Steve Hillier edited this page Jun 6, 2019
·
1 revision
Database backups are created using the backup container and stored in 3 places:
- in the database pod (pre-deploy backup)
- in the cluster on a backup PVC (nightly)
- in the BCGov NFS storage (nightly)
The backups can be restored manually as follows:
- Mount the backup PVC to a running database pod.
- If no database is available or you want to test this process without affecting the app's database, you may use
oc new-app
to start a new temporary database (TODO: more instructions. Until then, check oc-new app documentation). The database currently uses thepostgresql-9.6-oracle-fdw
image. - Use the OpenShift GUI to navigate to a database deployment and select "add storage".
- Choose a mount point (such as
/backup
) and check read only. - Depending on the environment, there will be several
gwells-psql-backup
and/orbk-gwells-nfs
PVCs with backups. - Use the terminal to browse available backups on the PVC after mounting and waiting for the pods to come back up.
- Unzip and edit the backup file.
- Copy the backup to /tmp and use
gunzip my_db_backup.sql.gz
- We haven't yet automated the restore process. Current backups require some manual steps:
- use a text editor (the environments have
vi
installed) and comment out the lineCREATE USER MAPPING ...
(search for it) - add
CREATE ROLE fdw_reader;
- use a text editor (the environments have
- Restore the backup
psql -d gwells -x -v ON_ERROR_STOP=1 < my_db_backup.sql
- You may need to re-run any migrations that have occurred since the backup was taken. You can re-deploy the GWELLS deployment in the OpenShift console (this will trigger the deploy hooks, which run migrations), or re-run the Jenkins pipeline.
- Working on GWELLS (full workflow from writing code to deploying to prod)
- Water terminologies
- Testing
- Swagger Documentation
- Restore a database backup manually
- (Archived) Manual Syncing of DEV to TEST to PROD
- (Archived) Setup GWells data migration for local dev test
- Update PostGres Oracle Foreign Data Wrapper image
- Increase PostgreSQL Database storage
- (Archived) Regular Corruption of the PostgreSQL DB
- (Archived) Recovering from a corrupt PostgreSQL Database