DEV Community

dom
dom

Posted on

How to Migrate a Self-Hosted GitLab Instance (Docker-Based) to a New Machine

Using the usual rclone sync casaos:/DATA/AppData/gitlab-ee/ /DATA/AppData/gitlab-ee/ -P --create-empty-src-dirs -l doesn't help because lot's of copy errors, and symlinks don't endup being remade thus gitlab fails to start up on new server.

Nice optional have:

gitlab-rails console
# wait for startup (its slow)
::Gitlab::CurrentSettings.update!(maintenance_mode: true)
Enter fullscreen mode Exit fullscreen mode

Start from here:

gitlab-backup create  
/DATA/AppData/gitlab-ee/data/backups
# echo 1735565802_2024_12_30_17.5.1-ee_gitlab_backup.tar
Enter fullscreen mode Exit fullscreen mode

restore on new one

# Create the /opt/gitlab/data/backups directory, including any parent directories if they don't exist
mkdir -p /DATA/AppData/gitlab-ee/data/backups

Enter fullscreen mode Exit fullscreen mode

get inside container or use docker exec -t <name of container>

Execute the command inside the running "gitlab-backend" container to stop the Puma service

gitlab-ctl stop puma
Execute the command inside the running "gitlab-backend" container to stop the Sidekiq service

gitlab-ctl stop sidekiq
Verify that the GitLab services have stopped by checking the status of all services in the container

gitlab-ctl status
Run the GitLab backup restore command inside the running "gitlab-backend" container
gitlab-backup restore BACKUP=1735565802_2024_12_30_17.5.1-ee_gitlab_backup


Run the GitLab reconfigure command inside the running "gitlab-backend" container
docker exec -t gitlab-backend gitlab-ctl reconfigure

Restart the "gitlab-backend" container after reconfiguration
docker restart gitlab-backend
Done!

Top comments (0)