Since we used GitLab deployed by Docker before, we encountered some problems during the upgrade. Let me record them here.

1. GitLab on the old server

Docker Compose:

version: '2'
services:
    gitlab:
      image: 'twang2218/gitlab-ce-zh'
      restart: unless-stopped
      hostname: 'git.xxx.com'
      environment:
        TZ: 'Asia/Shanghai'
        GITLAB_OMNIBUS_CONFIG: |
          external_url 'http://git.xxx.com'
          gitlab_rails['time_zone'] = 'Asia/Shanghai'
      ports:
        - '80:80'
        - '443:443'
      volumes:
        - /home/gitlab/config:/etc/gitlab
        - /home/gitlab/data:/var/opt/gitlab
        - /home/gitlab/log:/var/log/gitlab

2. Upgrade the pits you encounter

The previous version number of the old version was 11.0.5, and now the latest version of the official version is 11.7.0-CE.0. Since it was the modified version of Gitlab after Chinese translation, the official version number of 11.0.5 is not available for downloading. However, when using the new version directly, there will be various problems, such as permission issues, version issues and so on.

  1. Can’t begitlabDirectly package folders for transfer, will encounter a variety of permission issues.
  2. Can not directly change the Chinese version directly into the official version of the new version, will meet the version inconsistent problem.

3. Proper server migration posture

  1. Run the following command on the original server:

    > gitlab-ctl stop unicorn > gitlab-ctl stop sidekiq # docker exec-it home_gitlab_1 bash stop unicorn > gitlab-ctl stop sidekiq > gitlab-rake gitlab:backup:create

    After performing the above command, can be in/home/on host gitlab/data/produce a tar file backups, for example: 1548223311 _2019_01_23_11. 0.5 _gitlab_backup. Tar

  2. Will thistarFile, transfer to the new server
  3. On the new server, run the docker compose file from the old server

    • Remember to modify the version number, keep the same with the previous version (if the image has a new version, do not write the version number, will download the latest version, can not be backed up to restore).
    Version: '2' services: gitlab: image: 'twang2218/gitlab-ce-zh:11.0.5' restart: Unless -stopped hostname: 'git.xxx.com' environment: TZ: 'Asia/Shanghai' GITLAB_OMNIBUS_CONFIG: | external_url 'http://git.xxx.com' gitlab_rails['time_zone'] = 'Asia/Shanghai' ports: - '80:80' - '443:443' volumes: - /home/gitlab/config:/etc/gitlab - /home/gitlab/data:/var/opt/gitlab - /home/gitlab/log:/var/log/gitlab
    # compose up: Docker docker-compose up-d
  4. After starting Docker on a new server, it will be backed uptarCopy file to/home/gitlab/data/backupsDirectory, and set the file permissions to777
  5. Enter the container of the new server and execute the following command:

    > gitlab-ctl stop unicorn > gitlab-ctl stop sidekiq # docker exec-it home_gitlab_1 bash stop unicorn > gitlab-ctl stop sidekiq > gitlab-rake gitlab: BACKUP :restore = 1548223311_2019_01_23_11.0.5_gitlab_backup.tar > gitlab-ctl restart: BACKUP=1548223311_2019_01_23_11.0.5

    The server migration is complete, and if you don’t upgrade, that’s it.

4. GitLab upgrade

  1. Same image upgrade

    Modify the compose file and upgrade the image to the same as the official version (after looking up the Docker image file, I know that version 11.1.4 is based on the official Gitlab/Gitlab-ce :11.1.4-ce.0 for Chinese modification and construction, so this time it is upgraded to version 11.1.4)

    Version: '2' services: gitlab: image: 'twang2218/gitlab-ce-zh:11.1.4' restart: Unless -stopped hostname: 'git.xxx.com' environment: TZ: 'Asia/Shanghai' GITLAB_OMNIBUS_CONFIG: | external_url 'http://git.xxx.com' gitlab_rails['time_zone'] = 'Asia/Shanghai' ports: - '80:80' - '443:443' volumes: - /home/gitlab/config:/etc/gitlab - /home/gitlab/data:/var/opt/gitlab - /home/gitlab/log:/var/log/gitlab
    Compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose Docker exec-it home_gitlab_1 bash # stop unicorn > gitlab-ctl stop sidekiq # refresh configuration > > gitlab-ctl reconfigure: restart gitlab-ctl > gitlab-rake gitlab:backup:create > gitlab-rake gitlab:backup:create > gitlab-rake gitlab:backup:create docker-compose down

    Backup the data to a different location on the host, such as /home/gitlab-backup/xxx_11.1.4_gitlab_backup.tar

  2. Crossing to the official mirror (GITLAB/GITLAB-CE)

    For the compose file, note the version selection:

    Version: '2' services: gitlab: image: 'gitlab/gitlab-ce:11.1.4-ce.0' restart: UNLESS - STOPPED HOSTNAME: 'git.xxx.com' environment: TZ: 'Asia/Shanghai' GITLAB_OMNIBUS_CONFIG: | external_url 'http://git.xxx.com' gitlab_rails['time_zone'] = 'Asia/Shanghai' ports: - '80:80' - '443:443' volumes: - /home/gitlab/config:/etc/gitlab - /home/gitlab/data:/var/opt/gitlab - /home/gitlab/log:/var/log/gitlab
    # check docker status; Compose compose compose compose compose compose compose compose compose compose compose compose compose compose compose compose compose compose compose compose A tar backup copy to/home/gitlab/data/backups cp/home/gitlab - backup/xxx_11. 1.4 _gitlab_backup. Tar/home/gitlab/data/backups # Set the permissions chmod 777 / home/gitlab/data/backups/xxx_11. 1.4 _gitlab_backup. Tar # into the container docker exec - it home_gitlab_1 bash # > gitlab-ctl stop unicorn > gitlab-ctl stop sidekiq # BACKUP= timestamp (xxx_11.1.4_gitlab_backup.tar for example) > Gitlab-rake gitlab:backup:restore backup =xxx_11.1.4 gitlab-ctl reconfigure :restore backup =xxx_11.1.4 Docker exec-it home_gitlab_1 bash # create backup > gitlab-rake gitlab:backup:create # exit # docker docker-compose down

    Backup the data to a different location on the host, such as /home/gitlab-backup/zzz_11.1.4_gitlab_backup.tar

  3. Official Image Upgrade

    Upgrade to Official Latest Version (11.7.0-CE.0)

    Modify the compose file

    Version: '2' services: gitlab: image: 'gitlab/gitlab-ce:11.7.0-ce.0' restart: UNLESS - STOPPED HOSTNAME: 'git.xxx.com' environment: TZ: 'Asia/Shanghai' GITLAB_OMNIBUS_CONFIG: | external_url 'http://git.xxx.com' gitlab_rails['time_zone'] = 'Asia/Shanghai' ports: - '80:80' - '443:443' volumes: - /home/gitlab/config:/etc/gitlab - /home/gitlab/data:/var/opt/gitlab - /home/gitlab/log:/var/log/gitlab
    # check docker status; Compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose, compose > gitlab-ctl reconfigure > gitlab-ctl restart > gitlab-ctl restart > gitlab-ctl restart > gitlab-ctl restart > gitlab-ctl restart > gitlab-ctl restart > gitlab-ctl restart > gitlab-ctl restart > gitlab-ctl restart > gitlab-ctl restart > gitlab-rake gitlab:backup:create # > gitlab-rake gitlab:backup:create # > exec -it home_gitlab_1 bash

    Backup the data to a different location on the host, such as /home/gitlab-backup/nnn_11.1.7_gitlab_backup.tar

    The GitLab server migration and upgrade are complete.

The 2021-07-16 update:

Upgrade according to the official upgrade version route, otherwise an error will be reported.

https://docs.gitlab.com/ee/up…

Gitlab deleting items at 500 OpenSSL: : Cipher: : CipherError

$docker exec-it gitlab bash $docker exec-it gitlab bash $docker exec-it gitlab bash $docker exec-it gitlab bash $docker exec-it gitlab bash $docker exec-it gitlab bash $docker exec-it gitlab bash runners_token = null, runners_token_encrypted = null;