Table of Contents

Move Mattermost to a new server

1. Export Mattermost data

mmctl export create

or when using Yunohost Mattermost instance you first have to run

export MMCTL_LOCAL=true
export MMCTL_LOCAL_SOCKET_PATH=/var/run/mattermost/mattermost_local.socket

then

sudo --preserve-env /var/www/mattermost/bin/mmctl export create

then

 mmctl export list

(will display the name of the export file), for example

s9rbitior7f89namb6gfitcn8c_export.zip

then in this case

mmctl export download s9rbitior7f89namb6gfitcn8c_export.zip

Try to locate the file. I was using Yunohost, and there it was located it

/home/yunohost.app/mattermost/export

Offical documentation: https://docs.mattermost.com/manage/bulk-export-tool.html

2. Import Mattermost data

upload the exported zip-file to the new server and import it

mmctl --local import s9rbitior7f89namb6gfitcn8c_export.zip

Check if the file was imported

mmctl import list available

It will show a new name of the zip-file

Process the uploaded file, this will take a few minutes and use lots of CPU if the file is big (mine was 780 MB)

mmctl --local import process c3yydbyfyty8jqky85zebcxb4o_65mzma97fjncbpyc8yytqnxr7o_export.zip

It will answer:

Import process job successfully created, ID: 11uedfiofpy1uf9okdr6mjc8ah

and then you will have to wait a few minutes. In my case it worked surprisingly well, only all the direct messages were marked as unread, but this is only a minor issue

Official documentation: https://docs.mattermost.com/onboard/bulk-loading-data.html