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
- Restore
/var/opt/gitlab/mattermost/config.json
from backup (There are a number of settings here thatgitlab-ctl reconfigure
don’t recreate; - Restore
/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
- Run
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.