Hi,
I just moved gitlab 11.0.2 from a Debian 7 to a Ubuntu 18.04 host using the guide at https://docs.gitlab.com/ee/raketasks/backup_restore.html.
Things seem to be working okay, but mattermost data hasn’t moved. How would I backup and restore mattermost data when moving between hosts?
Thanks
This is what I tried, and it seems to work somewhat, but I’m not sure if there is a better way.
On the old host
-
Backup database
sudo -u mattermost /opt/gitlab/embedded/bin/pg_dump -U gitlab_mattermost -h /var/opt/gitlab/postgresql -p 5432 mattermost_production > /home/gitlab/mattermost/mattermost_production_backup.sql
-
Backup files
sudo cp -R /var/opt/gitlab/mattermost/* /home/gitlab/mattermost/data
-
Package files
tar -zcf /home/gitlab//mattermost.tar.gz /home/gitlab/mattermost/
On the new host
-
Stop gitlab:
sudo gitlab-ctl stop
-
Start postgresql:
sudo gitlab-ctl start postgresql
-
Drop the existing mattermost database
sudo -u mattermost /opt/gitlab/embedded/bin/dropdb -U gitlab_mattermost -h /var/opt/gitlab/postgresql -p 5432 mattermost_production
-
Create a new mattermost database
sudo -u gitlab-psql /opt/gitlab/embedded/bin/createdb -U gitlab-psql -h /var/opt/gitlab/postgresql -p 5432 mattermost_production
-
Restore database
sudo -u mattermost /opt/gitlab/embedded/bin/psql -U gitlab_mattermost -h /var/opt/gitlab/postgresql -p 5432 mattermost_production < /home/gitlab/mattermost_backup/mattermost_production_backup.sql
-
Restore files
- after restoring files, make sure they are owned by the
mattermost
user.
sudo chown -R mattermost /var/opt/gitlab/mattermost/