侧边栏壁纸
博主头像
抱头虎窜

行动起来,活在当下

  • 累计撰写 10 篇文章
  • 累计创建 18 个标签
  • 累计收到 0 条评论

目 录CONTENT

文章目录

Docker版GitLab备份迁移

LuLu
2025-06-17 / 0 评论 / 1 点赞 / 9 阅读 / 0 字

查看版本

sudo gitlab-rake gitlab:env:info

备份

sudo gitlab-rake gitlab:backup:create RAILS_ENV=production

移动到目标服务器

使用scp命令​将备份文件复制到目标主机

​scp username@ip:/var/opt/gitlab/backups/1728457011_2024_10_09_14.3.3_gitlab_backup.tar /data/gitlab/data/backups/1728457011_2024_10_09_14.3.3_gitlab_backup.tar

部署docker版本的GitLab

version: '3.6'
services:
  gitlab:
    image: gitlab/gitlab-ce:14.3.3-ce.0
    container_name: gitlab
    restart: unless-stopped
    hostname: 'gitlab'
    environment:
      TZ: "Asia/Shanghai"
      GITLAB_OMNIBUS_CONFIG: |
        external_url "http://xxx.xx.xx.xx:8000"
        postgresql['shared_buffers'] = "256MB"
        gitlab_rails['time_zone'] = 'Asia/Shanghai'
        sidekiq['concurrency'] = 4
        prometheus_monitoring['enable'] = false
        gitlab_rails['gitlab_shell_ssh_port'] = 2222
    ports:
      - '8000:8000'
      - '2222:22'
    volumes:
      - './config:/etc/gitlab'
      - './logs:/var/log/gitlab'
      - './data:/var/opt/gitlab'
    shm_size: '256m'
    networks:
      - net-public
networks:
  net-public:
    external: true

恢复数据

docker exec -it gitlab_gitlab_1 /bin/bash

gitlab-rake gitlab:backup:restore RAILS_ENV=production BACKUP=1728457011_2024_10_09_14.3.3

1

评论区