Upgrade self hosted Mattermost w. Postgres to a fresh server

we have ver. 5.6.2 and database schema ver. 5.6.0. Database is postgres.
I am tasked to move Mattermost to another server (more recent Ubuntu) and to upgrade it to the latest version. The plan is like this:
Having a new Linux VM ready with same Postgres and Mattermost version as we currently use. Next will be dumping the Mattermost DB to the new VM, then upgrade to 5.37.10 first before going to the most recent version.
I wonder if this high level plan will work or if I miss something and more considerations are required.
Thanks a lot!

Hi @stevns and welcome to the Mattermost forums!

This will work, but you will probably not be able to install the old PostgreSQL version on the new Ubuntu, depending on the version you have.
Where do you store your files? If you store them in an S3 bucket, you will not have to do anything about the files, if you store them locally, the default location is /opt/mattermost/data and you also need to move this directory to the new server.
Depending on the number of files there you might want to use rsync to transfer the files incrementally and to limit the downtime during migration.

Hi Alexander, thank you for your quick response! It`s Postgres 10.22 and the new VM I installed Postgres 10.23, hope this works.
The files are stored locally under /opt/mattermost/data, so I will follow your advise with rsyncing the files to the new server.
Will post the result.
Thanks again.

Alright, that should work then. You can rsync the whole /opt/mattermost directory, it contains everything you need, including the configuration, etc. and saves you some time and the need to install the software on the new server. As long as the mattermost user account has the same UID, you do not even have to change the file ownership again then. The systemd unit needs to be carried over too as well as the SSL offloading part (if you use it externally, like nginx).

1 Like

Hi - the upgrade from 5.6.2 β†’ 5.37.10 β†’ 7.7.1 worked like a charm few days back. Thanks a lot for your advice @agriesser .
Unfortunately today users were not able to add attachments anymore to their chats. A service restart fixed that. I wonder if v7.8.0 would bring a permanent fix to this bug?
Thank you.

Hi @stevns !

thanks for the feedback and yes, this is a known issue which got fixed in 7.8:

Only a restart fixes it and it’s caused by improper state handling of drafts - so it can happen regularly, or not, depending on how your users upload files.