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.
Un altro modo per risolvere il problema dell’aggiornamento con spazio limitato è eseguire un backup, eliminare la directory postgres con rm -r, ricrearla e quindi ripristinare il backup. L’ho fatto su un sito la scorsa settimana.
No, non è mai stato aggiornato. Eliminare il database e ripristinare il backup sembra piuttosto rischioso. Abbiamo bisogno che l’aggiornamento sul posto funzioni, fondamentalmente.
Stiamo eseguendo Ubuntu 18.04 che verrà dismesso nel 2023, quindi immagino che a quel punto non avremo altra scelta che migrare su un nuovo host, e prevediamo di affrontare il problema allora, costruire un nuovo host con Ubuntu 22.04 LTS e ripristinare dal backup.
Hmm. Potrebbe essere un lavaggio. Penso che con il modello di backup una delle copie sia compressa, il che potrebbe fare la differenza? E il sito su cui l’ho fatto aveva backup su S3. Ed era un sito di test, quindi la posta in gioco era bassa se c’era un problema.
Tranne che i backup vengono utilizzati molto più spesso in molte più situazioni rispetto all’aggiornamento sul posto. Lo considero molto più sicuro.
Forse, ma non ho molta esperienza con postgres e non mi sento a mio agio a farlo. Ripristinare l’intero sito dal backup su una VM completamente diversa, quello mi sento a mio agio a farlo, tuttavia significherebbe perdere post per quante ore ci vorranno per ripristinare, quindi non sono nemmeno super entusiasta di questo. Ma dato che 18.04 non sarà più supportato, non avrò molta scelta l’anno prossimo.
A meno che il tuo database non sia di decine di gigabyte, non ci vorranno ore. E metterai il forum in modalità di sola lettura prima di eseguire il backup e il ripristino, quindi non perderai alcun post. Non è così difficile da fare con tempi di inattività virtualmente nulli, solo tempi di sola lettura.
root@forum-app:/shared/postgres_data# du -sh
97G .
Non lo metterei in sola lettura, ma piuttosto visualizzerei un banner che avvisa le persone che i loro post di oggi sono effimeri. Meglio lasciarli chattare anche se quei post andrebbero persi, secondo me.
A quel punto avrai accesso anche alla chat integrata di Discourse, una funzionalità che verrà rilasciata con la versione 2.9 (possibilmente disattivata per impostazione predefinita, ma in beta e supportata per l’uso).