Gitlab合并代码、数据库备份恢复、汉化与代码部署方式(小节3)


theme: juejin

highlight: a11y-dark

1.合并代码

102

cd /opt/web1 git checkout develop 页面信息 ``` vim index.html

Linux01 项目1

Linux01 web1 v5

<-- 更新、备注 git add ./* git commit -m "v5" 提交到开发 git push Username for 'http://192.168.37.101': zhangsan <-- Password for 'http://zhangsan@192.168.37.101': <--密码:1234.com Counting objects: 3, done. Delta compression using up to 2 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 314 bytes | 314.00 KiB/s, done. Total 3 (delta 1), reused 0 (delta 0) remote: remote: To create a merge request for develop, visit: remote: http://192.168.37.101/linux01/web1/merge requests/new?mergerequest%5Bsource_branch%5D=develop remote: To http://192.168.37.101/linux01/web1.git a4cefd4..8ca1d69 develop -> develop ```

zhangsan 图片.png 图片.png

切换到root\管理员账号 图片.png 图片.png 合并提交

图片.png

合并成功

图片.png 发布代码

102

``` cd /opt rm -rf web1/ git clone -b master http://192.168.37.101/linux01/web1.git cat web1/index.html

拷贝到远程主机

scp web1/index.html 192.168.37.105:/data/nginx/html/linux01/ ``` 105

可下载到本地继续开发 ``` cd /opt/

账号:zhangsan 密码:1234.com

git clone -b develop http://192.168.37.101/linux01/web1.git ``` 结果 图片.png

2. gitlab数据备份恢复

101 1. 停止服务 gitlab-ctl stop unicorn gitlab-ctl stop sidekiq 2. 备份数据 ```

在任意目录即可备份当前gitlab数据

gitlab-rake gitlab:backup:create 3. 搜索文件所在位置 find / -name *gitlabbackup.tar /var/opt/gitlab/backups/16761380232023021212.3.5gitlabbackup.tar 4. 启动服务 gitlab-ctl start ``` 测试能否备份、开始搞破坏、删除或修改一些内容

图片.png

图片.png

图片.png

  1. 开始恢复、先停止服务 gitlab-ctl stop unicorn gitlab-ctl stop sidekiq
  2. 再恢复 ``` gitlab-rake gitlab:backup:restore BACKUP=16761380232023021212.3.5 Unpacking backup ... done Before restoring the database, we will remove all existing tables to avoid future upgrade problems. Be aware that if you have custom tables in the GitLab database these tables and all data will be removed.

Do you want to continue (yes/no)? yes <-- 7. 启动服务 gitlab-ctl start ```

查看是否恢复 图片.png 数据回来了(还原成功)

图片.png

3. git汉化

汉化包地址:https://gitlab.com/xhang/gitlab/-/tags

3.1 下载语言包替换

101 1. 停服务 gitlab-ctl stop 2. 备份(防止汉化包有问题) cp -rp /opt/gitlab/embedded/service/gitlab-rails /opt/gitlab-rails.bak 3. 解压汉化包:Gitlab汉化包 tar xvf gitlab-v12.3.5-zh.tar.gz 4. 替换文件 ``` cp -rf gitlab-v12.3.5-zh/* /opt/gitlab/embedded/service/gitlab-rails/

替换时会出现下面两个报错、不过没关系

cp: cannot overwrite non-directory '/opt/gitlab/embedded/service/gitlab-rails/log' with directory 'gitlab-v12.3.5-zh/log' cp: cannot overwrite non-directory '/opt/gitlab/embedded/service/gitlab-rails/tmp' with directory 'gitlab-v12.3.5-zh/tmp' 5. 重新配置 gitlab-ctl reconfigure 6. 启动 gitlab-ctl start ```

图片.png 图片.png 图片.png

3.2 通过源码汉化

汉化包地址:https://gitlab.com/xhang/gitlab ``` cd /usr/local/src/ git clone https://gitlab.com/xhang/gitlab.git

查看当前gitlab版本(如:gitlab-ce 12.3.5)

head -1 /opt/gitlab/version-manifest.txt cd gitlab/

git diff v12.3.5 v12.3.5-zh git diff v12.3.5 v12.3.5-zh > /opt/gitlab-12.3.5.diff gitlab-ctl stop

p1表示第一个补丁

patch -f -d /opt/gitlab/embedded/service/gitlab-rails/ -p1 < /opt/gitlab-12.3.5.diff

gitlab-ctl reconfigure gitlab-ctl start ```

图片.png 图片.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值