Gitlab CE upgrade plan

Hi all,
I have Gitlab CE 12.3.5 installed by Linux packages (Omnibus GitLab) self hosted server Centos 7.4 .

rpm -qa | grep gitlab
gitlab-ce-12.3.5-ce.0.el7.x86_64

I’m planning to upgrade it to at least 13.12.15
Here my plan :

Stage 1 : Migrate Gitlab to docker environment
Step1 : Backup full Gitlab
/opt/gitlab/bin/gitlab-backup create
Step2 : Prepair another server - Ubuntu 22.10/latest - with docker installed - run a new Gitlab CE 12.3.5 instance on docker
docker-compose.yml

version: '3.6'
services:
  web:
    image: 'gitlab/gitlab-ce:12.3.5-ce.0'
    restart: always
    hostname: 'gitlab.mydomain.com'
    container_name: gitlab
    ports:
      - '80:80' # my gitlab run http only
      - '2289:22' # change gitlab shell ssh port
    volumes:
      - /srv/gitlab/config:/etc/gitlab
      - /srv/gitlab/logs:/var/log/gitlab
      -/srv/gitlab/data:/var/opt/gitlab
      -/srv/gitlab/backup:/var/opt/gitlab/backups
    shm_size: '256m'

Step3 : Copy my gitlab backup .tar & gitlab.rb & gitlab-secrets.json from current host (Centos 7.4) to new host (Ubuntu) /srv/gitlab/backup .
Step4: Restore and verify gitlab on docker

docker exec -it gitlab /bin/bash
override /etc/gitlab/gitlab.rb & gitlab-secrets.json by /var/opt/gitlab/backups/gitlab.rb & gitlab-secrets.json
sudo gitlab-ctl stop puma
sudo gitlab-ctl stop sidekiq
sudo gitlab-ctl status
sudo gitlab-backup restore BACKUP=
# Verify
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
sudo gitlab-rake gitlab:check SANITIZE=true

If my restore Gitlab CE 12.3.5 on docker works fine, I will do
Stage 2: Upgrade Gitlab CE on docker following upgrade path:
12.3.5 → 12.10.14 → 13.0.14 → 13.1.11 → 13.8.8 → 13.12.15
By changing image tag in docker-compose.yml file

I attemp to do backup full on mid night when no one using gitlab but I concern that is there anything else I need to do to prevent gitlab data written when I do backup that can lead to inconsistencies or corruption issues/problems when I do restore.
Please give me some advice, thank you very much.

For anyone want to do same thing, here my steps:

  • Prepare a Ubuntu latest server with docker installed.
  • Create /srv/gitlab/ structure like this:
drwx------  3 git  root 4.0K Mar 13 02:14 backup
drwxrwxr-x  3 root root 4.0K Feb 28 17:19 config
drwxr-xr-x 20 root root 4.0K Feb 25 22:07 data
-rw-r--r--  1 root root  546 Feb 25 22:05 docker-compose.yml
drwxr-xr-x 21 root root 4.0K Feb  4 22:03 logs
version: '3.6'
services:
  gitlab:
    image: 'gitlab/gitlab-ce:your_current_version'
    restart: always
    hostname: 'gitlab.mydomain.com'
    container_name: gitlab
    environment:
      - TZ=Asia/Ho_Chi_Minh
    ports:
      - '80:80' # my gitlab run http only
      - '22:22' # gitlab shell ssh port , need for connecting to gitlab by ssh key
    volumes:
      - /srv/gitlab/config:/etc/gitlab
      - /srv/gitlab/logs:/var/log/gitlab
      - /srv/gitlab/data:/var/opt/gitlab
      - /srv/gitlab/backup:/var/opt/gitlab/backups
    shm_size: '512m'
  • Create user git (uid 998) , and assign permissions to the respective folders.
    useradd git -u 998 -M -s /bin/false
  • Backup full Gitlab from old server /opt/gitlab/bin/gitlab-backup create
  • Copy backup , /etc/gitlab/gitlab.rb , /etc/gitlab/gitlab-secrets.json from old server to “backup” folder
    You can customize timezone (environment TZ).
  • Run “docker compose -f docker-compose.yml up -d” to start gitlab container
  • Run “docker exec -it gitlab bash” to access into gitlab container with bash shell
  • Restore backup from old server to new one
cd /var/opt/gitlab/backups/
gitlab-ctl stop puma
gitlab-ctl stop sidekiq
gitlab-backup restore BACKUP=your_backup_file_name_gitlab_backup.tar
wait until it finished ...........
cp gitlab.rb /etc/gitlab
cp gitlab-secrets.json /etc/gitlab
gitlab-ctl reconfigure
gitlab-ctl restart
wait 5 mins .......
gitlab-rake gitlab:check SANITIZE=true
Results should be ok all.

Check your new gitlab instance if it works ok.
Then you can upgrade it by editing docker-compose.yml : image: 'gitlab/gitlab-ce:your_next_version , following Upgrade paths at Upgrading GitLab | GitLab

  • Run “docker compose -f docker-compose.yml up -d” again , and your gitlab will be upgraded.
    You should wait at least 24 hours before each version upgrade.
    I upgraded gitlab from 12.3.5 → 12.10.14 → 13.0.14 → 13.1.11 → 13.8.8 → 13.12.15 successfully and keep going to 14.10.5 .
    In my case, I want to reverse port 22 for gitlab shell ssh port so I have to change my host ssh port listening to another port.