Supported postgresql versions

Is there somewhere a note, which postgresql db versions are supported?

Would be great to have something for each released discourse version - especially if a postgresql version is no longer supported.

Postgres is bundled in with the Docker container for Discourse, so this is generally hands-off. The Discourse team upgrades the Postgres version as new releases come out and they are properly tested. The most recent upgrade was to version 13. You can see the details of that upgrade here:

3 Likes

Well, not everyone is using the bundled postgres db.

The current install doc lists Postgres 10+ as the required version:

https://github.com/discourse/discourse/blob/master/docs/INSTALL.md

That said, the only officially supported setups are using Docker containers.

2 Likes

Yes, the versions of postgres which are “supported” (from a docker build perspective, not all “strongly supported”) are listed in the templates directory of discourse_docker

Having said that, it is highly recommended to move to the latest version of postgres, currently version 13, as soon as you can.

However, if you are running Discourse on a host where you cannot run the latest version because of some local constraint in your organization; the discourse_docker templates directory is a good place to research.

4 Likes

Checking in three years later: The docker template still says PG_MAJOR=13, but there are new versions of PostgreSQL: 14 from 2021, 15 from 2022, and 16 from 2023.

So the recommendation is still to use version 13 (which will EOL in 2025) rather than the latest PostgreSQL 16 (which will EOL in 2028)?

Yes, exactly.

We have some sites running version 15 already, and should get to updating from 13 next year.

1 Like

Question: what is the current status here? I am running an external pg database and would like to upgrade the database server from 13. postgres 16 was released 2023-09-14. Can it be used with discourse? Will there be any migration steps required for the database itself? (aside from the global migration steps on the server side)

PostgreSQL 13 is still the officially supported version, with version 13.15 being released last month and still supported.

We have a good number of sites running version 15, and that is a known working version that we plan on shipping an update for self-hosted users eventually.

Version 16 is not widely tested outside of developer machines, but if you are feeling adventurous and want to give it a try and see if something breaks, let us know how it goes!

1 Like

Does Discourse do anything out of the ordinary with Postgres which would imply that upgrades to new versions of Postgres might not work with a simple dump and restore?

Bumping up this thread to see if there is a reason to try to upgrade to PostgreSQL 15 instead of 16 or 17?

And when should we expect to upgrade the PostgreSQL

Hey guys, just moved to AWS RDS PostGre 16.4 and it seems to be working.

I´m on discourse version 3.4.0.beta3-dev

Didn´t press on all buttons, yet :slight_smile: , but the board itself seems to be working, but…

I can´t create backups, due to

[2024-12-13 08:36:07] Making sure '/var/www/discourse/tmp/backups/default/2024-12-13-083607' exists...
[2024-12-13 08:36:07] Making sure '/var/www/discourse/public/backups/default' exists...
[2024-12-13 08:36:07] Updating metadata...
[2024-12-13 08:36:07] Dumping the public schema of the database...
[2024-12-13 08:36:08] pg_dump: error: server version: 16.4; pg_dump version: 13.18 (Debian 13.18-1.pgdg120+1)
[2024-12-13 08:36:08] pg_dump: error: aborting because of server version mismatch
[2024-12-13 08:36:08] EXCEPTION: pg_dump failed

strange thing is, that I could actually import the data with internal mechanisms:

What I did:

  1. Set up db (user, database, grants)
  2. Configured stuff in app.yml
  3. Created backup from within discourse
  4. Rebuild app (db migration was successful → db is empty then)
  5. Restored backup from within container (launcher enter app, discourse enable_restore, discourse restore …)
  6. Finished (all successful, and everything seemed to be working, until I tried to create a new backup :slight_smile: )

any chance to tackle this somehow ?

Greetings,

JP

1 Like

Ok guys, now it´s getting interesting.
I wasn´t working for a few days and didn´t check our new company board.

When I checkded today, the scheduled backup worked, then I tried to do the manual backup again, and that failed :thinking:

scheduled:

Dumping the public schema of the database...
[2024-12-04 06:02:16] pg_dump: last built-in OID is 16383
[2024-12-04 06:02:16] pg_dump: reading extensions
[2024-12-04 06:02:16] pg_dump: identifying extension members
[2024-12-04 06:02:16] pg_dump: reading schemas
[2024-12-04 06:02:16] pg_dump: reading user-defined tables
[2024-12-04 06:02:16] pg_dump: reading user-defined functions
[2024-12-04 06:02:16] pg_dump: reading user-defined types
......
pg_dump: dumping contents of table "public.themes"
[2024-12-04 06:02:19] pg_dump: processing data for table "public.top_topics"
[2024-12-04 06:02:19] pg_dump: dumping contents of table "public.top_topics"
[2024-12-04 06:02:19] Finalizing backup...
[2024-12-04 06:02:19] Creating archive: scp-talk-2024-12-04-060216-v20241127034553.tar.gz
[2024-12-04 06:02:19] Making sure archive does not already exist...
[2024-12-04 06:02:19] Creating empty archive...
[2024-12-04 06:02:19] Archiving data dump...
[2024-12-04 06:02:19] Archiving uploads...
[2024-12-04 06:02:19] Removing tmp '/var/www/discourse/tmp/backups/default/2024-12-04-060216' directory...
[2024-12-04 06:02:19] Gzipping archive, this may take a while...
[2024-12-04 06:02:19] Executing the after_create_hook for the backup...
[2024-12-04 06:02:19] Deleting old backups...
[2024-12-04 06:02:19] Cleaning stuff up...
[2024-12-04 06:02:19] Removing '.tar' leftovers...
[2024-12-04 06:02:19] Marking backup as finished...
[2024-12-04 06:02:19] Refreshing disk stats...
[2024-12-04 06:02:19] Notifying '<me>' of the end of the backup...

manual:

[2024-12-16 10:03:54] '<me>' has started the backup!
[2024-12-16 10:03:54] Marking backup as running...
[2024-12-16 10:03:54] Making sure '/var/www/discourse/tmp/backups/default/2024-12-16-100354' exists...
[2024-12-16 10:03:54] Making sure '/var/www/discourse/public/backups/default' exists...
[2024-12-16 10:03:54] Updating metadata...
[2024-12-16 10:03:54] Dumping the public schema of the database...
[2024-12-16 10:03:54] pg_dump: error: server version: 16.4; pg_dump version: 13.18 (Debian 13.18-1.pgdg120+1)
[2024-12-16 10:03:54] pg_dump: error: aborting because of server version mismatch
[2024-12-16 10:03:54] EXCEPTION: pg_dump failed

hmmmmm, any ideas ?

Very strange :frowning:

I confirm that upgrading to 3.4.0.beta3 with external database makes backup fail.

I have two instances 3.4.0.beta3 (tag): 1) with Postgres-in-Docker (default); 2) with external Postgres (local self-hosted).

The first is able to backup both by schedule and by hands:

[2024-12-23 11:11:43] Marking backup as running...
[2024-12-23 11:11:44] Making sure '/var/www/discourse/tmp/backups/default/2024-12-23-111143' exists...
[2024-12-23 11:11:44] Making sure '/var/www/discourse/public/backups/default' exists...
[2024-12-23 11:11:44] Updating metadata...
[2024-12-23 11:11:44] Dumping the public schema of the database...
[2024-12-23 11:11:44] pg_dump: last built-in OID is 16383
[2024-12-23 11:11:44] pg_dump: reading extensions
[2024-12-23 11:11:44] pg_dump: identifying extension members
[2024-12-23 11:11:44] pg_dump: reading schemas
...

The second one fails:

[2024-12-21 03:35:21] Marking backup as running...
[2024-12-21 03:35:21] Making sure '/var/www/discourse/tmp/backups/default/2024-12-21-033521' exists...
[2024-12-21 03:35:21] Making sure '/var/www/discourse/public/backups/default' exists...
[2024-12-21 03:35:21] Updating metadata...
[2024-12-21 03:35:21] Dumping the public schema of the database...
[2024-12-21 03:35:22] pg_dump: error: server version: 16.6 (Ubuntu 16.6-0ubuntu0.24.04.1); pg_dump version: 13.18 (Debian 13.18-1.pgdg120+1)
[2024-12-21 03:35:22] pg_dump: error: aborting because of server version mismatch
[2024-12-21 03:35:22] EXCEPTION: pg_dump failed
...
1 Like

I upgraded yesterday and confirm the scheduled backups fail due to version mis-match.

You can fix by entering docker and installing a newer postgresql-client.

/var/discourse/launcher enter app
apt update
apt install postgresql-client
1 Like