1Panel Gitea从1.21.3升级至1.21.4后,访问页面502的解决办法

今天顺手升级了一下Gitea容器,结果整个项目打不开了。查看容器日志是缺少Type字段:
日志截图日志截图

经过作者多次安装重建比对2个版本发现:1.21.4版本增加了postgresql数据库支持,而1.21.3强制绑定的mysql,导致容器配置文件缺少了配置项。(另附官方来源:https://github.com/1Panel-dev/1Panel/issues/1978
Github issue截图Github issue截图

解决方式也比较粗暴:补全配置后重建应用即可。下文是对应的解决步骤。

(1)补充.env的配置项,见11行。

1
2
3
4
5
6
7
8
9
10
11
12
13
CONTAINER_NAME="1Panel-gitea-****"
CPUS=0
HOST_IP="****"
MEMORY_LIMIT=0
PANEL_APP_PORT_HTTP=****
PANEL_APP_PORT_SSH=****
PANEL_DB_HOST="****"
PANEL_DB_HOST_NAME="****"
PANEL_DB_NAME="****"
PANEL_DB_PORT=****
PANEL_DB_TYPE="mysql" // 需要增加此项
PANEL_DB_USER="****"
PANEL_DB_USER_PASSWORD="****"

(2)替换data.yml的全部信息
此处主要用于安装时的配置表单(1Panel用的JSON生成操作表单)。

实际测试下来似乎不加也不影响。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
additionalProperties:
formFields:
- default: mysql
envKey: PANEL_DB_TYPE
labelEn: Database Service
labelZh: 数据库服务
required: true
type: apps
child:
default: ""
envKey: PANEL_DB_HOST
required: true
type: service
values:
- label: MySQL
value: mysql
- label: PostgreSQL
value: postgres
- default: gitea
envKey: PANEL_DB_NAME
labelEn: Database
labelZh: 数据库名
random: true
required: true
rule: paramCommon
type: text
- default: gitea
envKey: PANEL_DB_USER
labelEn: User
labelZh: 数据库用户
random: true
required: true
rule: paramCommon
type: text
- default: gitea
envKey: PANEL_DB_USER_PASSWORD
labelEn: Password
labelZh: 数据库用户密码
random: true
required: true
rule: paramComplexity
type: password
- default: 3000
envKey: PANEL_APP_PORT_HTTP
labelEn: Port
labelZh: HTTP 端口
required: true
rule: paramPort
type: number
- default: 222
envKey: PANEL_APP_PORT_SSH
labelEn: Port
labelZh: SSH 端口
required: true
rule: paramPort
type: number

(3)重建Gitea应用

重建完成后,打开页面就恢复正常啦。


评论区