The documented procedure on the forums lists two methods of upgrading Postgres.
- Just let Discourse handle it. This requires 3 times the disk space. So if your DB is 100GB, you would need an additional 200GB free to do the upgrade. Obviously a huge problem for people with large installs.
- Follow their “manual update” procedure. This requires 2 times the disk space, so if your DB is 100GB you would need an additional 100GB free. This is also a big problem for some.
In this post, @Falco suggested using the
--link option to do the upgrade in-place using hard links. The docker container they suggest using supports that argument, but Discourse devs don’t suggest using it in the post.
So my question is this, should option 3 be:
- Run the command below, which will require a very small amount of additional disk space. So if your DB is 100GB, it might require, say, an additional 10GB? And if so, is this a recommended procedure by the Discourse devs, and has anyone actually done it before and lived to tell the tale?
New command to upgrade in-place:
docker run --rm \ -v DIR:/var/discourse/shared/standalone/postgres_data:/var/lib/postgresql \ tianon/postgres-upgrade:12-to-13 \ --link
Compared to the old command to upgrade into a new directory (requiring double the space):
docker run --rm \ -v /var/discourse/shared/standalone/postgres_data:/var/lib/postgresql/12/data \ -v /var/discourse/shared/standalone/postgres_data_new:/var/lib/postgresql/13/data \ tianon/postgres-upgrade:12-to-13
P.S.: I would have just replied to that PG13 upgrade thread, but it deletes posts after 7 days. Why do you have it configured that way? I know there was a lot of discussion when this first came up that would have been useful for reference.