When migrating/restoring MM on a new server, all public chats are there, however private chats and groups are apparently missing, names are missing from public chats (all messages show up as somebody).
Steps to reproduce
- Ensure both servers have the same version of MM. Currently using MM version 5.12.4 bundled with GitLab Omnibus version 12.1.6
- Restored GitLab data successfully and ensured that MM was working (although empty)
- Made a backup of MM DB and data files and shipped them off to new server
gitlab-ctl reconfigure to generate config.json. Since gitlab.rb was the same as on the old server (with changes pertaining to gitlab alone), the config.json file generated should be the same as on the old server and therefore I didn’t restore that.
- Restored DB and datafiles
Accessing MM should show me all my previous DMs, Private channels, customisations (colour scheme etc.)
- All DMs are missing. When starting a DM with a user again, all history is absent
- Private channels are missing. Recreating a channel and it appears empty
- All customisations are missing. Favourites, notification settings, colour schemes etc.
- I’m not sure if this is relevant or not, but since I’m still testing the process, I’m doing so with an alternative domain name. So, old GitLab/MM server is still working fine on gitlab.example.com and mattermost.example.com and the migrated services are all on gitlab-test…* and mattermost-test…*. I have however changed the relevant settings (external URLs, oauth callback urls etc.)
Ok. Seems like all I needed was a little more time and a little more digging. Finally got this working.
The step I was missing was dropping and recreating the MM DB when restoring. I wrongly assumed the sql had a drop_table step there.
So, for others that stumble across a similar situation, these are the steps I took to solve/restore from 1 instance to a newer 1.
GitLab Bundled Mattermost Restore
- Ensure you have the exact same version on GitLab installed on both servers (check GitLab docs for install instructions)
- Follow all the steps needed to restore your GitLab corretly. Once that is done, then you can proceed with restoring Mattermost
- Stop Mattermost
gitlab-ctl stop mattermost
/var/opt/gitlab/mattermost/config.json from backup (There are a number of settings here that
gitlab-ctl reconfigure don’t recreate;
/var/opt/gitlab/mattermost/(data|plugins|client_plugins) Be sure to correct permissions and ownership if needed
- Drop the database and recreate it:
sudo -u gitlab-psql -- /opt/gitlab/embedded/bin/dropdb -U gitlab-psql -h /var/opt/gitlab/postgresql -p 5432 mattermost_production
sudo -u gitlab-psql -- /opt/gitlab/embedded/bin/createdb -U gitlab-psql -h /var/opt/gitlab/postgresql -p 5432 mattermost_production
- Restore DB backup
sudo -u mattermost /opt/gitlab/embedded/bin/psql -U gitlab_mattermost -h /var/opt/gitlab/postgresql -p 5432 mattermost_production < /tmp/mattermost_production_backup
gitlab-ctl reconfigure again for safe measure (possibly not needed, but I did it anyway)
- Start mattermost and test
gitlab-ctl start mattermost
Hope this helps others. Sorted my issue and got a fully working migration/restore of both GitLab and Mattermost.