记一次升级gitlab的记录(16.3.3~17.3.1)

记一次升级gitlab的记录(16.3.3~17.3.1)

朱治龙
2024-09-11 / 2 评论 / 55 阅读 / 正在检测是否收录...

开发服务器的 gitlab 使用 docker 搭建,docker-compose.yml 文件内容如下:

services:
  gitlab:
    image: 'registry.gitlab.cn/omnibus/gitlab-jh:latest'
    restart: always
    container_name: gitlab
    hostname: 'git.work.zhuzhilong.com'
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        external_url 'http://git.work.zhuzhilong.com'
        # Add any other gitlab.rb configuration here, each on its own line
    networks:
      - net-zzl
    ports:
      - '8007:80'
      - '2223:22'
    volumes:
      - './config:/etc/gitlab'
      - './logs:/var/log/gitlab'
      - './data:/var/opt/gitlab'
      - ../hosts:/etc/hosts
    shm_size: '256m'
networks:
  net-zzl:
    name: bridge_zzl
    external: true

由于该 gitlab 搭建后一直未更新过,今天尝试个升级,升级前,我们先看看系统环境信息:
升级前的gitlab版本信息

由于 gitlab 用的镜像是 registry.gitlab.cn/omnibus/gitlab-jh:latest,我先尝试直接拉取一下最新的镜像看是否可以直接升级,拉取命令:docker compose pull,拉取过程如下:

zhuzl@zhuzl-M9-PRO:/data/dockerRoot/apps/gitlab$ docker compose pull
[+] Pulling 10/10
 ✔ gitlab 9 layers [⣿⣿⣿⣿⣿⣿⣿⣿⣿]      0B/0B      Pulled                                                                                                                                                   62.1s
   ✔ 857cc8cb19c0 Already exists                                                                                                                                                                         0.0s
   ✔ d388127601d7 Pull complete                                                                                                                                                                          1.0s
   ✔ c973ce60899e Pull complete                                                                                                                                                                          1.6s
   ✔ d47067d54097 Pull complete                                                                                                                                                                          1.2s
   ✔ b37f526cb6d4 Pull complete                                                                                                                                                                          1.4s
   ✔ e3e25c0883d4 Pull complete                                                                                                                                                                          6.6s
   ✔ 38326bc1340c Pull complete                                                                                                                                                                          7.6s
   ✔ dc916e282a43 Pull complete                                                                                                                                                                          6.6s
   ✔ 84388f622dc9 Pull complete                                                                                                                                                                         44.1s
zhuzl@zhuzl-M9-PRO:/data/dockerRoot/apps/gitlab$ 

然后,我们使用 docker compose up -d 启动服务,启动服务后,使用docker logs -f gitlab命令看看日志:


zhuzl@zhuzl-M9-PRO:/data/dockerRoot/apps/gitlab$ docker logs -f gitlab
Thank you for using GitLab Docker Image!
Current version: gitlab-jh=17.3.1-jh.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 16.3.3-jh to 17.3.1.
It is required to upgrade to the latest 16.11.x version first before proceeding.
Please follow the upgrade documentation at https://docs.gitlab.com/ee/update/index.html#upgrading-to-a-new-major-version
Thank you for using GitLab Docker Image!
Current version: gitlab-jh=17.3.1-jh.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 16.3.3-jh to 17.3.1.
It is required to upgrade to the latest 16.11.x version first before proceeding.
Please follow the upgrade documentation at https://docs.gitlab.com/ee/update/index.html#upgrading-to-a-new-major-version
Thank you for using GitLab Docker Image!
Current version: gitlab-jh=17.3.1-jh.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 16.3.3-jh to 17.3.1.
It is required to upgrade to the latest 16.11.x version first before proceeding.
Please follow the upgrade documentation at https://docs.gitlab.com/ee/update/index.html#upgrading-to-a-new-major-version
zhuzl@zhuzl-M9-PRO:/data/dockerRoot/apps/gitlab$ 

从日志中的提示可知,系统检测到了,我们是从16.3.3-jh 升级到 17.3.1.但是要升级到17.x 必须先升级到 16.11.x

于是将 docker-compose.yaml 文件中的image值改为:registry.gitlab.cn/omnibus/gitlab-jh:16.11.3,重新拉取,然后运行,观察日志:

zhuzl@zhuzl-M9-PRO:/data/dockerRoot/apps/gitlab$ docker logs -f gitlab
Thank you for using GitLab Docker Image!
Current version: gitlab-jh=16.11.3-jh.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 16.3.3-jh to 16.11.3.
It is required to upgrade to the latest 16.7.x version first before proceeding.
Please follow the upgrade documentation at https://docs.gitlab.com/ee/update/#upgrade-paths
Thank you for using GitLab Docker Image!
Current version: gitlab-jh=16.11.3-jh.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 16.3.3-jh to 16.11.3.
It is required to upgrade to the latest 16.7.x version first before proceeding.
Please follow the upgrade documentation at https://docs.gitlab.com/ee/update/#upgrade-paths
zhuzl@zhuzl-M9-PRO:/data/dockerRoot/apps/gitlab$

根据日志提示,要升级到16.11.3 的话,需要先升级到 16.7.x , 于是我们继续修改docker-compose.yaml 中的 image 为:registry.gitlab.cn/omnibus/gitlab-jh:16.11.3,继续拉取镜像并启动服务,经过漫长等待后,登录gitlab,查看版本发现第一步升级到16.7.x已完成:
成功升级到升级到gitlab 16.7.7

然后继续升级到16.11.x,修改docker 镜像后,重启服务,经过漫长的等待后,成功升级到16.11.3:
成功升级到升级到16.11.3

然后我们将image 修改为:registry.gitlab.cn/omnibus/gitlab-jh:latest`,重新启动服务,登录后,已经升级到最新的 17.3.1 版本:
成功升级到升级到17.3.1版本

升级完成后,查看容器日志,发现大量类似这样的错误日志输出:

2024-09-11_04:05:55.21146 ts=2024-09-11T04:05:55.211Z caller=main.go:181 level=info msg="Starting Alertmanager" version="(version=0.27.0, branch=master, revision=0aa3c2aad14cff039931923ab16b26b7481783b5)"
2024-09-11_04:05:55.21148 ts=2024-09-11T04:05:55.211Z caller=main.go:182 level=info build_context="(go=go1.22.5, platform=linux/amd64, user=GitLab-Omnibus, date=, tags=unknown)"
2024-09-11_04:05:55.21183 ts=2024-09-11T04:05:55.211Z caller=cluster.go:179 level=warn component=cluster err="couldn't deduce an advertise address: no private IP found, explicit advertise addr not provided"
2024-09-11_04:05:55.21286 ts=2024-09-11T04:05:55.212Z caller=main.go:221 level=error msg="unable to initialize gossip mesh" err="create memberlist: Failed to get final advertise address: No private IP address found, and explicit IP not provided"

简单搜了下,找到这个网址:https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/4556
按照提示,配置信息添加如下信息即可:alertmanager['enable'] = false。由此,我进一步调整 docker-compose.yml,文件,最终的内容如下:

services:
  gitlab:
    image: 'registry.gitlab.cn/omnibus/gitlab-jh:latest'
    # image: 'registry.gitlab.cn/omnibus/gitlab-jh:16.11.3'
    # image: 'registry.gitlab.cn/omnibus/gitlab-jh:16.7.7'
    restart: always
    container_name: gitlab
    hostname: 'git.work.zhuzhilong.com'
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        external_url 'http://git.work.zhuzhilong.com'
        # Add any other gitlab.rb configuration here, each on its own line
        alertmanager['enable']=false
    networks:
      - net-zzl
    ports:
      - '8007:80'
      - '2223:22'
    volumes:
      - './config:/etc/gitlab'
      - './logs:/var/log/gitlab'
      - './data:/var/opt/gitlab'
      - ../hosts:/etc/hosts
    shm_size: '256m'
networks:
  net-zzl:
    name: bridge_zzl
    external: true
1

评论 (2)

取消
  1. 头像
    hb250
    Windows 10 · Google Chrome

    从目前来看,最新的 17.3.1 版本 PostgreSQL 14.11 版本,从前一个版本升级居然没有问题。https://docs.gitlab.com/ee/administration/postgresql/upgrading_os.html

    这里说的如果docker里面的glib版本如果升级到glibc 2.28以上,glibc 2.28 及更高版本中的区域设置数据更改的升级可能会损坏数据库索引 。

    吓得有都不愿意升级。

    回复
    1. 头像
      朱治龙 作者
      Windows 10 · Google Chrome
      @ hb250

      gitlab时不时报安全漏洞,还是升级到最新版本为好,如果只是内网环境用的话就无所谓。
      升级前做好数据备份,大胆尝试,小心验证就好。
      我个人用的gitlab数据量不大,升级过程中没发现什么问题。

      回复