Gitlab Server migration - Alternative method

Hello Team,

As part of our VM Maintenace we are migrating our Gitlab to another server with an upgraded OS version.

As recommended I am following the Backup and Restore method to perform this task. Although I have noticed it takes around 4 hours to finish just the restore part and hence the downtime.

Is there a quicker way to perform the same activity?

I’ve read this Topic where you can do this without using restore but is it recommended?

Thank you

The topic you linked is doable, as some of the other people in the post have responded using such method. You do need to pay attention to permissions though, and I did do something similar recently whereby I had to repair a few permissions related with postgres or gitaly, but otherwise the majority of stuff worked. I have also restored a Gitlab installation using restic, of which I posted about here: 16.8.0 Backup/Restore Issues - how to repair? - #14 by iwalker this can potentially be a quicker method but again, permissions are some issues that need to be addressed.

The backup/restore procedures are probably the more easier and stress-free but as you found in your situation, when you have a lot of data to restore, it takes quite a lot of time.

Hi, thanks for the quick reply

In the first part, did you use rsync -avz to copy data? If yes, it should ideally preserve permissions right and we wouldn’t need to repair permissions of postgres or gitaly.

I used restic, but if you are using rsync, you need to use the function that doesn’t preserve UID/GID, since this will be different on the new server for each of the users created.

Yeah that makes sense,

Just for clarification, do I need to also transfer /opt/gitlab data to the new server or would /var/opt/gitlab and /etc/gitlab/ suffice?

I notice that there are a few symlinks from /var/opt/gitlab to /opt/gitlab (during reconfigure)

Normally just /var/opt/gitlab, /etc/gitlab and if you want the log files, then /var/log/gitlab. The /op/gitlab directory is where the binaries are from, and the main gitlab package should be installed already on the server so you don’t need that.

1 Like

Hi, I tried migrating the server using the following steps -

  1. New Server - Create a new Vanilla Gitlab Server
  2. New Server - Reconfigure with the template gitlab.rb to setup the binaries
  3. Make sure UIDs & GIDs are same in both the servers.
  4. Old Server - Flush the Redis database to disk, and prepare for block volume migration using the following command.
sudo /opt/gitlab/embedded/bin/redis-cli -s /var/opt/gitlab/redis/redis.socket save && sudo gitlab-ctl stop && sudo gitlab-ctl start postgresql && sudo gitlab-ctl start gitaly
  1. Cloned the Old Block Volume, copied /etc/gitlab files as well and attached to the New Server. (Made sure UIDs and GIDs of the files match)
  2. New Server - Reconfigure

Following this method fails at the last reconfigure with this error -