Migrating from PostgreSQL v14 to v16
Keeping PostgreSQL up to date.

PostgreSQL v14 passed it's End Of Supported Life at the start of November 2026, to ensure on going support we are migrating our Docker Compose and Kubernetes installs to PostgreSQL v16.
As part of the FlowFuse v3.4.0 release we are shipping PostgreSQL v16, the following are the instructions for upgrading from any version greater than FlowFuse v2.10.0.
If you are starting with version v2.10.0 or older please follow these instructons to move to v3.3.0 first.
Assumptions
Through out this document the following assumptions will be made
Docker
- Docker Compose commands include the
-p flowfuseoption to set the project name. Your project name can be found by runningdocker compose ls - The posgres service in the
docker-compose.ymlhas not_ been edited (specifically thePOSTGRES_PASSWORDandPOSTGRES_USERenvironment variables)
Kubernetes
- The FlowFuse helm chart was installed into the
flowfusenamespace - You are using the bundled PostgreSQL database, not an externally installed and configured install. Specifically the following Helm values are not set:
postgresql.hostpostgresql.auth.usernamepostgresql.auth.passwordpostgresql.auth.database
If these your install is different then the commands will need to be updated to match your specific environment.
Backup
Before starting any migration it is important to ensure a full backup of the database is performed.
The following commands will write a compressed database backup to a file called flowfuse-db-backp-sql.bz2 in the current directory.
Docker
docker exec -it flowfuse-postgres-1 pg_dump flowforge | bzip2 > flowfuse-db-backup-sql.bz2
You should also take a copy of your current docker-compose.yml file
cp docker-compose.yml docker-compose-backup.yml
Kubernetes
PGPASSWORD=`kubectl -n flowfuse get secrets flowfuse-secrets -o json | jq -r '.data."postgres-password"' | base64 -d`
kubectl -n flowfuse exec -it flowfuse-postgresql-0 -- /bin/sh -c "env PGPASSWORD=$PGPASSWORD pg_dump -U postgres flowforge" | bzip2 > flowfuse-db-backup-sql.bz2
Upgrade
Docker
Once the backup has completed the following steps need to be completed to upgrade the PostgreSQL instance. These instructions insert part 2 into the normal upgrade instructions
- Stop the docker compose project
docker compose -p flowfuse down --rmi all - Run the in place database upgrade
docker run --rm -it --name pgupdate -v flowfuse_db:/var/lib/postgresql/data -e POSTGRES_PASSWORD=password -e POSTGRES_USER=root -e PGAUTO_ONESHOT=yes pgautoupgrade/pgautoupgrade:16-trixie - Download the latest Docker Compose files
curl -L -o docker-compose.yml https://github.com/FlowFuse/docker-compose/releases/latest/download/docker-compose.yml - Make sure the
.envfile is present and contains your installation-specific configuration. Download an example.envfile if needed:curl -o .env.example https://raw.githubusercontent.com/FlowFuse/docker-compose/refs/heads/main/.env.example - Pull the latest version of the default stack container (and any other stacks you have configured)
docker pull flowfuse/node-red:latest - Start the project depending on the TLS configuration:
- automatic TLS:
docker compose --profile autossl -p flowfuse up -d - any other scenario:
docker compose -p flowfuse up -d
- automatic TLS:
Kubernetes
The Kubernetes upgrade is handled by the helm chart. Using v2.x.x of the helm chart will include an init container to the PostgreSQL subchart that will perform an inplace upgrade at startup (and no-op on subsequent restarts).
The usual Kubernetes upgrade instructions should be followed.
Restore from Backup
Should there be a problem the following instauctions can be used to revert to the previous FlowFuse version and PostgreSQL v14.
Docker
- Stop any running containers
docker compose -p flowfuse down --rmi all - Delete PostgreSQL v16 database volume
docker volume rm flowfuse_db - Bring up the containers but do not start them
- automatic TLS:
docker compose --profile autossl -p flowfuse up -d --no-start - any other scenario:
docker compose -p flowfuse up -d --no-start
- automatic TLS:
- Manually start the PostgreSQL container
docker start flowfuse-postgres-1 - Restore the backup
bzcat flowfuse-db-backup-sql.bz2 | docker exec -it flowfuse-postgres-1 pg_restore -c flowforge - Restart other containers
docker compose -p flowfuse start
Kubernetes
If the PostgreSQL
- Scale the FlowFuse Deployment to 0 instance
kubectl -n flowfuse --replicas=0 deployment flowforge - Scale the FlowFuse FileServer to 0 instance
kubectl -n flowfuse --replicas=0 deployment flowforge-file - Scale the Postgres server to 0 instance
kubectl -n flwofuse --replicas=0 statefulsets flowfuse-postgresql - Run an Ubuntu pod as a Job to delete the corupt data
kubectl -n flowfuse apply -f - <<EOF apiVersion: batch/v1 kind: Job metadata: name: postgres-cleanup spec: template: containers: - name: ubuntu image: ubuntu command: - rm - -rf - /data/data/* volumeMounts: - mountPath: "/data" name: data volumes: - name: data persistentVolumeClaim: claimName: data-flowfuse-postgresql-0 restartPolicy: Never backoffLimit: 1 EOF - Scale Postgres server to 1 instance
kubectl -n flwofuse --replicas=1 statefulsets flowfuse-postgresql - Restore backup
PGPASSWORD=`kubectl -n flowfuse get secrets flowfuse-secrets -o json | jq -r '.data."postgres-password"' | base64 -d` bzcat flowfuse-db-backup.sql.bz1 | kubectl -n flowfuse exec -it flowfuse-postgresql-0 -- /bin/sh -c "env PGPASSWORD=$PGPASSWORD pg_restore -U postgres flowforge" - Scale the FlowFuse Deployment to 1 instance
kubectl -n flowfuse --replicas=1 deployment flowforge - Scale the FlowFuse FileServer to 1 instance
kubectl -n flowfuse --replicas=1 deployment flowforge-file
Build your first industrial application with us
Our engineers work alongside your team to solve a real problem on your own equipment and data.
About the Author
Ben Hardill
Senior Software Developer
Ben is the Lead Backend Developer and one of the founding employees at FlowFuse. As well as being a Node-RED core contributor he enjoys tinkering at lowest levels of the Internet
Like what you're reading?
Add FlowFuse as a preferred sourceOn the page that opens, check the box next to flowfuse.com to see more of our articles in your Google Search results.
Recommended Articles:
- Migrating from PostgreSQL v14 to v16
- Changes to Starter, Pro, and Team Plans: Your Questions Answered
- CNC Machine Monitoring: Get More Output Before More Machines
- A Control Plan Template Your Shop Floor Will Actually Use
- End of Line Testing: Your Final Defense Against Defects
