I have a little forum, themooster.net, based on Discourse that I had not upgraded in a couple of months.
I clicked “Update” in the “Admin” recommendation to upgrade, and it said I had to do the upgrade at the shell prompt instead, and gave me three lines to run:
cd /var/discourse
git pull
./launcher rebuild app
I ran those three commands. The “rebuild app” failed initially, because I didn’t have 5 GByte free on my little linode box, so I added more disk space and the “rebuild app” seemed to complete ok.
But the site didn’t come back up.
I looked around, rebooted, still not coming up, looked around a bit more.
Seems that the frontend nginx is coming up ok, but when I try to access my forum over the web, like a normal user, I get a " 502 Bad Gateway" error from the nginx frontend.
The file “/var/discourse/shared/standalone/log/var-log/postgres/current” is filled with errors such as:
2021-04-17 13:54:37.785 UTC [7095] FATAL: database files are incompatible with server
2021-04-17 13:54:37.785 UTC [7095] DETAIL: The data directory was initialized by PostgreSQL version 13, which is not compatible with this version 10.12 (Debian 10.12-2.pgdg100+1).
I have good backups of the forum in my directory:
/var/discourse/shared/standalone/backups/default
I’ll look at your PostgreSQL 13 link now - thanks.
Is there someway I should have, could have, known of this complication, without being a full time admin constantly following the activity of the key technologies (PostgreSQL, Ruby, Linux, …) behind Discourse?
If so, then could the 3 lines of instruction (cd /var/discouse; …) have another line “Warning: check here first for other information that might apply.”) ?
If not, then Discourse should be more open about it not being well suited for casual use.
So the above PostgreSQL 13 link, to the extent that it applies to a 12 ==> 13 upgrade, is NOT necessarily relevant, so far as I know (which is not far at all.)
I am having a really bad feeling about this … like trying to fix live military munitions, in a dark cave, without instructions, untrained, and not even being sure what kind of munitions I’m working on.
“You should rebuild again. My guess is that you ignored a message about the postgres upgrade.”
Got me thinking that I should try the “cd /var/discourse; git pull; ./launcher rebuild app” again … apparently that “rebuild” can be tried multiple times.
I captured the output this time. I GUARANTEE that I have ignored most of the messages in the output, however. There are 2020 lines of output from the “./launcher rebuild app” command alone. It would take me a month of Sundays to learn what all programs are running and what their output messages mean. There is no practical way for me to know if I am ignoring something critical in that output.
However …
It Worked !!
My website came back up, running the current version of software.
So the lesson for the day: If the “./launcher rebuild app” command fails to provide a working site, try it again.