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):
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.
If they have, they didn’t mention it here. Mostly instrucions here try to be as foolproof as possible and require as little system adminstration knowledge as possible. Most people here woud rather do something the safest, most tested way possible than some way designed to save a very few dollars.
If it works for you, you can update PostgreSQL 13 update accordingly, but before you do, do you feel comfortable recommending to someone who doesn’t know what bash is that they do it that way? You’re sure that it won’t hose their database and their site will be ruined forever?
The idea is that if some other good information is presented that it be added to the OP rather than asking people to read through year’s worth of posts that are likely to be unhelpful or wrong.
No I’m not sure, I don’t have much experience with postgres and was hoping one of the discourse devs could provide some assurances it would work.
Even if it does work I also wouldn’t recommend it as the default upgrade procedure as the old way keeps a separate copy of the DB for rollback. If it works it would be a great option for space-constrained environments though.
Another easy way is to spin up a new server, migrate the data, and turn off the old one. If you must use the old one, do the upgrade on a temporary server, so a fresh install on the original server (which probably needs an OS upgrade) and move it back.
That’s safe, easy, and well documented. Hundreds of people have done that.
Yes, but that would take a day or two. During that time we could either a) tell users their posts during this period will be lost or b) set the forum read-only. Neither is a great solution.
I don’t think that the server would be down a whole lot longer than during the rebuild. And if you move to the new server and stay there, you can leave the old server in read only mode while you make the move. If downtime is your concern then moving to a new server will be much, much better.
We have a pretty big forum, but I’ve never tried restoring a backup so I don’t know how long it would take. We would indeed stay on the new host if we did it. I would like to avoid that due to the extra work/annoyance if possible.
Eine andere Möglichkeit, das Problem des Upgrades bei begrenztem Speicherplatz zu lösen, besteht darin, ein Backup zu erstellen, das Postgres-Verzeichnis mit rm -r zu löschen, neu zu erstellen und dann das Backup wiederherzustellen. Ich habe dies letzte Woche auf einer Website gemacht.
Nein, es wurde nie ein Upgrade durchgeführt. Das Löschen der DB und das Wiederherstellen des Backups klingt ziemlich riskant. Wir brauchen im Grunde ein In-Place-Upgrade.
Wir verwenden Ubuntu 18.04, das 2023 nicht mehr unterstützt wird. Ich gehe davon aus, dass wir zu diesem Zeitpunkt keine andere Wahl haben werden, als zu einem neuen Host zu migrieren, und planen, dann in den sauren Apfel zu beißen, einen neuen Host mit 22.04 LTS einzurichten und aus dem Backup wiederherzustellen.
Hmm. Könnte eine Geldverschwendung sein. Ich denke, mit dem Backup-Modell ist eine der Kopien komprimiert, was einen Unterschied machen könnte? Und die Seite, auf der ich es gemacht habe, hatte Backups auf S3. Und es war eine Testseite, also waren die Einsätze bei einem Problem gering.
Außer dass Backups viel öfter und in viel mehr Situationen verwendet werden als das In-Place-Upgrade. Ich halte es für viel sicherer.
Vielleicht, aber ich habe nicht viel Erfahrung mit Postgres und fühle mich damit nicht wohl. Die gesamte Website aus einem Backup auf einer völlig anderen VM wiederherzustellen, damit fühle ich mich wohl, allerdings würde das bedeuten, Beiträge für wie viele Stunden auch immer zu verlieren, die die Wiederherstellung dauert, also bin ich auch davon nicht gerade begeistert. Aber da 18.04 nicht mehr unterstützt wird, werde ich nächstes Jahr nicht viel Wahl haben.
Es sei denn, Ihre Datenbank ist mehrere zehn Gigabyte groß, dann dauert es keine Stunden. Und Sie werden das Forum in den schreibgeschützten Modus versetzen, bevor Sie ein Backup und eine Wiederherstellung durchführen, sodass Sie keine Beiträge verlieren. Es ist nicht so schwer, mit praktisch keiner Ausfallzeit zu tun, nur mit Lesezeit.
root@forum-app:/shared/postgres_data# du -sh
97G .
Ich würde es nicht schreibgeschützt machen, ich würde ein Banner anbringen, das den Leuten sagt, dass ihre heutigen Beiträge flüchtig sind. Besser, sie darüber reden zu lassen, auch wenn diese Beiträge verloren gehen würden, meiner Meinung nach.
Bis dahin haben Sie auch Zugriff auf den integrierten Discourse-Chat, eine Funktion, die mit 2.9 ausgeliefert wird (möglicherweise standardmäßig deaktiviert, aber in der Betaversion und zur Nutzung unterstützt).