gitlab 从古老的 bitnami 版本 迁移到官方最新版本
这是我之前发布在 yuque 的文章。是我刚来新公司的时候帮公司搬迁 git 记录下来的,现在看来去掉敏感部分直接发布也没啥问题啦,就搬家过来,我自己也方便查 XD .
8.1.6 -> 10.1.4
首先需要分几个步骤
第一步
我将老版本 这里是从 bitnami gitlab 上安装的 8.1.4 版本
将这个版本下的所有现在有的数据进行备份。 使用
找到
/opt/gitlab-7.x.x-x/apps/gitlab/htdocs/config/gitlab.yml,将backup一项的路径改为"/data/backups_gitlab",注意目录的权限更改。
这个路径下面可以找到我们的 gitlab 配置文件,将 backup 的地址指定为我们想要其备份的地址。
之后开始备份,使用
cd /opt/gitlab-7.x.x-x/
./use_gitlab
cd /opt/gitlab-7.x.x-x/apps/gitlab/htdocs
bundle exec bin/rake gitlab:backup:create RAILS_ENV=production
报错情况1:
You have already activated rake 0.9.2.2,but our Gemfile requires rake 10.1.0,Using bundle exec may solve this.
原因是默认的path路径不对,需要执行下bitnami自带的环境变量设置脚本: 执行安装目录下use_gitlab即可解决。
报错情况2:笔者使用的数据库为MySQL,报错
Can't connect to local MySQL server through socket.
解决方法为用find指令找到MySQL实际使用的.sock文件,在报错中的目录下建立软链接。
之后我们就能在原来的机器上获得一个备份好的压缩包
这里注意 backup 的时候不能停机,备份的时候可能会去尝试链接还在运行的数据库,如果服务 down 了会链接失败。
第二步
由于我要到新机器上部署我的新版本,所以我在另外一台机器上下载好了跟之前 bitnami 一样的版本,这个版本是官方的 Omnibus 版本。我手动下载的 .rpm 包。
我这里采用手动安装:
sudo EXTERNAL_URL="http://127.0.0.1:8081" rpm -i gitlab-ee-9.5.2-ee.0.el7.x86_64.rpm
Installing the GitLab Package
With the desired package downloaded, use your systems package management tool to install it. For example:
DEB based (Ubuntu, Debian, Raspberry Pi):
sudo EXTERNAL_URL="http://gitlab.example.com" dpkg -i gitlab-ee-9.5.2-ee.0_amd64.deb
RPM based (CentOS, RHEL, Oracle, Scientific, openSUSE, SLES):
sudo EXTERNAL_URL="http://gitlab.example.com" rpm -i gitlab-ee-9.5.2-ee.0.el7.x86_64.rpmChange
http://gitlab.example.comto the URL at which you want to access your GitLab instance. Installation will automatically configure and start GitLab at that URL.
[root@iZ2ze9mbirr18cl7fb5ewtZ gitlab]# sudo EXTERNAL_URL="http://git.hundun.cn" rpm -i gitlab-ce-8.1.4-ce.0.el7.x86_64.rpm
gitlab: Thank you for installing GitLab!
gitlab: To configure and start GitLab, RUN THE FOLLOWING COMMAND:
sudo gitlab-ctl reconfigure
gitlab: GitLab should be reachable at http://iZ2ze9mbirr18cl7fb5ewtZ
gitlab: Otherwise configure GitLab for your system by editing /etc/gitlab/gitlab.rb file
gitlab: And running reconfigure again.
gitlab:
gitlab: For a comprehensive list of configuration options please see the Omnibus GitLab readme
gitlab: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
gitlab:
It looks like GitLab has not been configured yet; skipping the upgrade script.
执行 sudo gitlab-ctl reconfigure 会开始配置下载好的 gitlab ,之后我们就可以使用 gitlab-ctl 来执行 gitlab 的 start|end|restart 等等命令了。
可以通过 ps -ef 查看 gitlab 的 nginx 读取哪儿的配置文件如下:
nginx: master process /opt/gitlab/embedded/sbin/nginx -p /var/opt/gitlab/nginx
所以我们可以在 /var/opt/gitlab 下面找到最新的配置文件。
Next, install the GitLab package. Change `http://gitlab.example.com` to the URL at which you want to access your GitLab instance. Installation will automatically configure and start GitLab at that URL. HTTPS requires additional configuration after installation.
sudo EXTERNAL_URL="http://gitlab.example.com" yum install -y gitlab-ee
其实当我们在安装的时候 让我们设置的一个地址可以让外部访问,那个地址会让 gitlab 自动生成一个 nginx 配置文件,监听的 server_name 就是我们设置的地址,如果需要反向代理我们可能需要去 gitlab 的 nginx 配置目录下面修改这个监听地址。如果没有反向代理,看上去直接设置之后就可以使用了(这里一般都是需要定制的,感觉 gitlab 这个也给自动设置有点过于优化了。不过也体现出人家尽量提升用户体验的感觉吧)。
第三步
拷贝备份到新机器上 这个简单 scp 一下就行了 like this
scp /home/a.txt root@192.168.0.8:/home/root
从本地 传输到 192.168.0.8
然后就是 restore
现将之前的复制包 拷贝到 omnibus 版本的 backup 目录
之后停掉其中两个服务并且 check 其状态。
恢复完毕之后让我们 check 其状态。
sudo cp 11493107454_2018_04_25_10.6.4-ce_gitlab_backup.tar /var/opt/gitlab/backups/Stop the processes that are connected to the database. Leave the rest of GitLab running:
sudo gitlab-ctl stop unicorn
sudo gitlab-ctl stop sidekiqVerify
sudo gitlab-ctl statusNext, restore the backup, specifying the timestamp of the backup you wish to restore:
This command will overwrite the contents of your GitLab database!
这里会重写数据库和内容,因为是恢复备份所有都会清掉所以特意让我们注意。
sudo gitlab-rake gitlab:backup:restore BACKUP=1493107454_2018_04_25_10.6.4-ceNext, restore /etc/gitlab/gitlab-secrets.json if necessary as mentioned above.
Restart and check GitLab:
sudo gitlab-ctl restart
sudo gitlab-rake gitlab:check SANITIZE=trueIf there is a GitLab version mismatch between your backup tar file and the installed version of GitLab, the restore command will abort with an error. Install the correct GitLab version and try again.
这里特别注意,所有的恢复迁移工作都是建立在备份的版本和安装的新版本相同的情况下。
第四步
通过官方渠道升级到最新版本。(未完待续)
# Debian/Ubuntu
dpkg -i gitlab-ce-XXX.deb # CentOS/RHEL
rpm -Uvh gitlab-ce-XXX.rpm
分别使用这两个包管理工具进行升级。
升级过于老旧的版本需要脚本放得很缓慢,基本上最多 3个 mirror 一升,否则就会出错。而且是无法挽回的错误又得重来。另外记得每次升级完成后 重启然后修改 nginx 参数。
完成升级之后可以留意一下 git 的 host 是否正常。例如如果你使用阿里云却不配置对外访问地址,那么git host 应该会出现非常奇怪的地址。所以需要配置 gitlab 配置文件将对外地址项改成域名。然后 gitlab-ctl reconfigure 一下生效即可。
虽然这里记录的东西最少,但是这里几乎最耗时,来来回回包括查资料差不多 8 小时吧。最开始还想一步到位升上去简直太天真了。
之后 linux 下删除软件尽量使用对方提供的现成方法,并且找到所有的删掉可以使用 find 方法。
find / -iname 'xxx'
QA:
Q: 卡在卸载gitlab然后再次安装执行sudo gitlab-ctl reconfigure的时候往往会出现:ruby_block[supervise_redis_sleep] action run,会一直卡无法往下进行!
A:
1、按住CTRL+C强制结束;
2、运行:sudo systemctl restart gitlab-runsvdir;
3、再次执行:sudo gitlab-ctl reconfigure
https://www.cnblogs.com/springwind2006/p/6872773.html
Q: 数据库恢复密码丢了。
A: https://docs.gitlab.com/ee/security/reset_root_password.html#doc-nav
Reference:
https://packages.gitlab.com/app/gitlab/gitlab-ce/search gitlab 发布包地址
http://xlindo.com/2015/08/18/gitlab备份与恢复操作方法/ gitlab bitnami 备份恢复文档
https://community.bitnami.com/t/upgrade-bitnami-gitlab-ce-version/48641 bitnami 官方论坛关于升级问题
https://docs.gitlab.com.cn/omnibus/update/README.html#updating-from-gitlab-66-and-higher-to-the-latest-version gitlab 官方文档 -> Updating GitLab via omnibus-gitlab
https://docs.gitlab.com/ee/raketasks/backup_restore.html#restore restore for Omnibus
https://about.gitlab.com/installation/#centos-7 官方安装文档
https://docs.gitlab.com/ee/policy/maintenance.html#versioning 官方推荐升级路径
https://about.gitlab.com/blog/categories/releases/ 官方 relase 文档
https://www.jianshu.com/p/a86a1529d253 nginx反向代理 gitlab
https://docs.gitlab.com/omnibus/settings/smtp.html gitlab SMTP settings
gitlab 从古老的 bitnami 版本 迁移到官方最新版本的更多相关文章
- Webstorm官方最新版本for Mac版本 不用注册码/破坏原文件
首先,说明下我自己安装的时候看到网上无外乎两种方法: 下载别人封装好的安装包,把JetbrainsCrack.jar复制到/Applications/WebStorm.app/Contents/bin ...
- Apple历史应用以及开发工具版本(Xcode官方历史版本等等)
1.Xcode 官方历史版本下载:(需要登录开发者账号) https://developer.apple.com/download/more/
- [Angular] 删除旧版本,升级安装最新版本
目录 删除旧版本 清除未卸载干净的angular-cli缓存 对于Linux 对于Windows 安装最新版本 查看安装版本 创建新项目 删除旧版本 npm uninstall -g angular- ...
- 记录下pytorch代码从0.3版本迁移到0.4版本要做的一些更改。
1. UserWarning: Implicit dimension choice for log_softmax has been deprecated. Change the call to in ...
- CoreData的简单使用(二)数据的增删改查,轻量级的版本迁移
上一篇中我们已经使用CoreData创建了一个SQLite数据库 CoreData的简单使用(一)数据库的创建 现在对数据库进行数据的CRUD(增删改查) 1.Data Model 的设置 创建一个D ...
- CentOS 6.6 升级GCC G++ (当前最新版本为v6.1.0) (完整)
---恢复内容开始--- CentOS 6.6 升级GCC G++ (当前最新GCC/G++版本为v6.1.0) 没有便捷方式, yum update.... yum install 或者 添加y ...
- phpstudy2016最新版本mysql无法使用innodb的问题解决
这里顺便记录一下今天遇见的神奇问题,在使用官方最新版本的phpstudy中,其它组件一切正常,但是奇怪的发现mysql是无法开启innodb的,以下为最新的下载地址: http://www.phpst ...
- Struts2漏洞拉响网站安全红色警报以及把Struts2更新为最新版本Struts2.3.15.1步骤
360网站安全检测平台今日发布红色警报称,广泛应用在国内大型网站系统的Struts2框架正在遭到黑客猛烈攻击.利用Struts2“命令执行漏洞”,黑客可轻易获得网站服务器ROOT权限.执行任意命令,从 ...
- 【转】CentOS 6.6 升级GCC G++ (当前最新版本为v6.1.0) (完整)
原文地址:https://www.cnblogs.com/lzpong/p/5755678.html 我这里是centos7 升级到gcc8.1,过程差不多,参考这篇文章,记录一下. ---原文--- ...
随机推荐
- windows10结束进程
.net winfrom 程序关于结束进程触发事件 在任务管理器中有进程.详细信息栏 在进程栏对应用程序结束任务,会触发应用程序窗体的FormClosed事件 在详细信息栏对应用程序结束任务,不会触发 ...
- 聊聊webpack 4
前言 hello,小伙伴们,本篇仓库出至于我的GitHub仓库 web-study ,如果你觉得对你有帮助的话欢迎star,你们的点赞是我持续更新的动力 web-study webpack 打包工具 ...
- 根父类:Object 类
一.Object类 Java中规定: 如果一个类没有显式声明它的父类(即没有写extends xx),那么默认这个类的父类就是java.lang.Object. 类 Object 是类层次结构的根类. ...
- Java 之 日期时间类
一.Date类 1.概述 java.util.Date 类 表示特定的瞬间,精确到毫秒. 2.构造方法 public Date():分配Date对象并初始化此对象,以表示分配它的时间(精确到毫秒) p ...
- java.lang.UnsatisfiedLinkError: dlopen failed: library "/system/lib/libjni_i
出错log:java.lang.UnsatisfiedLinkError: dlopen failed: library "/system/lib/libskytvjni.so" ...
- Apache Kafka是数据库吗?
最近思路有些枯竭,找些务虚的话题来凑.本文内容完全来自于Martin Kelppmann在2019年Kafka伦敦峰会上的演讲.顺便提一句,Kelppmann是<Designing Data-I ...
- 简述-selenium对web实现自动化测试
首先,我是基于python进行对selenium操作和使用的,主要分为selenium的实现原理和selenium的操作这两大部分的简单分享(由于本人水平有限,仅做基础的概述和总结): 一.selen ...
- 浅谈Python设计模式 - 原型模式
声明,本系列文章主要参考<精通Python设计模式>一书,并且参考一些资料,结合自己的一些看法来总结而来. 在<精通Python设计模式>中把设计模式分为三种类型: 创建型模式 ...
- ZYNQ7000性能分析
提到自动驾驶,机器人视觉,高清摄像机,都要想到摄像头这个单元,先前本侠也讲过一些FPGA应用在高清摄像头和机器视觉中的深度摄像头以及双目摄像头等,FPGA在里面的作用主要是对采集的图像进行处理,对图像 ...
- spring cloud微服务实战教程/pdf/视频/百度云资源
资源站:http://www.supan.vip 点击进入直接查找资源: http://www.supan.vip/spring%20cloud微服务实战 <Spring Cloud微服务实战& ...