在Linux中进行GitLab数据迁移的方法有多种,以下是一些常见的方法:
gitlab-ce/yum
进行版本迁移查看Linux系统版本信息:
cat /proc/version
cat /etc/redhat-release
安装依赖包:
yum install policycoreutils openssh-server openssh-clients postfix
systemctl enable sshd
systemctl start sshd
systemctl enable postfix
systemctl start postfix
下载并安装对应版本的GitLab RPM包:
例如,下载CentOS 7版本的GitLab:
cd /usr/local/rpm
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-13.10.2-ce.0.el7.x86_64.rpm
chown -R git:git /usr/local/rpm
rpm -ivh gitlab-ce-13.10.2-ce.0.el7.x86_64.rpm
修改配置文件 /etc/gitlab/gitlab.rb
:
external_url
为服务器公网IP。gitlab_rails['backup_path']
。重新配置并启动GitLab:
gitlab-ctl reconfigure
gitlab-ctl start
congregate
工具进行数据迁移拉取 congregate
镜像:
docker pull registry.cn-hangzhou.aliyuncs.com/dockerforkevin/congregate:centos-20220312
运行容器并修改 /var/run/docker.sock
权限:
docker run -v /var/run/docker.sock:/var/run/docker.sock -v /etc/hosts:/etc/hosts -p 8000:8000 -it 4bd6a78c0a68 /bin/bash
添加配置文件 congregate.conf
:
[DESTINATION]
dstn_hostname http://new.mygitlab.com
dstn_access_token ek04Xy1RbzVpVk5IWnFYYVY3enM
import_user_id 4
shared_runners_enabled True
project_suffix False
max_import_retries 3
username_suffix gd
mirror_username max_asset_expiration_time 24
[SOURCE]
src_type GitLab
src_hostname http://old.mygitlab.com
src_access_token aW9uQ3B2TlhkWVpwRnNQV2h5SC0
src_tier core
export_import_timeout 300
[EXPORT]
location filesystem
filesystem_path /opt/congregate
[USER]
keep_inactive_users False
reset_pwd True
force_rand_pwd False
[APP]
export_import_status_check_time 10
wave_spreadsheet_path wave
mongo_host localhost
mongo_port 27017
ui_port 8000
processes 4
获取源仓库的元数据:
./congregate.sh list
通过UI方式创建需要迁移的对象的列表:
./congregate.sh ui
执行迁移:
./congregate.sh migrate --skip-group-export --skip-group-import --skip-project-export --skip-project-import --commit
请注意,具体的迁移步骤可能会因GitLab版本和服务器环境的不同而有所差异。在执行迁移之前,请确保详细阅读GitLab官方文档,并在测试环境中进行充分的测试。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>