Gitlab版本升级
阅读原文时间:2023年08月09日阅读:9

Gitlab docker部署命令

docker run -d  -p 8443:443 -p 30080:80 -p 9444:22 --name gitlab --restart always \
-v /data/gitlab/config:/etc/gitlab \
-v /data/gitlab/logs:/var/log/gitlab \
-v /data/gitlab/data:/var/opt/gitlab \
gitlab/gitlab-ce:13.8.1-ce.0
  1. 停服务,准备备份,防止升级期间有研发同学提交代码

    [root@localhost backups]# gitlab-ctl stop unicorn
    ok: down: unicorn: 0s, normally up
    [root@localhost backups]# gitlab-ctl stop sidekiq
    ok: down: sidekiq: 0s, normally up
    [root@localhost backups]# gitlab-ctl stop nginx
    ok: down: nginx: 0s, normally up
    [root@localhost backups]# gitlab-ctl status
    run: alertmanager: (pid 30960) 3683s; run: log: (pid 30623) 3735s
    run: gitaly: (pid 30846) 3685s; run: log: (pid 30081) 3828s
    run: gitlab-monitor: (pid 30843) 3685s; run: log: (pid 30498) 3753s
    run: gitlab-workhorse: (pid 30820) 3686s; run: log: (pid 30349) 3784s
    run: grafana: (pid 30980) 3682s; run: log: (pid 30750) 3698s
    run: logrotate: (pid 37253) 178s; run: log: (pid 30384) 3777s
    down: nginx: 4s, normally up; run: log: (pid 30368) 3781s
    run: node-exporter: (pid 30830) 3685s; run: log: (pid 30418) 3764s
    run: postgres-exporter: (pid 30971) 3683s; run: log: (pid 30650) 3730s
    run: postgresql: (pid 30127) 3825s; run: log: (pid 30139) 3821s
    run: prometheus: (pid 30943) 3684s; run: log: (pid 30588) 3741s
    run: redis: (pid 29960) 3838s; run: log: (pid 29972) 3835s
    run: redis-exporter: (pid 30854) 3684s; run: log: (pid 30522) 3747s
    down: sidekiq: 13s, normally up; run: log: (pid 30324) 3788s
    down: unicorn: 17s, normally up; run: log: (pid 30307) 3792s

  2. 备份文件

    1) 使用gitlab自己命令备份 (注意,备份完后在本地文件确认下是否存在,默认路径/var/opt/gitlab/backups/1565056437_gitlab_backup.tar)
    gitlab-rake gitlab:backup:restore
    2)备份gitlab数据文件
    docker cp gitlab:/etc/gitlab /data/gitlab-131215/config
    docker cp gitlab:/var/opt/gitlab /data/gitlab-131215/data
    docker cp gitlab:/var/opt/gitlab /data/gitlab-131215/log
    3)因为是阿里云机器,所以做了一个镜像备份
    ###
    ^ ^ 多备份几份总没错 ^ ^

  3. 删除docker

    端口被占用,新docker起不来
    docker rm gitlab

  4. 起docker服务

    注意:由于升级不能跨越大版本号,因此只能升级到当前大版本号到最高版本,方可升级到下一个大版本号。

    docker run --detach <br /> -p 8443:443 <br /> -p 30080:80 <br /> -p 9444:22 <br /> --name gitlab-131215 <br /> --restart always<br /> --volume /data/gitlab-131215/config:/etc/gitlab <br /> --volume /data/gitlab-131215/log:/var/log/gitlab <br /> --volume /data/gitlab-131215/data:/var/opt/gitlab <br /> gitlab/gitlab-ce:13.12.15-ce.0

  5. 测试验证

    将服务起来,本次升级就完美结束了。^ _^

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器