gitlab倉庫遷移方案


gitlab遷移方案

需求

  1. gitlab-hz.rubikstack.com 倉庫是容器形式,不穩定,期望改成在物理機上面直接部署gitlab應用
  2. 目前存在多個gitlab倉庫,需要合並成一個
  3. gitlab版本升級到最新

方案一:

  1. 手動刪除gitlab.cjy.com、gitlab-hz.cjy.com中不存在項目的群組、用戶(已過濾一遍
  2. gitlab-hz.cjy.com整體遷移到新的物理機環境上
    (通過命令遷移,gitlab版本目前為9.4.1,需升級到 13.10.2)

步驟:

版本升級需經歷版本

9.4.1-->9.5.9-->10.8.7-->11.0.1-->11.11.8-->12.0.1-->12.10.14-->13.0.1-->13.0.14-->13.10.2

  1. 在新物理機中搭建版本為9.4.1的gitlab
#設置鏡像倉庫
curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash

#安裝9.4.1版本
yum install gitlab-ce-9.4.1-ce.0.el7.x86_64 -y

#查看安裝版本
cat /opt/gitlab/embedded/service/gitlab-rails/VERSION

#給gitlab服務綁定域名
vim /etc/gitlab/gitlab.rb

#填寫你指定的綁定域名和端口,默認是80端口
external_url 'http://gitlab.ciika.com'

#更新配置
gitlab-ctl reconfigure

#重啟
gitlab-ctl restart

#訪問地址
http://gitlab.ciika.com

  1. 在gitlab-hz.cjy.com對應的物理機中備份數據,並且拷貝到新的物理機中
#備份數據
gitlab-rake gitlab:backup:create

#拷貝數據
SCP DC_Group.tar.gz 10.110.18.93:/var/opt/gitlab/git-data/


  1. 在新的物理機上恢復數據
#恢復數據
gitlab-rake gitlab:backup:restore BACKUP=1617862575_2021_04_08_9.4.1

#更新配置
gitlab-ctl reconfigure

#重啟
gitlab-ctl restart

#訪問gitlab地址
每次升級版本之后,都需要驗證一下,地址是否能夠訪問

  1. 按照版本列表,循環執行下面操作
#更新版本號,X.X.X為版本號
yum install gitlab-ce-X.X.X-ce.0.el7.x86_64 -y

#更新配置
gitlab-ctl reconfigure

#重啟
gitlab-ctl restart

  1. gitlab.cjy.com倉庫遷移,需寫代碼配合
    參考鏈接:http://www.uml.org.cn/pzgl/201901223.asp

遇到的問題:

  1. 安裝12.10.14之后出現 deploy in process

解決方式:

gitlab-ctl deploy-page status

gitlab-ctl deploy-page down

2.安裝13.0.1和13.0.14出現502

解決方式:

參考地址:https://forum.gitlab.com/t/502-whoops-gitlab-is-taking-too-much-time-to-respond-after-13-x-update/39109/8

編輯/etc/gitlab/gitlab.rb

puma['enabled'] = true
# this can be any port so long as it matches gitlab_workhorse['auth_backend']
puma['port'] = 8098
unicorn['enabled'] = false
gitlab_workhorse['auth_backend'] = "http://localhost:8098"

方案二:

手動刪除gitlab.cjy.com、gitlab-hz.cjy.com中不存在項目的群組

通過代碼將倉庫合並到同一個(相關過濾邏輯等)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM