Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[guides] guides: Add postgres migration guidelines #6596

Merged
merged 11 commits into from
Aug 29, 2023
Merged

[guides] guides: Add postgres migration guidelines #6596

merged 11 commits into from
Aug 29, 2023

Conversation

isacikgoz
Copy link
Member

Summary

Add the initial version (exluding plugins) of MySQL to PostgreSQL migration guide.

Ticket Link

https://mattermost.atlassian.net/browse/MM-54161

@isacikgoz isacikgoz added 1: Dev Review Requires review by a core commiter 1: PM Review Requires review by a product manager 2: Editor Review Requires review by an editor labels Aug 17, 2023
@github-actions
Copy link

Newest code from isacikgoz has been published to preview environment for Git SHA c220510

Copy link
Contributor

@nab-77 nab-77 left a comment

Choose a reason for hiding this comment

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

@cwarnermm can we apply the new code theme to this page also?


Note that the migration guide only covers the tables for Mattermost channels, the support for other plugins such as Boards and Playbooks will be added in the future. Another exlusion we are making is in the ``db_migrations`` table which has a small difference (a typo in a single migration name) creates a diff. Since we created the Postgres schema with morph and the official mattermost source, we can consider to skip it safely. On the other hand, ``systems`` table may contain additional diffs if there was extra keys added during some of the migrations. Consider excluding ``systems`` table if you run into issues and do a manual comparison as the data in the ``systems`` table is relatively smaller in size.

Notes
Copy link
Contributor

Choose a reason for hiding this comment

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

Recommend we move this to the top after the intro but before we get into the steps.

Copy link
Member

Choose a reason for hiding this comment

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

Agreed. This becomes our TL;DR :)

Copy link
Member

@cwarnermm cwarnermm left a comment

Choose a reason for hiding this comment

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

This is a great docs PR, @isacikgoz!! I've provided editorial feedback inline for you to consider.

source/guides/postgres-migration.rst Outdated Show resolved Hide resolved
source/guides/postgres-migration.rst Outdated Show resolved Hide resolved
source/guides/postgres-migration.rst Outdated Show resolved Hide resolved
source/guides/postgres-migration.rst Outdated Show resolved Hide resolved
source/guides/postgres-migration.rst Outdated Show resolved Hide resolved
source/guides/postgres-migration.rst Outdated Show resolved Hide resolved
source/guides/postgres-migration.rst Outdated Show resolved Hide resolved
source/guides/postgres-migration.rst Outdated Show resolved Hide resolved

Note that the migration guide only covers the tables for Mattermost channels, the support for other plugins such as Boards and Playbooks will be added in the future. Another exlusion we are making is in the ``db_migrations`` table which has a small difference (a typo in a single migration name) creates a diff. Since we created the Postgres schema with morph and the official mattermost source, we can consider to skip it safely. On the other hand, ``systems`` table may contain additional diffs if there was extra keys added during some of the migrations. Consider excluding ``systems`` table if you run into issues and do a manual comparison as the data in the ``systems`` table is relatively smaller in size.

Notes
Copy link
Member

Choose a reason for hiding this comment

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

Agreed. This becomes our TL;DR :)

Notes
-----

Keep in mind that this migration guide primarily focuses on providing step-by-step instructions for the migration; however, it is essential to note that it does not encompass migration configurations for any plugins, such as Focalboard and Playbooks. If your system utilizes these plugins, we highly advise exercising patience until we incorporate the necessary configurations specifically tailored to ensure a smooth transition for those plugins as well.
Copy link
Member

Choose a reason for hiding this comment

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

This statement partially overlaps the statement above. Consider combining together to avoid content duplication.

@cwarnermm cwarnermm removed the 2: Editor Review Requires review by an editor label Aug 18, 2023
@cwarnermm
Copy link
Member

@cwarnermm can we apply the new code theme to this page also?

@nab-77 Yes! I'll refresh my memory on how that's achieved and apply it to this content.

@github-actions
Copy link

Newest code from cwarnermm has been published to preview environment for Git SHA ab17b6b

Co-authored-by: Carrie Warner (Mattermost) <[email protected]>
@github-actions
Copy link

Newest code from isacikgoz has been published to preview environment for Git SHA 3ebe2c3

source/guides/postgres-migration.rst Outdated Show resolved Hide resolved
source/guides/postgres-migration.rst Outdated Show resolved Hide resolved
source/guides/postgres-migration.rst Outdated Show resolved Hide resolved
@github-actions
Copy link

Newest code from isacikgoz has been published to preview environment for Git SHA 20ca30f

Copy link
Contributor

@nab-77 nab-77 left a comment

Choose a reason for hiding this comment

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

Few thoughts/ideas added.

.. code:: bash

pgLoader migration.load > migration.log

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to place a note here to remind users to run the commands to re-create the indexes as noted in lines 113/114?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, I can add that.

:backlinks: top
:local:
:depth: 1

Copy link
Contributor

Choose a reason for hiding this comment

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

I think a known issues table might be a good addition here.

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried to collect as much as known issues and tried to address "Schema diffs" section. I think we can add a section for known issues & troubleshooting once these gets accumulated.

--------------------

- Backup your MySQL data.
- Confirm your Mattermost version. See the **About** modal for details.
Copy link
Contributor

Choose a reason for hiding this comment

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

@isacikgoz do we have a min MM version we would recommend? I would certainly like to call out being on a supported ESR.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we can add that, for now it looks like the minimum support version is v6.4 ESR as we require morph based schema migrations. So if they have version before v6.4 they need to upgrade it first, then conduct the migration. Shall we add that info?

Copy link
Member Author

Choose a reason for hiding this comment

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

@nab-77 added a note 👍

- Confirm your Mattermost version. See the **About** modal for details.
- Determine the migration window needed. This process requires you to stop the Mattermost Server during the migration.
- See the `schema-diffs <#schema-diffs>`__ section to ensure data compatibility between schemas.
- Prepare your PostgreSQL environment by creating a database and user. See the `database </install/prepare-mattermost-database.html>`__ documentation for details.
Copy link
Contributor

Choose a reason for hiding this comment

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

@isacikgoz do we have a preference for pgsql version here? (outside of ensuring its a supported version).

Copy link
Member Author

Choose a reason for hiding this comment

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

I think minimum version that we support is fine, but the latest supported version would be our preference as far as I'm concerned. Do you think we should provide a specific version?


Once we set the schema to desired state, we can start migrating the **data** by running ``pgLoader`` \*\*

\*\* Use the following configuration for the baseline of the data migration:
Copy link
Contributor

Choose a reason for hiding this comment

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

@isacikgoz what are you thoughts on us providing the migration.load template for users to download/edit? Link here maybe?

Copy link
Member Author

Choose a reason for hiding this comment

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

The template is actually on the repo, being used by the workflow: https://github.com/mattermost/mattermost/blob/master/server/tests/template.load we can add the link here.

@github-actions
Copy link

Newest code from isacikgoz has been published to preview environment for Git SHA cfe431f

Copy link
Member

@cwarnermm cwarnermm left a comment

Choose a reason for hiding this comment

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

This is such a great addition to the docs! I've provided editorial feedback inline. Approving for expediency.

source/guides/postgres-migration.rst Outdated Show resolved Hide resolved
source/guides/postgres-migration.rst Outdated Show resolved Hide resolved
source/guides/postgres-migration.rst Outdated Show resolved Hide resolved
source/guides/postgres-migration.rst Outdated Show resolved Hide resolved
source/guides/postgres-migration.rst Outdated Show resolved Hide resolved
source/guides/postgres-migration.rst Outdated Show resolved Hide resolved
source/guides/postgres-migration.rst Outdated Show resolved Hide resolved
@cwarnermm
Copy link
Member

@isacikgoz - @nab-77 had requested that the commands and code samples follow our new approach in the docs, as seen in this screenshot:
image

The code block text is formatted using a special class called mm-code-block:

.. code-block:: none
  :class: mm-code-block 

    your command here

@github-actions
Copy link

Newest code from cwarnermm has been published to preview environment for Git SHA 54e0b49

Co-authored-by: Carrie Warner (Mattermost) <[email protected]>
@github-actions
Copy link

Newest code from isacikgoz has been published to preview environment for Git SHA 5c82614

@isacikgoz isacikgoz requested a review from nab-77 August 24, 2023 13:27
@github-actions
Copy link

Newest code from isacikgoz has been published to preview environment for Git SHA 4f040b4

Copy link
Contributor

@nab-77 nab-77 left a comment

Choose a reason for hiding this comment

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

@cwarnermm cwarnermm added 3: Reviews Complete All reviewers have approved the pull request and removed 1: Dev Review Requires review by a core commiter 1: PM Review Requires review by a product manager labels Aug 29, 2023
@cwarnermm cwarnermm merged commit a66272c into master Aug 29, 2023
3 checks passed
@cwarnermm cwarnermm deleted the MM-54161 branch August 29, 2023 15:55
@github-actions
Copy link

Newest code from cwarnermm has been published to preview environment for Git SHA 7b7a9eb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3: Reviews Complete All reviewers have approved the pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants