Upgrade failed: PostgreSQL version 13 ... not compatible with ... version 10.12

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

Now what should I do?

See PostgreSQL 13 update

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.

I will try reading the PostgreSQL 13 update page you kindly linked a couple more times.

But, on first couple readings … I am semi-totally lost. I have no idea which sections of that page might apply to my situation (if any).

For example, that PostgreSQL 13 update page is (reasonably enough, I suppose) focused on upgrading PostgreSQL 12 to 13. My error message:

The data directory was initialized by PostgreSQL version 13, which is not compatible with this version 10.12 (Debian 10.12-2.pgdg100+1).

speaks of version 10.12 … is that PostgreSQL 10, or is it PostgreSQL 12 (I would normally read “10.12” as being primarily 10, not 12).

Aha - my file:

/var/discourse/shared/standalone/postgres_data_old/PG_VERSION

has the value “10”.

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.

This comment, which I randomly stumbled on just how:

“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.

2 Likes

Ah. Sorry I didn’t think to tell you what I told that guy!

:tada: Great! So glad you got it!

Yeah. That might be the only other thing you need to know. :slight_smile:

Glad you’re back up!

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.