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

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