From 16b7329ba96598ff6bd65a0150a462745cfd7a42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=8C=E6=A3=AE?= Date: Thu, 18 Jul 2024 11:22:42 +0800 Subject: [PATCH] =?UTF-8?q?Gitea=20=E9=85=8D=E7=BD=AE=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 萌森 --- gitea/1.22.1/data.yml | 97 ++++++++++++++++++++++++++++----- gitea/1.22.1/docker-compose.yml | 12 ++-- gitea/README.md | 31 ++++++++++- 3 files changed, 119 insertions(+), 21 deletions(-) diff --git a/gitea/1.22.1/data.yml b/gitea/1.22.1/data.yml index 0829f630d..c70edfc1d 100644 --- a/gitea/1.22.1/data.yml +++ b/gitea/1.22.1/data.yml @@ -54,19 +54,21 @@ additionalProperties: value: postgresql - label: MySQL (MariaDB, Percona) value: mysql + - label: SQLite3 (忽略数据库配置) + value: sqlite3 - default: "127.0.0.1" edit: true envKey: DB_HOSTNAME labelZh: 数据库 主机地址 labelEn: Database Host - required: true + required: false type: text - default: 5432 edit: true envKey: DB_PORT labelZh: 数据库 端口 labelEn: Database Port - required: true + required: false rule: paramPort type: number - default: "gitea" @@ -74,7 +76,7 @@ additionalProperties: envKey: DB_USER labelZh: 数据库 用户名 labelEn: Database User - required: true + required: false type: text - default: "" edit: true @@ -82,7 +84,7 @@ additionalProperties: labelEn: Database Password labelZh: 数据库 密码 random: true - required: true + required: false rule: paramComplexity type: password - default: "gitea" @@ -90,7 +92,7 @@ additionalProperties: envKey: DB_NAME labelZh: 数据库 名称 labelEn: Database Name - required: true + required: false type: text - default: "Gitea" edit: true @@ -113,6 +115,14 @@ additionalProperties: labelEn: SSH Clone Domain required: true type: text + - default: 22 + edit: true + envKey: SSH_PORT + labelZh: SSH 克隆显示端口 + labelEn: SSH Clone Display Port + required: true + rule: paramPort + type: number - default: "" edit: true envKey: ROOT_URL @@ -172,15 +182,15 @@ additionalProperties: - default: "" edit: true envKey: SECRET_KEY - labelZh: 全局密钥 (覆盖级) - labelEn: Global Secret Key (Override) + labelZh: 全局加密密钥 + labelEn: Global Secret Key required: false type: text - default: "false" edit: true envKey: PROXY_ENABLED - labelZh: 启用代理 - labelEn: Enable Proxy + labelZh: 启用代理 (全局 + Webhook) + labelEn: Enable Proxy (Global + Webhook) required: true type: select values: @@ -191,14 +201,75 @@ additionalProperties: - default: "" edit: true envKey: PROXY_URL - labelZh: 代理服务器地址 - labelEn: Proxy Server URL + labelZh: 代理服务器地址 (全局 + Webhook) + labelEn: Proxy Server URL (Global + Webhook) required: false type: text - default: "**" edit: true envKey: PROXY_HOSTS - labelZh: 代理网址 - labelEn: Proxy Hosts + labelZh: 代理网址 (全局 + Webhook) + labelEn: Proxy Hosts (Global + Webhook) + required: false + type: text + - default: "false" + edit: true + envKey: MAILER_ENABLED + labelZh: 启用邮件服务 + labelEn: Enable Mailer Service + required: true + type: select + values: + - label: 开启 + value: "true" + - label: 关闭 + value: "false" + - default: "smtp" + edit: true + envKey: MAILER_PROTOCOL + labelZh: 邮件服务协议 + labelEn: Mailer Protocol + required: false + type: text + - default: "" + edit: true + envKey: MAILER_SMTP_ADDR + labelZh: 邮件服务器地址 + labelEn: Mailer Server Address + required: false + type: text + - default: 465 + edit: true + envKey: MAILER_SMTP_PORT + labelZh: 邮件服务器端口 + labelEn: Mailer Server Port + required: false + type: number + - default: "" + edit: true + envKey: MAILER_USER + labelZh: 邮件服务用户名 + labelEn: Mailer Username + required: false + type: text + - default: "" + edit: true + envKey: MAILER_PASSWD + labelZh: 邮件服务密码 + labelEn: Mailer Password + required: false + type: text + - default: "" + edit: true + envKey: MAILER_FROM + labelZh: 邮件服务发件人 + labelEn: Mailer From + required: false + type: text + - default: "[Gitea]" + edit: true + envKey: MAILER_SUBJECT_PREFIX + labelZh: 邮件服务主题前缀 + labelEn: Mailer Subject Prefix required: false type: text diff --git a/gitea/1.22.1/docker-compose.yml b/gitea/1.22.1/docker-compose.yml index f57fb1e73..10a745307 100644 --- a/gitea/1.22.1/docker-compose.yml +++ b/gitea/1.22.1/docker-compose.yml @@ -27,11 +27,13 @@ services: environment: - USER_UID=1000 - USER_GID=1000 - - DB_HOST=${DB_HOSTNAME}:${DB_PORT} - - SSH_PORT=${PANEL_APP_PORT_SSH} - - GITEA__time__DEFAULT_UI_LOCATION=Asia/Shanghai - - GITEA__migrations__ALLOW_LOCALNETWORKS=true + - DISABLE_SSH=false - GITEA__api__ENABLE_SWAGGER=false - - GITEA__other__SHOW_FOOTER_POWERED_BY=false + - DB_HOST=${DB_HOSTNAME}:${DB_PORT} + - GITEA__proxy__PROXY_ENABLED=${PROXY_ENABLED} + - GITEA__proxy__PROXY_URL=${PROXY_URL} + - GITEA__proxy__PROXY_HOSTS=${PROXY_HOSTS} + - GITEA__webhook__PROXY_URL=${PROXY_URL} + - GITEA__webhook__PROXY_HOSTS=${PROXY_HOSTS} - GITEA__git.config__http.proxy=${PROXY_URL} - GITEA__git.config__https.proxy=${PROXY_URL} diff --git a/gitea/README.md b/gitea/README.md index 85e57ebef..cb68a3c00 100644 --- a/gitea/README.md +++ b/gitea/README.md @@ -56,7 +56,7 @@ Gitea 提供多种语言界面,适应全球范围内的用户,促进了国 ### 代理配置 -开启 `启用代理` 配置后 +开启 `启用代理` 配置后,同时生效与 `Gitea` 服务和 `Webhook` 服务和 `Git` 服务 + `代理服务器地址` 填写代理服务器地址 @@ -68,10 +68,35 @@ Gitea 提供多种语言界面,适应全球范围内的用户,促进了国 使用 `**` 代表所有网址 -例如需要代理: `Github` `gitlab` +例如需要代理: `Github` `gitlab`, 此项配置不作用于 `Git` 服务 ```text -*.github.com,*.gitlab.com +github.com,*.github.com,*.gitlab.com +``` + +在 app.ini 配置文件中配置如下: + +```ini +[webhook] +PROXY_URL = http://{host}:{port} +PROXY_HOSTS = github.com,*.github.com,*.gitlab.com +[proxy] +PROXY_ENABLED = true +PROXY_URL = http://{host}:{port} +PROXY_HOSTS = github.com,*.github.com,*.gitlab.com +``` + +### 开启 API 文档 + +默认关闭 `Swagger` 文档,开启后可以查看 `API` 文档 + +首次安装前,编辑`docker-compose.yml`修改环境变量 `GITEA__api__ENABLE_SWAGGER=false` 为 `true` 即可开启文档服务。 + +已安装用户,修改配置文件 `data/gitea/conf/app.ini` 中 `API` 配置项 `ENABLE_SWAGGER` 为 `true` 即可开启文档服务。 + +```ini +[api] +ENABLE_SWAGGER = true ``` ## 反向代理