How to migrate gitlab from one server to another on CentOS7

On old server

On old server, do these steps.

Shutdown gitlab services:-

gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq

Backup of GITLAB of old server.

gitlab-rake gitlab:backup:create

Create a directory named gitlab-old

mkdir gitlab-old

Copy gitlab configuration file

cp /etc/gitlab/gitlab.rb /gitlab-old
cp /etc/gitlab/gitlab-secrets.json /gitlab-old
cp -R /etc/gitlab/ssl /gitlab-old

Copy the backup file

cp /var/opt/gitlab/backups/XXXXXXXXXX_gitlab_backup.tar

send the data to the new gitlab server,

scp -r /gitlab-old  user@new_server_ip:/

On New server

Install the gitlab server

curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
yum install -y gitlab-ce

cp configuration file to /etc/gitlab

cp gitlab-old/gitlab* /etc/gitlab
cp -R gitlab-old/ssl /etc/gitlab

After that run this command

gitlab-ctl reconfigure

Shutdown gitlab services:-

gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq

Copy backup file to /var/opt/gitlab/backups, change ownership and permission

cp gitlab-old/XXXXXXXXXX_gitlab_backup.tar /var/opt/gitlab/backups
chown git:git /var/opt/gitlab/backups/XXXXXXXXXX_gitlab_backup.tar

Run the gitlab restore process

gitlab-rake gitlab:backup:restore BACKUP=XXXXXXXXX

Note:- remove _gitlab_backup.tar when you restore

Restart Gitlab services.

sudo gitlab-ctl start
sudo gitlab-rake gitlab:check SANITIZE=true

Now, everything is ready

 

Also, Read This Blog:- How to install and configure the GitLab on centOS7 server

1 thought on “How to migrate gitlab from one server to another on CentOS7”

Leave a Reply

Your email address will not be published. Required fields are marked *