YAZONG 我的开源

关于GITLAB从8升版本到11

 
0 评论0 浏览

8到10版本,功能点变动小,只是控制台页面变动比较大,但是11版本和上述版本的变动会很大,在10升级11和11降版本为10/9/8版本时,比如安装GITLAB时附加安装的“postgresql版本、初始化、表结构、字段、数据等兼容性”问题、核心配置文件“/etc/gitlab/gitlab.rb”的配置项改动和相关配置文件的配置问题、备份方式和一些命令改动等,这是几个比较大的变动。

个人推荐,不要在同一台机器上做11版本以下和11版本以上的版本升级和版本降级(需完全删除相关配置,记得提前备份)操作,更多版本变化需参考

https://docs.gitlab.com/omnibus/update/gitlab_11_changes.html#114%20for%20details”

现有需求是从版本是8.14,升级到最新的11.9(这里只升级到10),官方给出的标准是不要跨大版本升级,需要先从8升到9,从9升到10,最终从10升到11。其中升级的每个版本需要是每个版本的最终版本。下载的最终版本列表为:

[root@bogon gitlab]# ll
-rw-r–r– 1 root root 409393945 Apr 19 18:15 gitlab-ce-10.8.7-ce.0.el6.x86_64.rpm
-rw-r–r– 1 root root 557405337 Apr 19 18:15 gitlab-ce-11.9.8-ce.0.el6.x86_64.rpm
-rw-r–r– 1 root root 308806786 Jul 10 2018 gitlab-ce-8.14.0-ce.0.el6.x86_64.rpm
-rw-r–r– 1 root root 395491350 Apr 19 18:14 gitlab-ce-9.5.9-ce.0.el6.x86_64.rpm
[root@bogon gitlab]# cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
8.14.0

#备份内容:

/etc/gitlab/gitlab.rb、/var/opt/gitlab/.ssh/authorized_keys、以及

通过gitlab-rake gitlab:backup:create命令的GITLAB全备份文件。

#版本升级(不要关闭现有GITLAB服务)

#升级9版本

[root@gitlab gitlab]# rpm -Uvh gitlab-ce-9.5.9-ce.0.el6.x86_64.rpm

[root@gitlab gitlab]# gitlab-ctl reconfigure

[root@gitlab gitlab]# gitlab-ctl restart

#验证此时GITLAB服务是否能正常使用

#升级10版本

[root@gitlab gitlab]# rpm -Uvh gitlab-ce-10.8.7-ce.0.el6.x86_64.rpm

warning: gitlab-ce-10.8.7-ce.0.el6.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY

error: Failed dependencies:
policycoreutils-python is needed by gitlab-ce-10.8.7-ce.0.el6.x86_64

[root@gitlab gitlab]# yum install policycoreutils-python

[root@gitlab gitlab]# rpm -Uvh gitlab-ce-10.8.7-ce.0.el6.x86_64.rpm

[root@bogon ~]# gitlab-ctl reconfigure

[root@bogon ~]# gitlab-ctl restart

#验证此时GITLAB服务是否能正常使用

#————-下述是在升11版本和从11降版本的异常案例:————

#初始化版本不一样

[root@bogon gitlab]# sudo gitlab-ctl tail postgresql

2019-04-26_08:36:54.82068 FATAL: database files are incompatible with server

2019-04-26_08:36:54.82070 DETAIL: The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 9.2.18.

#下述问题直接干掉这个目录

Error executing action delete on resource ‘file[/opt/gitlab/etc/gitaly/env]’

#核心配置文件/etc/gitlab/gitlab.rb属性改动

git_data_dirs({“default” => “/home/application/workspace/gitlab/gitlab-data-8.14”})

改为

git_data_dirs({“default” => {“path” => “/home/application/workspace/gitlab/gitlab-data-8.14”}})

#编译时的兼容性问题

  • Mixlib::ShellOut::ShellCommandFailed occurred in delayed notification: execute[clear the gitlab-rails cache] (gitlab::gitlab-rails line 400) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received ‘1’

—- Begin output of /opt/gitlab/bin/gitlab-rake cache:clear —-

STDOUT:

STDERR: rake aborted!

ActiveRecord::StatementInvalid: PG::InternalError: ERROR: missing chunk number 0 for toast value 70362 in pg_toast_2619
: SELECT a.attname, format_type(a.atttypid, a.atttypmod),
pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,
(SELECT c.collname FROM pg_collation c, pg_type t
WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation),
col_description(a.attrelid, a.attnum) AS comment
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = ‘”users”‘::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum
#编译时老数据不兼容问题(直接干掉postgresql目录下的所有数据和日志等文件即可)

[execute] psql: could not connect to server: Connection refused
Is the server running locally and accepting
connections on Unix domain socket “/var/opt/gitlab/postgresql/.s.PGSQL.5432”?


标题:关于GITLAB从8升版本到11
作者:yazong
地址:https://blog.llyweb.com/articles/2019/04/26/1578151277708.html