Skip to content

Conversation

@brandon1024
Copy link

Summary

This revision bumps postgres from version 14 to the latest supported release, version 18. In version 18, the format of the persistent storage volume changed to improve ease of database upgrades. To accomodate this, the volume mounts for the postgres service in docker compose was adjusted. Refer to the upstream documentation for more details.

Additionally, mattermost was upgraded to the latest patch release 10.11.7 which includes some low- to medium-severity security fixes.

I've tested this in my personal environment for a few weeks, works well :-)

Ticket Link

None.

@brandon1024
Copy link
Author

brandon1024 commented Nov 17, 2025

Just to offer a bit of background on this change, I had originally deployed mattermost in my environment using the old postgres version listed here, but eventually wanted to upgrade to stay ahead in the postgres release cycle. Upgrading postgres is a bit of a pain, but the changes introduced in version 18 of the upstream docker image will make that much easier going forward.

Important Change: the PGDATA environment variable of the image was changed to be version specific in PostgreSQL 18 and above⁠. For 18 it is /var/lib/postgresql/18/docker. Later versions will replace 18 with their respective major version (e.g., /var/lib/postgresql/19/docker for PostgreSQL 19.x). Mounts and volumes should be targeted at the updated location. This will allow users upgrading between PostgreSQL major releases to use the faster --link when running pg_upgrade and mounting /var/lib/postgresql.

I figured I'd contribute that back to the community so that future upgrades are either for all.

Thanks for the awesome platform, I've been really enjoying mattermost!

@mattermost-build
Copy link

This PR has been automatically labelled "stale" because it hasn't had recent activity.
A core team member will check in on the status of the PR to help with questions.
Thank you for your contribution!

@brandon1024
Copy link
Author

Not stale -- just waiting for review from a maintainer :-)

/cc @amyblais

@amyblais amyblais added the 2: Dev Review Requires review by a core committer label Dec 1, 2025
@amyblais amyblais requested a review from hanzei December 1, 2025 08:30
@hanzei hanzei requested a review from NARSimoes December 1, 2025 08:32
This revision bumps postgres from version 14 to the latest supported
release, version 18. In version 18, the format of the persistent storage
volume changed to improve ease of database upgrades. To accomodate this,
the volume mounts for the postgres service in docker compose was
adjusted. Refer to the upstream documentation for more details.

Additionally, mattermost was upgraded to the latest patch release
10.11.7 which includes some low- to medium-severity security fixes.
@hanzei hanzei removed their request for review December 1, 2025 11:08
Copy link

@NARSimoes NARSimoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for submitting the change. I just have a minor comment for clarification, but otherwise looks good.

## user to connect to the database.
## A guide on how to change the database user to a nonsuperuser can be found in docs/creation-of-nonsuperuser.md
POSTGRES_IMAGE_TAG=14-alpine
POSTGRES_IMAGE_TAG=18-alpine

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the update to pg 18, the docker-compose.yml file needs be modified to accommodate the POSTGRES_DATA_PATH change (which is done). Should we add a note here (or elsewhere) to inform and warn users who may be still using previous versions ? Asking @hanzei for advice.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct yeah, anyone using the postgres image prior to version 17 will need to adjust their volume mounts. Folks on older postgres versions looking to upgrade will have to refer to the upstream guide, since db upgrades are not automatic nor trivial.

Adding a note here doesn't hurt though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference, the related PR is docker-library/postgres#1259.

For anyone upgrading from an older version, the change in PGDATA requires a manual migration. That is a major trap. Given that pg 18 is just out for 3 months, I'm leaning towards only upgrading to v17 and kicking that can down the road.

v17 is already quite new for pg standards.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you’re saying, and I don’t totally disagree, but a postgres upgrade is manual no matter how you look at it. Even if you’re migrating from 16 to 17, you’ll need to dump the database, spin up a fresh instance and then import. There are fancier ways of course, but the process is always the same. At least with 18, future upgrades are much easier to carry out.

If a user happened to bump the version to 18 without changing the mount points, it’s not catastrophic. It’ll just spin up a fresh database in another directory. But that’s besides the point, this change here mainly benefits the users starting with a fresh deployment of mm, making it easier to perform upgrades later on. Anyone looking to upgrade should always refer to the mm documentation.

I don’t know, Postgres is historically very stable, and they have already released their second minor release. No issues in my environment for a few months now.

@mattermost-build
Copy link

This PR has been automatically labelled "stale" because it hasn't had recent activity.
A core team member will check in on the status of the PR to help with questions.
Thank you for your contribution!

@brandon1024
Copy link
Author

Still active, just awaiting review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2: Dev Review Requires review by a core committer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants