Old Postgres on Docker Image with two containers: web and data

Hi All,

I’m stuck trying to upgrade a docker Discourse instance. I get the following error when I attempt to rebuild, bootstrap or in any other way setup the container:

I, [2020-11-18T15:23:37.357104 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake plugin:pull_compatible_all'
I, [2020-11-18T15:23:40.298932 #1]  INFO -- : discourse-slack-official is already at latest compatible version
docker_manager is already at latest compatible version

I, [2020-11-18T15:23:40.299193 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
rake aborted!
StandardError: An error has occurred, all later migrations canceled:

PG::SyntaxError: ERROR:  syntax error at or near "NOT"
LINE 2: ADD COLUMN IF NOT EXISTS image_upload_id bigint
                      ^

From investigating, it seems like postgresql 12 is required for the latest discourse but this currently isn’t packaged in the official docker image.

It looks like there’s a development branch in the repo for building the container with postgres12 but no outstanding PRs or anything…

How can I go about fixing/updating my discourse installation? The update path is incorrect and now I’m fighting to get the forums back up asap!

2 Likes

Additional note: the pg12 branch also doesn’t work (even though it does seem to try and download a different container version), still getting the same error on db:migrate…

That is not the case. The base image for Discourse ships with PostgreSQL for many months already, since PostgreSQL 12 update.

Can you share you app.yml? Maybe you forced an old base image in it and forgout about it?

2 Likes

How old is your discourse_docker checkout? I know the launcher script is meant to update itself automatically, but iIt might be worth running git pull by hand just to be sure.

The latest base image should be:

image="discourse/base:2.0.20201004-2310"

What do you get if you run

docker images | grep discourse/base

Also that plugin was deprecated 3 years ago :scream:

2 Likes

Strange, I’m on the latest commit:

$ git branch -v
* master 4a4b0f8 DOCS: correct syntax error in readme

And I seem to have the latest image:

$ docker images
REPOSITORY             TAG                 IMAGE ID            CREATED             SIZE
discourse/base         2.0.20201004-2310   b64c37d7ab06        6 weeks ago         2.4GB
local_discourse/data   latest              253fd4d68068        3 years ago         1.7GB

I’ve been sure to clear up old docker images and have attempted a rebuild of the web app multiple times.

Ahhh, do I need to rebuild the data container first or something? Haven’t touched it yet

Also that plugin was deprecated 3 years ago :scream:

:see_no_evil: that’s next on my list to bring up-to-date but have been stuck with current update!

Oh you are using the advanced data setup?

You need to stop web and rebuild data to get all data software updated. There is a section for that in PostgreSQL 12 update

8 Likes

Thanks for your help, rebuilding the data container now…

Okay that seems to have done it, thanks again all!

This is the sort of burn to be expected from inheriting a discourse installation and doing an upgrade for the first time :sweat_smile:

4 Likes

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