Gitlab升级-适用于通过RPM包安装的Gitlab | IT运维网
  • 本站启用了账户登录密码错误就锁定模式,如有人误操作被锁请邮件(yvan.lu@ityww.cn)告知我账户名。
  • 本站为个人技术性站点,上面会更新一些系统、网络、虚拟化及云计算等相关的文章,与大家一起参考、学习和交流。
  • 欢迎访问本网站;本站QQ交流群:654792529;如果您觉得本站非常有看点,那么赶紧使用Ctrl+D收藏吧!

Gitlab升级-适用于通过RPM包安装的Gitlab

Git-Gitlab yvan 6年前 (2018-08-14) 5315次浏览 已收录 0个评论 扫描二维码

说明:前面我们部署了Gitlab11.1.4环境,版本显得有点低了,需要升级下,下面操作从版本11.1.4升级到版本11.5.6

1、查看当前Gitlab版本:rpm -qa gitlab-ce

[root@izuf6fy69k7l7e20jogcj7z ~]# rpm -qa gitlab-ce
gitlab-ce-11.1.4-ce.0.el7.x86_64

2、停止Gitlab部分服务:
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
gitlab-ctl stop nginx

[root@izuf6fy69k7l7e20jogcj7z ~]# rpm -qa gitlab-ce
gitlab-ce-11.1.4-ce.0.el7.x86_64
[root@izuf6fy69k7l7e20jogcj7z ~]# gitlab-ctl stop unicorn
ok: down: unicorn: 0s, normally up
[root@izuf6fy69k7l7e20jogcj7z ~]# gitlab-ctl stop sidekiq
ok: down: sidekiq: 0s, normally up
[root@izuf6fy69k7l7e20jogcj7z ~]# gitlab-ctl stop nginx
ok: down: nginx: 0s, normally up

3、下载新版本RPM包:wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.5.6-ce.0.el7.x86_64.rpm

[root@izuf6fy69k7l7e20jogcj7z ~]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.5.6-ce.0.el7.x86_64.rpm
--2018-08-14 14:15:26--  https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.5.6-ce.0.el7.x86_64.rpm
Resolving mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.8.193, 2402:f000:1:408:8100::1
Connecting to mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.8.193|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 463096377 (442M) [application/x-redhat-package-manager]
Saving to: ‘gitlab-ce-11.5.6-ce.0.el7.x86_64.rpm’

100%[=================================================================================================================================================>] 463,096,377 11.1MB/s   in 90s

2018-08-14 14:16:56 (4.89 MB/s) - ‘gitlab-ce-11.5.6-ce.0.el7.x86_64.rpm’ saved [463096377/463096377]

4、升级:rpm -Uvh gitlab-ce-11.5.6-ce.0.el7.x86_64.rpm

gitlab Reconfigured!
Checking for an omnibus managed postgresql: OK
Checking for a newer version of PostgreSQL to install
No new version of PostgreSQL installed, nothing to upgrade to
Ensuring PostgreSQL is updated: OK
Restarting previously running GitLab services
ok: run: alertmanager: (pid 21759) 1s
ok: run: gitaly: (pid 21675) 6s
ok: run: gitlab-monitor: (pid 21709) 5s
ok: run: gitlab-workhorse: (pid 21664) 6s
ok: run: logrotate: (pid 21868) 1s
ok: run: node-exporter: (pid 21692) 6s
ok: run: postgres-exporter: (pid 21848) 2s
ok: run: postgresql: (pid 17900) 1361s
ok: run: prometheus: (pid 21729) 4s
ok: run: redis: (pid 21655) 7s
ok: run: redis-exporter: (pid 21718) 5s

     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ `/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /
  \____/_/\__/_____/\__,_/_.___/


Upgrade complete! If your GitLab server is misbehaving try running
  sudo gitlab-ctl restart
before anything else.
If you need to roll back to the previous version you can use the database
backup made during the upgrade (scroll up for the filename).

5、重启Gitlab服务:gitlab-ctl restart

[root@izuf6fy69k7l7e20jogcj7z ~]# gitlab-ctl restart
ok: run: alertmanager: (pid 22016) 1s
ok: run: gitaly: (pid 22024) 0s
ok: run: gitlab-monitor: (pid 22035) 0s
ok: run: gitlab-workhorse: (pid 22046) 0s
ok: run: logrotate: (pid 22054) 0s
ok: run: nginx: (pid 22067) 1s
ok: run: node-exporter: (pid 22072) 0s
ok: run: postgres-exporter: (pid 22076) 1s
ok: run: postgresql: (pid 22084) 0s
ok: run: prometheus: (pid 22092) 1s
ok: run: redis: (pid 22137) 0s
ok: run: redis-exporter: (pid 22181) 1s
ok: run: sidekiq: (pid 22186) 0s
ok: run: unicorn: (pid 22193) 0s

6、查看当前已安装版本:rpm -qa gitlab-ce

[root@izuf6fy69k7l7e20jogcj7z ~]# rpm -qa gitlab-ce
gitlab-ce-11.5.6-ce.0.el7.x86_64

以下版本升级后重新汉化操作,无需汉化忽略即可

1、下载Gitlab汉化版本库:git clone https://gitlab.com/xhang/gitlab.git
        PS:如已克隆过目录已存在则执行更新命令(git fetch)更新即可
2、查看确认该汉化包版本:cat gitlab/VERSION

[root@izuf6fy69k7l7e20jogcj7z ~]# cat gitlab/VERSION
11.5.6

3、停止Gitlab服务:gitlab-ctl stop

[root@izuf6fy69k7l7e20jogcj7z ~]# gitlab-ctl stop
ok: down: alertmanager: 0s, normally up
ok: down: gitaly: 1s, normally up
ok: down: gitlab-monitor: 0s, normally up
ok: down: gitlab-workhorse: 1s, normally up
ok: down: logrotate: 0s, normally up
ok: down: nginx: 0s, normally up
ok: down: node-exporter: 1s, normally up
ok: down: postgres-exporter: 0s, normally up
ok: down: postgresql: 1s, normally up
ok: down: prometheus: 0s, normally up
ok: down: redis: 1s, normally up
ok: down: redis-exporter: 0s, normally up
ok: down: sidekiq: 0s, normally up
ok: down: unicorn: 0s, normally up

4、进入Gitlab汉化目录:cd gitlab

[root@izuf6fy69k7l7e20jogcj7z ~]# pwd
/root
[root@izuf6fy69k7l7e20jogcj7z ~]# cd gitlab

5、指定版本比较汉化标签和原标签并导出patch用的diff文件到/root下:git diff v11.5.6 v11.5.6-zh > ../11.5.6-zh.diff

[root@izuf6fy69k7l7e20jogcj7z gitlab]# git diff v11.5.6 v11.5.6-zh > ../11.5.6-zh.diff
[root@izuf6fy69k7l7e20jogcj7z gitlab]# ll ../
total 885388
-rw-r--r--  1 root root   1154536 Jan 11 13:58 11.1.4-zh.diff
-rw-r--r--  1 root root    953767 Jan 11 14:35 11.5.6-zh.diff
drwxr-xr-x 29 root root      4096 Jan 11 13:56 gitlab
-rw-r--r--  1 root root 441423852 Aug  1 05:41 gitlab-ce-11.1.4-ce.0.el7.x86_64.rpm
-rw-r--r--  1 root root 463096377 Jan  1 03:18 gitlab-ce-11.5.6-ce.0.el7.x86_64.rpm

6、将刚刚导出的diff文件作为补丁更新到本地Gitlab中:patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < ../11.5.6-zh.diff        #一路回车到底

[root@izuf6fy69k7l7e20jogcj7z gitlab]# patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < ../11.5.6-zh.diff
can't find file to patch at input line 5
Perhaps you used the wrong -p or –strip option?
The text leading up to this was:
————————–
|diff –git a/app/assets/javascripts/awards_handler.js b/app/assets/javascripts/awards_handler.js
|index cace8bb..c4795a5 100644
|— a/app/assets/javascripts/awards_handler.js
|+++ b/app/assets/javascripts/awards_handler.js
————————–
File to patch:
Skip this patch? [y]
Skipping patch.
4 out of 4 hunks ignored
can't find file to patch at input line 48
Perhaps you used the wrong -p or –strip option?
The text leading up to this was:
————————–
|diff –git a/app/assets/javascripts/behaviors/quick_submit.js b/app/assets/javascripts/behaviors/quick_submit.js
|index c1ea67f..19636d7 100644
|— a/app/assets/javascripts/behaviors/quick_submit.js
|+++ b/app/assets/javascripts/behaviors/quick_submit.js
————————–
……此处省略……
File to patch:
Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored
patching file app/controllers/abuse_reports_controller.rb
patching file app/controllers/admin/appearances_controller.rb
……此处省略……
patching file config/initializers/9_fast_gettext.rb
patching file config/initializers/date_time_formats.rb
The next patch would create the file config/locales/devise.zh_CN.yml,
which already exists!  Assume -R? [n] Apply anyway? [n] Skipping patch.
1 out of 1 hunk ignored
The next patch would create the file config/locales/doorkeeper.zh_CN.yml,
which already exists!  Assume -R? [n] Apply anyway? [n] Skipping patch.
1 out of 1 hunk ignored
The next patch would create the file config/locales/sherlock.zh_CN.yml,
which already exists!  Assume -R? [n] Apply anyway? [n] Skipping patch.
1 out of 1 hunk ignored
The next patch would create the file config/locales/zh_CN.yml,
which already exists!  Assume -R? [n] Apply anyway? [n] Skipping patch.
1 out of 1 hunk ignored
patching file lib/gitlab/access.rb
patching file lib/gitlab/project_template.rb
patching file lib/gitlab/slash_commands/presenters/issue_base.rb
patching file public/404.html
patching file public/422.html
patching file public/500.html
patching file public/502.html
patching file public/503.html
patching file public/deploy.html

7、启动Gitlab服务:gitlab-ctl start

[root@izuf6fy69k7l7e20jogcj7z gitlab]# gitlab-ctl start
ok: run: alertmanager: (pid 22947) 0s
ok: run: gitaly: (pid 22955) 1s
ok: run: gitlab-monitor: (pid 22967) 0s
ok: run: gitlab-workhorse: (pid 22970) 0s
ok: run: logrotate: (pid 22985) 0s
ok: run: nginx: (pid 22995) 0s
ok: run: node-exporter: (pid 23002) 1s
ok: run: postgres-exporter: (pid 23006) 0s
ok: run: postgresql: (pid 23011) 1s
ok: run: prometheus: (pid 23019) 0s
ok: run: redis: (pid 23028) 1s
ok: run: redis-exporter: (pid 23032) 0s
ok: run: sidekiq: (pid 23113) 0s
ok: run: unicorn: (pid 23120) 1s
#此时汉化操作已完成,Gitlab服务刚启动会有访问页面502错误,稍等下刷新下即可;如有异常请执行重新配置命令(gitlab-ctl reconfigure)即可

IT运维网 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明Gitlab升级-适用于通过RPM包安装的Gitlab
喜欢 (3)
yvan
关于作者:
聪明来自勤奋、知识在于积累、好记性不如烂键盘!

您必须 登录 才能发表评论!