GItLab维护时会遇到的一些问题

1、升级时遇到跨大版本时出现无法正常运行

Docker日志复现

Thank you for using GitLab Docker Image!
Current version: gitlab-ce=17.11.1-ce.0
Configure GitLab for your system by editing /etc/gitlab/gitlab.rb file
And restart this container to reload settings.
To do it use docker exec:

docker exec -it gitlab editor /etc/gitlab/gitlab.rb

docker restart gitlab

For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
If this container fails to start due to permission problems try to fix it by executing:

docker exec -it gitlab update-permissions

docker restart gitlab

Cleaning stale PIDs & sockets
It seems you are upgrading from 17.7.0 to 17.11.1.
It is required to upgrade to the latest 17.8.x version first before proceeding.
Please follow the upgrade documentation at https://docs.gitlab.com/ee/update/#upgrade-paths

报错分析

服务器上原先部署的版本是 17.7.0 但是我想更新的是 17.11.1 在这之间存在一个大版本更新 17.8.x ,因而导致gitlab无法从 17.7.0 直接更新至 17.11.1

解决措施

  • 1、先去DockerHub寻找 17.8.x版本的docker镜像
docker pull gitlab/gitlab-ce:17.8.7-ce.0
  • 2、 将 docker-compose 上的gitlab的镜像换成刚刚下载好的
gitlab-ce:
    # 更换镜像
    image: gitlab/gitlab-ce:17.8.7-ce.0
    container_name: gitlab
    hostname: gitlab
    #environment:
    #  GITLAB_OMNIBUS_CONFIG: |
    #    external_url 'http://gitlab.elsworld.cn:8102'
    #    gitlab_rails['gitlab_shell_ssh_port'] = 8122
    deploy:
      resources:
        limits:
          # 限制服务的最大内存使用为4GB
          memory: 4g
          # CPU 最大 4 核心
          cpus: "4.00"
        reservations:
          # 预留1GB的内存,保证服务至少有这么多可用
          memory: 1g
          # CPU 预留 2 核心
          cpus: "2.00"
    # IO 限制
    blkio_config:
      device_read_bps:
        - path: /dev/sdc
          rate: 100mb
      device_write_bps:
        - path: /dev/sdc
          rate: 100mb
    privileged: true
    restart: no
    volumes:
      - /mnt/docker/Configs/gitlab/opt:/var/opt/gitlab
      - /mnt/docker/Configs/gitlab/log:/var/log/gitlab
      - /mnt/docker/Configs/gitlab/etc:/etc/gitlab
    ports:
      - 8102:8102
      - 8122:22
    tty: true
    stdin_open: true
    networks:
      net:
        ipv4_address: 172.24.0.4
  • 3、 最后重新部署
docker compose up -d