Updates for Debian and PostgreSQL
Just a small notice about my latest server maintenance.
Debian Bullseye
I just updated my servers and Proxmox hypervisors to the latest version.
Proxmox 7 is based on Debian Bullseye, so I had to edit the sources.list
and run pve6to7
to see if I missed anything.
I started doing the upgrade on a second old laptop running Proxmox before updating my productive Proxmox. Both upgrades worked very well.
Bullseye also reached my work laptop as well as my personal home server, which went very smooth without any problems.
PostgreSQL 12 to 13
A little more configuration was needed when I updated my PostgreSQL databases from 12 to 13. PostgreSQL is not forward-compatible and won’t auto-migrate the data directory created with an older major version.
The recommended way is to install both versions at once and then use pg_upgrade
to update the data folder to the new format. After that the older version can be removed.
As I am using containers, this is not as easy as it sounds. There is a project which has install scripts for different major versions at once, but I didn’t like this approach either.
So I did a backup with pg_dump
like this:
docker exec gitea-db pg_dump -Fc -U gitea gitea > gitea-db-backup.sql
Then I stopped the docker-compose stack, edited the docker-compose file to use postgresql:13-alpine
.
Moved the volume folder mv gitea-pg old-gitea-db
before starting the new container - otherwise they will just restart and complain about the old data in wrong format.
Then I started just the new db-container with docker-compose up -d gitea-db
and used pg_restore to restore from the just created backup file:
docker exec -i gitea-db pg_restore -U gitea --dbname=gitea --verbose --clean < gitea-db-backup.sql
This worked very well without any problems for all my services running a PostgreSQL database.
Edit: I just used this method to do the upgrade from 13 to 14 (18.06.2022)