Upgrading from a very old container fails due to postgres permission errors

Continuing the discussion from Welcome to nginx! page before rebuild, site won't rebuild now:

It’s fairly rare, but when upgrading from a very old container, permissions for postgres are wrong (the postgres UID and GID changed. To fix it this is required:

chmod -r 101.104 /var/discourse/shared/standalone/postgres_data

I’ve done this several times. I recognized the problem in my first reply to the linked topic, but figuring out what UID/GID are required isn’t particularly easy for most people. (Find a working server and do an ls -ld /var/discourse/shared/standalone/postgres_data.

3 Likes

Or, easier:

○ → docker run --rm discourse/base:2.0.20250226-0128 id postgres
uid=101(postgres) gid=104(postgres) groups=104(postgres),107(ssl-cert)

or even better:

docker run --rm -v /var/discourse/shared/standalone/postgres_data:/data discourse/base:2.0.20250226-0128 chown -R postgres:postgres /data
2 Likes

That’s the kind of answer that I love. It’s not what many people would call “easy”!

I just don’t think to run the bare container.

1 Like