GitLab 不同版本迁移

Gitlab 不同版本迁移

  • GitLab 8: 8.11.Z > 8.12.0 > 8.17.7

  • GitLab 9: 9.0.13 > 9.5.10

  • GitLab 10: 10.0.7 > 10.8.7

  • GitLab 11: 11.0.6 > 11.11.8

  • GitLab 12: 12.0.12 > 12.1.17 > 12.10.14

  • GitLab 13: 13.0.14 > 13.1.11 > 13.8.8 > 13.12.15

  • GitLab 14: 14.0.12 > 14.3.6 > 14.9.5 > 14.10.5

  • GitLab 15: 15.0.5 > 15.1.6 (for GitLab instances with multiple web nodes) > 15.4.6 > latest 15.Y.Z

相同版本同步脚本

# 1. 检查当前版本
docker exec gitlab cat /opt/gitlabembedded/service/gitlab-rails/VERSION
# 2. 进入容器
docker exec -it gitlab bash
# 3. 备份文件 存储在 /var/opt/gitlab/backups/下面
gitlab-rake gitlab:backup:create
# 生成文件   /var/opt/gitlab/backups/1684222315_2023_05_16_15.11.3_gitlab_backup.tar

# 4. 复制上面的备份文件到 另外一台服务器,相同的路径 ,前提两台电脑已经添加秘钥
cp /home/gitlab/data/backups/1684222315_2023_05_16_15.11.3_gitlab_backup.tar
 root@xxx.xx.xx.xx://home/gitlab/data/backups/

# 5. 进入容器
docker exec -it gitlab bash

# 6. 设置文件权限
chmod -R 777 1684222315_2023_05_16_15.11.3_gitlab_backup.tar

# 7. 停止数据库操作服务
gitlab-ctl stop unicorn 
gitlab-ctl stop sidekiq

# 8. 开始还原 注意这里只需要写_gitlab_backup.tar  前面的文件名即可
gitlab-rake gitlab:backup:restore BACKUP=1684222315_2023_05_16_15.11.3

# 9. 重启服务
gitlab-ctl restart

不同 docker 版本配置

version: '3'
services:
  gitlab:
    image: 'gitlab/gitlab-ce' # 这里一直修改 gitlab/gitlab-ce:11.0.6 gitlab/gitlab-ce:11.11.8
    container_name: gitlab
    restart: always
    environment:
      TZ: 'Asia/Shanghai'
      GITLAB_OMNIBUS_CONFIG: |
        gitlab_rails['time_zone'] = 'Asia/Shanghai'
    ports:
      - '7881:80'
      - '7883:443'
      - '7882:22'
    volumes:
      - /home/gitlab/config:/etc/gitlab
      - /home/gitlab/data:/var/opt/gitlab
      - /home/gitlab/logs:/var/log/gitlab
    privileged: true

Last updated