For customers using embedded PostgreSQL database, with GitGuardian version 2024.7.0
, we are moving from PostgreSQL version 13 to version 16.
In order to perform the update, it is necessary to first create a backup of the data, which will then be restored after the GitGuardian update. We provide a set of scripts that will allow you to perform this migration.
git clone https://github.com/GitGuardian/ggtools.git
cd ggtools/postgresql-16-upgrade/scripts
First, you need to dump data using the backup.sh
script:
./backup.sh --namespace <gitguardian_namespace> --output </path/to/pg_dump.sql.gz>
The script will perform the following steps:
- Retrieve the current GitGuardian version using
kubectl
. - Retrieve PostgreSQL running Pod using
kubectl
- Dump the Gitguardian data to the specified path on your desktop using the
--output
option (Data is compressed usinggzip
) - Create a ConfigMap called
postgresql-backup
in the<gitguardian_namespace>
which contains the following informations:- Backup file MD5 hash
- Backup status
- Backup date (ISO format)
- GitGuardian application current version
From the KOTS admin console you can now update the GitGuardian application.
🚦 A preflight check called PostgreSQL 16 Upgrade
will ensure that the backup was executed correctly by checking the configMap postgresql-backup
.
Once the application update has successfully completed, you can restore the data using the restore.sh
script:
./restore.sh --namespace <gitguardian_namespace> --input </path/to/pg_dump.sql.gz>
The script will perform the following steps:
- Check that the specified backup file MD5 hash matches the one specified in the configMap
postgresql-backup
- Retrieve PostgreSQL running Pod using
kubectl
. - Scale down all the GitGuardian application Deployments.
- Restore the GitGuardian PostgreSQL data.
- Scale up all the GitGuardian application Deployments.
- Migrate the GitGuardian database with the new application version.