Upgrade Postgres version (Docker-Compose)
Here you will learn how to upgrade the postgres database version of your existing open-appsec deployment on docker (relevant for docker-compose-based deployment).
When is a postgres database upgrade required?
This is ONLY relevant if ALL of the following applies to your current deployment:
redeployment/ugprade of an existing open-appsec deployment (this is not relevant for new deployments)
current deployment is a standalone deployment (without a web UI profile token provided in the
.envfile, when connecting to web UI with a profile token typically there should not be any local postgres database being deployed/used)current deployment has the
docker-composestandaloneprofile set in the.envfile (otherwise postgres container wouldn't be deployed/used at all)current postgres version shall be replaced with newer postgres image version, which is also a new major release (which means database conversion is required)
Postgres database upgrade instructions
Before upgrading from an existing to a newer major release postgres database version (using newer postgres container version tag) in your existing open-appsec deployment on Docker, the existing database files must be converted properly for compatibility with the new version.
If you are not using the latest
docker-composefiles yet: Download the latestdocker-compose.yamlfile and.envfile and apply your desired configuration changes (see also Deploy With Docker-Compose)In the
.envfile set the value forAPPSEC_POSTGRES_VERSIONas required to a new major release postgres version. This setting will be used for the database upgrade using the script below and also as the tag for the newpostgrescontainer to be deployed (postgres database downgrades are not supported!)Now run the
migrate-postgres.shscript following these steps before deploying the updated environment withdocker-compose:
Your current deployment including the postgres container should still be running when performing this step!
wget https://downloads.openappsec.io/scripts/migrate_postgres.sh
chmod +x ./migrate_postgres.sh
./migrate_postgres.shThis script will automatically migrate the existing postgres database to the database format of the new postgres version specified in the .env file in with this configuration key: APPSEC_POSTGRES_VERSION.
Now you can restart your existing
docker-compose-based deployment including pulling the new container imagesdocker-compose down docker-compose pull docker-compose up -d
You now have an open-appsec deployment with an upgraded postgres database version up and running.
Recover postgres structure if postgres version was upgraded without running migrate_postgres.sh tool first
If you already switched and ran a newer postgres container image with new postgres major version, follow the instructions further below to fix your postgres database structure retroactively so it will work correctly with the new postgres version.
Perform these steps to download and run a script which recovers your postgres structure to make it work correctly with your new postgres major version.
These commands should be executed from within your deployment folder which also holds the docker-compose.yaml and the .env file.
wget https://downloads.openappsec.io/scripts/recover_postgres_structure.sh
chmod +x ./recover_postgres_structure.sh
./recover_postgres_structure.sh Last updated
Was this helpful?