群晖中升级gitlab的严重问题

重要:此文并未成功解决问题,仅对挣扎过程进行记录。如读者不幸遇到相同问题,在阅读下面问题描述之前,请暂停执行并备份数据,包括 postgresql 数据文件夹 和 gitlab 文件夹。

 

1. 跨版本升级

在套件中心中,若因版本太旧(跳过了1个或多个版本号),则需要手动安装。

从群晖应用页面安装特定版本:https://archive.synology.com/download/Package/Docker-GitLab/12.10.6-0059

注:下载离线安装(较小的 spk 文件)即可。通过群晖DSM套件中心右上角“手动安装”上传文件安装。

 

2. PostgreSQL升级失败:源问题

安装完成后启动失败,通过查询容器日志,发现在 postgresql 上出现了 “http://apt.postgresql.org/pub/repos/apt bionic-pgdg Release' does not have a Release file.”错误。

该错误是因为,软件升级完成后,postgresql 要对旧版本数据文件执行迁移(从10升级为11),迁移时需要上一版本的postgresql 10执行数据导出,故容器会执行apt-get install安装,当apt源失效时,则发生上述错误。

数据迁移动作仅在如下条件时发生:

  • 数据文件夹(gitlab/postgresql)下保存有名为“10”的旧数据文件夹,且没有名为“11”的新数据文件夹。

注:必须满足上述条件以执行数据迁移,才能正常使用,因此在继续执行的解决方案中,需要反复变更上述条件,以启动容器完成前置修改。

 

解决思路:修改 postgresql 容器的 sources.list ,使用国内阿里云镜像。

阿里云源

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

将原数据目录改名为 10_bak 重新运行,此时容器可以启动。

通过终端修改 sources.list ,然后停止、将数据文件夹 11 删除,将 10_bak 改回为 10。

 

3. PostgreSQL升级失败:权限问题

在成功安装postgresql10的情况下,迁移过程出错,提示

查看 pg_upgrade_server.log

参考:https://blog.margrop.net/post/jie-jue-postgresql-10-sheng-ji-zhi-11permissions-should-be-urwx-0700wen-ti/

 

 

4. GitLab 500错误

此错误在界面上无任何实质信息,在 gitlab 容器的 /var/gitlab/gitlab/production.log 中可见是由数据库结构变更引起。

当查询请求响应时,结果为“Completed 500 Internal Server Error”,其中 ActiveRecord内容为“StatementInvalid (PG::UndefinedColumn: ERROR:  column deploy_tokens.token_encrypted does not exist”,亦即在执行数据库查询时,SQL语句包含了对“deploy_tokens.token_encrypted”列的查询,但该信息在旧版本的数据库中并未定义。

 

5. 重装

由于群晖spk包将gitlab和postgresql捆绑安装,且升级后,gitlab数据库定义以及postgresql存储结构均发生了变化,因此升级后尝试修复的过程困难重重。

如果在升级之前,对现有gitlab数据文件夹(包含有repositories)和postgresql数据文件夹(包含gitlab配置数据库)进行过备份,则可移除gitlab后,下载原版本的spk安装包进行安装,安装完成后,将备份的文件夹数据覆盖即可。

 

posted @ 2023-12-04 14:13  崩溃侠  阅读(132)  评论(0编辑  收藏  举报
友情链接: Heroius' Ideas 沈阳因斯福环保安全科技有限公司 东北大学工业爆炸防护研究所