通过工具,找到升级路径

从 14.5.2=>14.9.5=>14.10.5=>15.0.5=>15.4.6,一路相安无事,正常 apt install。

15.11.13

从 15.4.6 升级 15.11.13 时,apt install 报错,关键错误日志如下,

PG::CheckViolation: ERROR: check constraint "check_70f294ef54" is violated by some row

根据官方的升级说明,按以下步骤修复,

1)root:~# sudo gitlab-psql

2)gitlabhq_production=# select * from oauth_access_tokens where expires_in IS NULL;
3)gitlabhq_production=# UPDATE oauth_access_tokens SET expires_in = '7200' WHERE expires_in IS NULL;

4)root:~# gilab-rake db:migrate

5)root:~# gitlab-rake db:migrate:status

6)root:~# apt install -f

进到数据库终端(1),查下记录(2),再按说明执行更新语句(3)。
执行成功后,退出到Shell终端,执行数据表迁移的命令(4)。
执行成功后,检查一下数据表迁移的状态,确保全部是UP/OK状态。
最后继续升级(6)。

16.1.6

从 15.11.13 升级 16.1.6 时,升级成功、没有报错。
但是无论LDAP还是Standard,都登录不进去。Standard登录时、页面报500错误。

找到关键日志,在登录时的关键报错信息如下,

root:~# tail -f /var/log/gitlab/gitlab-rails/production.log
...()
ActiveRecord::StatementInvalid (PG::CheckViolation: ERROR: new row for relation "users" violates check constraint "check_0dd5948e38"
...()

根据已有的故障报告,最终完成修复。

1)root~# gitlab-rails dbconsole
...(这里要稍等几秒钟,有点慢,并不是没响应)

2)gitlabhq_production=> select * from users WHERE user_type IS NULL;
3)gitlabhq_production=> UPDATE users SET user_type = 0 WHERE user_type IS NULL;

特别注意末尾的分号(3),无脑复制粘贴没用的……

16.3.7

正常 apt install,相安无事。
还有更新的版本,以后再说~