• Docker 部署GitLabs 版本升级 13.9.x > 15.3.x


    Gitlabs版本升级大版本不能直接跳级升级, 可以参考官方的升级路径
    本人是从13.9.x需要升级到最新的15.3.x。 参考官方路径结合自己的实际情况成功升级。
    13.9.0 -> 13.12.15 -> 14.0.12 ->14.1.8 -> 14.3.6 ->14.6.2 -> 14.9.5 ->14.10.5 ->15.0.3 -> 15.3.1

    因为是基于Docker部署gitlabs,所以首先要在主机上创建挂载点,把gitlabs的数据挂载到主机上。

    docker volume create gitlab_config
    docker volume create gitlab_logs
    docker volume create gitlab_data
    sudo docker run --detach \
      --hostname bp.devops.gitlab \
      --publish 443:443 --publish 80:80 --publish 21:22 \
      --name gitlab \
      --restart always \
      --privileged=true \
      --volume gitlab_config:/etc/gitlab \
      --volume gitlab_logs:/var/log/gitlab \
      --volume gitlab_data:/var/opt/gitlab \
      gitlab/gitlab-ce:13.9.0-ce.0

    接下来就是一步步的安装版本升级的路径是新创建docker 容器了。

    sudo docker run --detach \
      --hostname bp.devops.gitlab \
      --publish 443:443 --publish 80:80 --publish 21:22 \
      --name gitlab_13.12.15 \
      --restart always \
      --privileged=true \
      --volume gitlab_config:/etc/gitlab \
      --volume gitlab_logs:/var/log/gitlab \
      --volume gitlab_data:/var/opt/gitlab \
      gitlab/gitlab-ce:13.12.15-ce.0
    
    
    sudo docker run --detach \
      --hostname bp.devops.gitlab \
      --publish 443:443 --publish 80:80 --publish 21:22 \
      --name gitlab_14.0.12 \
      --restart always \
      --privileged=true \
      --volume gitlab_config:/etc/gitlab \
      --volume gitlab_logs:/var/log/gitlab \
      --volume gitlab_data:/var/opt/gitlab \
      gitlab/gitlab-ce:14.0.12-ce.0
    
    sudo docker run --detach \
      --hostname bp.devops.gitlab \
      --publish 443:443 --publish 80:80 --publish 21:22 \
      --name gitlab_14.1.8 \
      --restart always \
      --privileged=true \
      --volume gitlab_config:/etc/gitlab \
      --volume gitlab_logs:/var/log/gitlab \
      --volume gitlab_data:/var/opt/gitlab \
      gitlab/gitlab-ce:14.1.8-ce.0
    
    sudo docker run --detach \
      --hostname bp.devops.gitlab \
      --publish 443:443 --publish 80:80 --publish 21:22 \
      --name gitlab_14.3.6 \
      --restart always \
      --privileged=true \
      --volume gitlab_config:/etc/gitlab \
      --volume gitlab_logs:/var/log/gitlab \
      --volume gitlab_data:/var/opt/gitlab \
      gitlab/gitlab-ce:14.3.6-ce.0
    
    sudo docker run --detach \
      --hostname bp.devops.gitlab \
      --publish 443:443 --publish 80:80 --publish 21:22 \
      --name gitlab_14.6.2 \
      --restart always \
      --privileged=true \
      --volume gitlab_config:/etc/gitlab \
      --volume gitlab_logs:/var/log/gitlab \
      --volume gitlab_data:/var/opt/gitlab \
      gitlab/gitlab-ce:14.6.2-ce.0
    
    
    
    sudo docker run --detach \
      --hostname bp.devops.gitlab \
      --publish 443:443 --publish 80:80 --publish 21:22 \
      --name gitlab_14.9.5 \
      --restart always \
      --privileged=true \
      --volume gitlab_config:/etc/gitlab \
      --volume gitlab_logs:/var/log/gitlab \
      --volume gitlab_data:/var/opt/gitlab \
      gitlab/gitlab-ce:14.9.5-ce.0
    
    
    sudo docker run --detach \
      --hostname bp.devops.gitlab \
      --publish 443:443 --publish 80:80 --publish 21:22 \
      --name gitlab_14.10.5 \
      --restart always \
      --privileged=true \
      --volume gitlab_config:/etc/gitlab \
      --volume gitlab_logs:/var/log/gitlab \
      --volume gitlab_data:/var/opt/gitlab \
      gitlab/gitlab-ce:14.10.5-ce.0
    
    sudo docker run --detach \
      --hostname bp.devops.gitlab \
      --publish 443:443 --publish 80:80 --publish 21:22 \
      --name gitlab_15.0.3 \
      --restart always \
      --privileged=true \
      --volume gitlab_config:/etc/gitlab \
      --volume gitlab_logs:/var/log/gitlab \
      --volume gitlab_data:/var/opt/gitlab \
      gitlab/gitlab-ce:15.0.3-ce.0
    
    
    sudo docker run --detach \
      --hostname bp.devops.gitlab \
      --publish 443:443 --publish 80:80 --publish 21:22 \
      --name gitlab_latest \
      --restart always \
      --privileged=true \
      --volume gitlab_config:/etc/gitlab \
      --volume gitlab_logs:/var/log/gitlab \
      --volume gitlab_data:/var/opt/gitlab \
      gitlab/gitlab-ce

    在升级过程中如果碰到报错: Database migration fails, 可以手动执行数据 Database migration。 

    docker exec -it {dockerID} /bin/bash
    gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']
    gitlab-rake gitlab:background_migrations:finalize[BackfillProjectSettings,projects,id,'[]']
    gitlab-rake gitlab:background_migrations:finalize[BackfillIntegrationsTypeNew,integrations,id,'[]']
    gitlab-rake db:migrate --trace
    gitlab-rake db:migrate:status | grep 'down'
    gitlab-ctl reconfigure
    apt dist-upgrade
    gitlab-ctl restart

    以上手动执行还是失败,可以退回上一个版本,登录gitlabs的Admin Area - Background Migrations看看是否存在failed的,执行成功后,再升级即可。

    gitlab 默认启用 Prometheus , 防止Gitlabs占用大量空间,可以关闭

    docker exec -it {dockerID} /bin/bash
    vim gitlab/config/gitlab.rb
    
    直接修改
    # prometheus['enable'] = true
    prometheus['enable'] = false

    gitlab-ctl stop
    gitlab-ctl reconfigure
    gitlab-ctl start
     


    参考:

    https://gitlab.com/gitlab-org/gitlab/-/issues/363230
    https://gitlab.com/gitlab-org/gitlab/-/issues/360377

  • 相关阅读:
    idea jsp无法加载<c:foreach>循环遍历数据
    java POI读取Excel文件
    Javaweb中请求的资源[/Servlet]不可用解决方案
    大作业第一阶段冲刺(一)
    hive中sql左外连接查询列值为null
    关于ECharts在jsp页面无法显示的问题
    echarts通过ajax实现数据加载
    读书笔记
    解决:[Err] 1064
    idea启动Tomcat报错Artifact testdemo1:war exploded: Error during artifact deployment. See server log for details.问题解决
  • 原文地址:https://www.cnblogs.com/colder/p/16650365.html
Copyright © 2020-2023  润新知