Skip to content

Fix non-working migration instructions#9017

Open
tpo wants to merge 1 commit into
mattermost:masterfrom
tpo:patch-1
Open

Fix non-working migration instructions#9017
tpo wants to merge 1 commit into
mattermost:masterfrom
tpo:patch-1

Conversation

@tpo

@tpo tpo commented Jun 9, 2026

Copy link
Copy Markdown

Summary

Fix not working instructions: sudo user -- command doesn't do what the author thought it does.

root@gitlab ~ # sudo gitlab-psql -- id
psql: error: connection to server on socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432" failed: FATAL:  Peer authentication failed for user "id"

root@gitlab ~ # sudo -u gitlab-psql -- id
uid=998(gitlab-psql) gid=1003(gitlab-psql) groups=1003(gitlab-psql)

```
root@gitlab ~ # sudo gitlab-psql -- id
psql: error: connection to server on socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432" failed: FATAL:  Peer authentication failed for user "id"

root@gitlab ~ # sudo -u gitlab-psql -- id
uid=998(gitlab-psql) gid=1003(gitlab-psql) groups=1003(gitlab-psql)
``
@mattermost-build

Copy link
Copy Markdown
Contributor

Hello @tpo,

Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here.

Per the Mattermost Contribution Guide, we need to add you to the list of approved contributors for the Mattermost project.

Please help complete the Mattermost contribution license agreement?
Once you have signed the CLA, please comment with /check-cla and confirm that the CLA check is green.

This is a standard procedure for many open source projects.

Please let us know if you have any questions.

We are very happy to have you join our growing community! If you're not yet a member, please consider joining our Contributors community channel to meet other contributors and discuss new opportunities with the core team.

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Documentation update for GitLab Omnibus Mattermost migration: the PostgreSQL database dump command syntax was corrected to use sudo -u gitlab-psql -- instead of sudo gitlab-psql --, ensuring proper user privilege handling when running pg_dump.

Changes

GitLab Omnibus Migration Documentation

Layer / File(s) Summary
PostgreSQL dump command syntax correction
source/administration-guide/onboard/migrate-gitlab-omnibus.rst
The pg_dump command invocation corrects the user privilege syntax from sudo gitlab-psql -- to sudo -u gitlab-psql -- for proper user context execution.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: fixing non-working migration instructions for the GitLab Omnibus database dump command.
Description check ✅ Passed The description is directly related to the changeset, providing specific examples demonstrating the issue with the original command syntax and why it was incorrect.
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

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
source/administration-guide/onboard/migrate-gitlab-omnibus.rst (1)

73-73: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Avoid documenting an insecure DB TLS default without environment scoping

"sslmode=disable" normalizes an insecure production posture unless explicitly scoped to local/test-only usage. Please provide a secure default (for example require/verify-full) and clearly mark any disable example as non-production only.

Suggested minimal diff
-       "DataSource": "postgres://mmuser:password@new-postgres-server:5432/mattermost?sslmode=disable&connect_timeout=10"
+       "DataSource": "postgres://mmuser:password@new-postgres-server:5432/mattermost?sslmode=require&connect_timeout=10"

As per coding guidelines, documentation must not normalize insecure defaults and must distinguish test shortcuts from production security guidance.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@source/administration-guide/onboard/migrate-gitlab-omnibus.rst` at line 73,
Replace the insecure example value for "DataSource" that sets sslmode=disable
with a secure default (e.g., sslmode=require or sslmode=verify-full) and
explicitly annotate any sslmode=disable example as "for local/testing only" so
readers know it is non-production; update the "DataSource" example string and
the surrounding explanatory text to show the secure default and include a short
note clarifying that disabling TLS is only for test/dev environments.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@source/administration-guide/onboard/migrate-gitlab-omnibus.rst`:
- Line 40: The dump step writes a date-stamped file named
mattermost_dbdump_$(date --rfc-3339=date).sql.gz but the restore step expects
/tmp/mattermost_dbdump.sql.gz; update the instructions so the filenames/paths
match by either changing the dump command to write /tmp/mattermost_dbdump.sql.gz
(remove the date suffix and set /tmp/) or change the restore step to point at
the generated mattermost_dbdump_YYYY-MM-DD.sql.gz filename; ensure the example
uses the exact same filename token (mattermost_dbdump_$(date
--rfc-3339=date).sql.gz) or a fixed /tmp/mattermost_dbdump.sql.gz in both steps
for clarity and reliability.

---

Outside diff comments:
In `@source/administration-guide/onboard/migrate-gitlab-omnibus.rst`:
- Line 73: Replace the insecure example value for "DataSource" that sets
sslmode=disable with a secure default (e.g., sslmode=require or
sslmode=verify-full) and explicitly annotate any sslmode=disable example as "for
local/testing only" so readers know it is non-production; update the
"DataSource" example string and the surrounding explanatory text to show the
secure default and include a short note clarifying that disabling TLS is only
for test/dev environments.
🪄 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: 31413700-d0e1-4c06-84a7-4271b6b46824

📥 Commits

Reviewing files that changed from the base of the PR and between f3d0b0a and 4edf4bb.

📒 Files selected for processing (1)
  • source/administration-guide/onboard/migrate-gitlab-omnibus.rst

.. code-block:: bash

sudo gitlab-psql -- /opt/gitlab/embedded/bin/pg_dump -h /var/opt/gitlab/postgresql --no-owner mattermost_production | gzip > mattermost_dbdump_$(date --rfc-3339=date).sql.gz
sudo -u gitlab-psql -- /opt/gitlab/embedded/bin/pg_dump -h /var/opt/gitlab/postgresql --no-owner mattermost_production | gzip > mattermost_dbdump_$(date --rfc-3339=date).sql.gz

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Fix dump filename/path mismatch with restore step

The dump command writes mattermost_dbdump_YYYY-MM-DD.sql.gz in the current directory, but Step 3 restores /tmp/mattermost_dbdump.sql.gz. Following this as written can fail at restore time.

Suggested minimal diff
-   sudo -u gitlab-psql -- /opt/gitlab/embedded/bin/pg_dump -h /var/opt/gitlab/postgresql --no-owner mattermost_production | gzip > mattermost_dbdump_$(date --rfc-3339=date).sql.gz
+   sudo -u gitlab-psql -- /opt/gitlab/embedded/bin/pg_dump -h /var/opt/gitlab/postgresql --no-owner mattermost_production | gzip > /tmp/mattermost_dbdump.sql.gz

As per coding guidelines, procedural steps must be clear, atomic, and likely to work as written for novice administrators.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
sudo -u gitlab-psql -- /opt/gitlab/embedded/bin/pg_dump -h /var/opt/gitlab/postgresql --no-owner mattermost_production | gzip > mattermost_dbdump_$(date --rfc-3339=date).sql.gz
sudo -u gitlab-psql -- /opt/gitlab/embedded/bin/pg_dump -h /var/opt/gitlab/postgresql --no-owner mattermost_production | gzip > /tmp/mattermost_dbdump.sql.gz
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@source/administration-guide/onboard/migrate-gitlab-omnibus.rst` at line 40,
The dump step writes a date-stamped file named mattermost_dbdump_$(date
--rfc-3339=date).sql.gz but the restore step expects
/tmp/mattermost_dbdump.sql.gz; update the instructions so the filenames/paths
match by either changing the dump command to write /tmp/mattermost_dbdump.sql.gz
(remove the date suffix and set /tmp/) or change the restore step to point at
the generated mattermost_dbdump_YYYY-MM-DD.sql.gz filename; ensure the example
uses the exact same filename token (mattermost_dbdump_$(date
--rfc-3339=date).sql.gz) or a fixed /tmp/mattermost_dbdump.sql.gz in both steps
for clarity and reliability.

Source: Coding guidelines

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants