Skip to content

Add PostgreSQL upgrade guide#8894

Merged
hanzei merged 7 commits intomasterfrom
worktree-lexical-churning-giraffe
Apr 26, 2026
Merged

Add PostgreSQL upgrade guide#8894
hanzei merged 7 commits intomasterfrom
worktree-lexical-churning-giraffe

Conversation

@hanzei
Copy link
Copy Markdown
Contributor

@hanzei hanzei commented Apr 15, 2026

Summary

We had frequent questions from customer on how to update their Postgres cluster. This document aims to cover that gap. It cover both https://github.com/mattermost/docker and a standalone postgres server. Cluster upgrade are not covered as they are too complex for ours docs. These setups get managed by specialized DBAs.

AI Summary

  • Adds a new page upgrading-postgres.rst under the upgrade section covering how admins should upgrade their PostgreSQL server
  • Covers bare-metal upgrades via pg_upgrade and pg_dump/pg_restore, and Docker-based upgrades
  • Moves the ANALYZE VERBOSE post-upgrade note from preparations.rst into the new page and replaces it with a cross-reference
  • Registers the new page in the upgrade section toctree and index

Test plan

  • Verify the new page renders correctly under "Upgrade Mattermost" in the sidebar
  • Verify the cross-reference in preparations.rst resolves to the new page
  • Check that the ANALYZE VERBOSE callout no longer appears on the preparations page
  • Run make linkcheck to confirm no broken links

🤖 Generated with Claude Code

Add a dedicated page covering how admins should upgrade their PostgreSQL
server, including bare-metal (pg_upgrade and pg_dump/pg_restore) and
Docker-based approaches. Move the ANALYZE VERBOSE post-upgrade note from
preparations.rst into the new page and replace it with a cross-reference.
Register the new page in the upgrade section toctree.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

Newest code from mattermost has been published to preview environment for Git SHA 041050b

hanzei and others added 3 commits April 15, 2026 15:06
Add a notice that the Docker upgrade steps target the official
Mattermost Docker deployment at https://github.com/mattermost/docker.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Update the Docker upgrade guide to use the .env variable
POSTGRES_IMAGE_TAG rather than editing docker-compose.yml directly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

Newest code from mattermost has been published to preview environment for Git SHA d470a77

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 15, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9d18a097-0185-4427-ab77-10f13c2547a7

📥 Commits

Reviewing files that changed from the base of the PR and between fe82d1a and 2bbb2e8.

📒 Files selected for processing (1)
  • source/deployment-guide/server/preparations.rst
✅ Files skipped from review due to trivial changes (1)
  • source/deployment-guide/server/preparations.rst

📝 Walkthrough

Walkthrough

Adds a new "Upgrading PostgreSQL" administration guide page and links to it from the Upgrade Mattermost guide; updates deployment preparations to replace an important admonition with a note that references the new PostgreSQL upgrade documentation. No code changes.

Changes

Cohort / File(s) Summary
Upgrade guide entry
source/administration-guide/upgrade-mattermost.rst
Inserted new hidden toctree entry and added a visible bullet linking to the new PostgreSQL upgrade page.
PostgreSQL upgrade doc
source/administration-guide/upgrade/upgrading-postgres.rst
Added a new page describing pre-upgrade requirements and three upgrade workflows (pg_upgrade in-place, pg_dump/pg_restore logical, Docker-specific), plus post-upgrade steps.
Deployment preparations note
source/deployment-guide/server/preparations.rst
Replaced an .. important:: admonition about running ANALYZE VERBOSE after a major Postgres upgrade with a .. note:: pointing to the new PostgreSQL upgrade documentation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

Contributor

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add PostgreSQL upgrade guide' directly and clearly summarizes the main change: adding new documentation for PostgreSQL upgrades.
Description check ✅ Passed The description comprehensively relates to the changeset, explaining the rationale for the new PostgreSQL upgrade guide, the coverage of different upgrade methods, and the documentation reorganization.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch worktree-lexical-churning-giraffe

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
source/administration-guide/upgrade/upgrading-postgres.rst (1)

14-19: Add quick success checks after key operations

For Novice Nate, the procedure is clear but lacks explicit verification points after stop/restore/start actions. Add short “Expected result” checks (service status, DB version, restore completion) to reduce uncertainty.

As per coding guidelines, "Include expected output or success checks after key steps to help readers verify progress."

Also applies to: 34-83, 93-133

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@source/administration-guide/upgrade/upgrading-postgres.rst` around lines 14 -
19, Add explicit "Expected result" verification lines after each key step
(specifically after "Back up your database", "Check supported versions", and
"Stop Mattermost" and similar steps in ranges 34-83 and 93-133) that state what
to check (e.g., backup completed message or file exists, PostgreSQL target
version reported by psql --version or SELECT version(), Mattermost service is
inactive via systemctl status or ps output, and restore completion
confirmation), and place them immediately below the corresponding step text so
Novice Nate can verify success before proceeding.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@source/administration-guide/upgrade/upgrading-postgres.rst`:
- Around line 111-122: Replace the incorrect container restart instruction
"docker start db" with a command that recreates the container from the updated
compose file so the new image tag is applied; update the step that currently
references docker start (text mentioning "Start the new PostgreSQL container"
and the command "docker start db") to instruct using docker compose up -d
--force-recreate db (or equivalent compose up command) so the container is
recreated with the new PostgreSQL image and the updated docker-compose.yml is
applied.

In `@source/deployment-guide/server/preparations.rst`:
- Around line 122-124: The advisory uses a low-severity admonition (".. note::")
for a major PostgreSQL upgrade redirect; change the directive to a
higher-severity admonition by replacing the ".. note::" token with "..
important::" in the same block so the guidance about upgrading a major version
of PostgreSQL is surfaced as high-impact information.

---

Nitpick comments:
In `@source/administration-guide/upgrade/upgrading-postgres.rst`:
- Around line 14-19: Add explicit "Expected result" verification lines after
each key step (specifically after "Back up your database", "Check supported
versions", and "Stop Mattermost" and similar steps in ranges 34-83 and 93-133)
that state what to check (e.g., backup completed message or file exists,
PostgreSQL target version reported by psql --version or SELECT version(),
Mattermost service is inactive via systemctl status or ps output, and restore
completion confirmation), and place them immediately below the corresponding
step text so Novice Nate can verify success before proceeding.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f54fc339-da90-4bae-b80c-efd37ca78e33

📥 Commits

Reviewing files that changed from the base of the PR and between 80e869f and d470a77.

📒 Files selected for processing (3)
  • source/administration-guide/upgrade-mattermost.rst
  • source/administration-guide/upgrade/upgrading-postgres.rst
  • source/deployment-guide/server/preparations.rst

Comment thread source/administration-guide/upgrade/upgrading-postgres.rst Outdated
Comment thread source/deployment-guide/server/preparations.rst Outdated
@github-actions
Copy link
Copy Markdown
Contributor

Newest code from mattermost has been published to preview environment for Git SHA 3d56d01

- Replace "docker start postgres" with "docker compose up -d --force-recreate
  postgres" so the container is recreated with the updated image tag from .env
- Promote the PostgreSQL upgrade cross-reference in preparations.rst from
  ".. note::" to ".. important::" to reflect its high-impact nature

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@hanzei hanzei requested a review from agarciamontoro April 15, 2026 13:14
@hanzei hanzei added the 1: Dev Review Requires review by a core commiter label Apr 15, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Newest code from mattermost has been published to preview environment for Git SHA fe82d1a

@hanzei hanzei added the 2: Editor Review Requires review by an editor label Apr 15, 2026
Copy link
Copy Markdown
Member

@agarciamontoro agarciamontoro left a comment

Choose a reason for hiding this comment

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

Looks good! Succinct and to the point, thank you!

@hanzei hanzei requested a review from esethna April 16, 2026 07:27
@esethna
Copy link
Copy Markdown
Contributor

esethna commented Apr 16, 2026

Thanks @hanzei! @Combs7th do you want to give this a pass first?

@esethna esethna requested a review from Combs7th April 16, 2026 14:43
@esethna esethna removed the 1: Dev Review Requires review by a core commiter label Apr 16, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Newest code from mattermost has been published to preview environment for Git SHA 2bbb2e8

Copy link
Copy Markdown
Contributor

@Combs7th Combs7th left a comment

Choose a reason for hiding this comment

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

LGTM

@hanzei hanzei merged commit 67012b5 into master Apr 26, 2026
5 checks passed
@hanzei hanzei deleted the worktree-lexical-churning-giraffe branch April 26, 2026 20:52
@github-actions
Copy link
Copy Markdown
Contributor

Newest code from mattermost has been published to preview environment for Git SHA 0dfba3c

@amyblais amyblais removed the 2: Editor Review Requires review by an editor label Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants