[SOLVED] Restore on new server missing DMs, Private Groups and user customisation

Summary

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

  1. Ensure both servers have the same version of MM. Currently using MM version 5.12.4 bundled with GitLab Omnibus version 12.1.6
  2. Restored GitLab data successfully and ensured that MM was working (although empty)
  3. Made a backup of MM DB and data files and shipped them off to new server
  4. Ran 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.
  5. Restored DB and datafiles

Expected behavior

Accessing MM should show me all my previous DMs, Private channels, customisations (colour scheme etc.)

Observed behavior

  1. All DMs are missing. When starting a DM with a user again, all history is absent
  2. Private channels are missing. Recreating a channel and it appears empty
  3. All customisations are missing. Favourites, notification settings, colour schemes etc.

Minor Updates

  • 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

  1. Ensure you have the exact same version on GitLab installed on both servers (check GitLab docs for install instructions)
  2. Follow all the steps needed to restore your GitLab corretly. Once that is done, then you can proceed with restoring Mattermost
  3. Stop Mattermost
    gitlab-ctl stop mattermost
    
  4. Restore /var/opt/gitlab/mattermost/config.json from backup (There are a number of settings here that gitlab-ctl reconfigure don’t recreate;
  5. Restore /var/opt/gitlab/mattermost/(data|plugins|client_plugins) Be sure to correct permissions and ownership if needed
  6. 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
    
  7. 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
    
  8. Run gitlab-ctl reconfigure again for safe measure (possibly not needed, but I did it anyway)
  9. 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.

1 Like