PostgreSQL Upgrade
Always make a backup before attempting any upgrade activities. It is advised to test the upgrade process on the UAT or Test instance.
Dockerized PostgreSQL
For deployments that use dockerized PostgreSQL, OLMIS provides a custom image - https://github.com/OpenLMIS/postgres
Upgrading Image
OLMIS Implementers will most often skip this step, as most likely the correct image has already been prepared by the Core team.
Modify the base image to the Debezium version of the target PostgreSQL
Push the new image, take note of the versioning convention - https://hub.docker.com/r/openlmis/postgres/tags
The DockerHub credentials can be found at https://openlmis.atlassian.net/wiki/spaces/OP/pages/41517067
Review of CI/CD tools as they might use Docker version incompatible with the new openlmis postgres image
Upgrading instance
Upgrade instructions for each version can be found on the PostgreSQL page - https://www.postgresql.org/docs/12/upgrading.html
To properly upgrade the database, additional steps might be required, depending on the deployed instance:
PostGIS extension upgrade. See the compatibility matrixhttps://trac.osgeo.org/postgis/wiki/UsersWikiPostgreSQLPostGIS and upgrade instructions here https://postgis.net/workshops/postgis-intro/upgrades.html
Review of custom Jasper reports (might contain custom SQL, which is not compatible)
AWS PostgreSQL RDS
For deployments that use the RDS service to host the database, we suggest following AWS best practices.
For OLMIS Core instances, the procedure described below has been used with success.
Core RDS Upgrade
The strategy is based on the following premises:
We must retain the data
We can allow hours of downtime
We have full control over the AWS account
The OLMIS services are compatible with the new version of PostgreSQL
Procedure
This involves ~3 hours of downtime.
Review AWS Best Practices and take note of extension upgrades.
Stop OLMIS App server.
Make an RDS Snapshot of the current DB server.
Restore the RDS Snapshot into a new RDS - Upgrade Instance.
Regardless of the target instance type, use a server with at least 16GB of RAM - this affects how fast the upgrade will go.
Perform RDS Major Upgrade
The progress may appear to be stuck. Verify the memory usage - Freeable memory and SwapUsage - if the former rises, it means there is not enough RAM, restart the process on a new instance.
Make a snapshot of the Upgrade Instance.
Restore the Upgrade Instance Snapshot into the target type of RDS.
Reconfigure the OLMIS App to connect to the new RDS.
Test.
Delete old RDS, and delete the Upgrade Instance.
OpenLMIS: the global initiative for powerful LMIS software