PostgreSQL 15 update

I have solved the problem I had with the PostgreSQL 13 to 15 upgrade, after restoring the server with the failed upgrade from backups, the following steps worked for me with a PostgreSQL en_GB.UTF-8 locale:

sudo -i
su - discourse
cd /var/discourse
git stash
git stash drop
git pull
./launcher stop app
docker run --rm \
    --entrypoint=/bin/bash \
    -e LANG='en_GB.UTF-8' \
    -v /var/discourse/shared/standalone/postgres_data:/var/lib/postgresql/13/data \
    -v /var/discourse/shared/standalone/postgres_data_new:/var/lib/postgresql/15/data \
    tianon/postgres-upgrade:13-to-15 \
    -c 'sed -i "s/^# $LANG/$LANG/" /etc/locale.gen && locale-gen &&
    apt-get update && apt-get install -y postgresql-13-pgvector postgresql-15-pgvector &&
    docker-upgrade'
exit
mv /var/discourse/shared/standalone/postgres_data /var/discourse/shared/standalone/postgres_data_old
mv /var/discourse/shared/standalone/postgres_data_new /var/discourse/shared/standalone/postgres_data
chown -R 101:104 /var/discourse/shared/standalone/postgres_data
su - discourse
cd /var/discourse
docker run --rm -v /var/discourse/shared/standalone:/shared \
local_discourse/app chown -R postgres:postgres /shared/postgres_data 
./launcher rebuild app

I needed to remove the local changes that had been made in the past for the PostgreSQL LANG using git stash; git stash drop and the moving of the PostgreSQL data directories needed to be be done as root and a chown was needed.

5 Likes