feat: CoreDNS IPv4 上游、03-03 Tomcat 修复、HAProxy 与验证脚本

- Ansible: 部署时自动配置 CoreDNS forward 为 IPv4,避免 ACME 解析失败
- 01-01/01-07: 文档增加 CoreDNS 设置说明
- 03-03: Tomcat webapps.dist 复制、HTTP/HTTPS 双 Ingress、显式 Dashboard IngressRoute
- traefik-dashboard-acme: tomcat-acme.yaml、404 排查说明
- HAProxy: 健康检查与 PROXY 配置拆分,18080/18443 部署与验证脚本

Made-with: Cursor
This commit is contained in:
2026-03-22 19:02:46 +08:00
parent de1be1dbe5
commit 8a54cac61f
25 changed files with 924 additions and 113 deletions

View File

@@ -1,11 +1,38 @@
# 01-08 HAProxy 配置
用于 `docs/01-08-openwrt-haproxy.md`,可与 Ansible 共用(复制到 OpenWrt 或通过 playbook 下发)。
## 核心目标
| 文件 | 说明 |
|------|------|
| haproxy.cfg | 基础配置TCP 健康检查 |
| haproxy-proxy.cfg | 启用 send-proxy-v2Traefik 真实 IP |
| haproxy-proxy-http-tls.cfg | HTTP 检查 + TLS 检查 + PROXY 组合 |
本目录下的 **所有 `*.cfg` 必须可被 HAProxy 正确解析并符合文档意图**。验证分两层:
按实际节点 IP 修改 `192.168.2.61``192.168.2.64`。80/443 被封时可将 `bind *:80` / `bind *:443` 改为 `*:18080` / `*:18443`
| 层次 | 含义 | 如何验证 |
|------|------|----------|
| **① 语法正确** | `haproxy -c -f <cfg>` 无致命错误 | 见下文「仅校验 cfg」或主验证脚本第 2 步 |
| **② 运行与后端** | 在 OpenWrt 上实际监听 18080/18443 时,经第三方主机 curl 可达 K3s/Traefik 后端 | `./scripts/01-08-verify-haproxy.sh`(完整流程,含 curl |
仓库内 **frontend 已统一为 `18080` / `18443`**(与 LuCI 的 80/443 分离backend 仍指向各节点 **80/443**Traefik 入口)。按环境修改 `192.168.2.61``192.168.2.64`
## 仅校验本目录 cfg不跑 curl
仅需确认 **① 语法**,在仓库根目录执行:
```bash
./scripts/01-08-verify-haproxy.sh --cfg-only
```
会将本目录全部 `*.cfg` 拷到 OpenWrt 的 `/tmp/haproxy-verify/`,对每台文件执行 `haproxy -c`(与 OpenWrt 上安装的 HAProxy 版本一致)。
**说明**`haproxy-https.cfg``ssl crt /etc/ssl/haproxy.pem`;若路由器上**没有**该 pem语法检查可能失败脚本会标为 `[SKIP]`。在 OpenWrt 放置有效 pem 后应能通过 `haproxy -c`
## 文件一览
| 文件 | 说明(对应 `docs/01-08-openwrt-haproxy.md` |
|------|-----------------------------------------------|
| `haproxy-no-check.cfg` | §2 最简§3.1 在其 `server` 行加 `check` |
| `haproxy-http.cfg` | §3.2 HTTP 健康检查(明文 80 后端) |
| `haproxy-tls.cfg` | §3.3 TLS 握手检查443 后端,`mode tcp` |
| `haproxy-https.cfg` | §3.4 HTTPS 应用层检查(需 HAProxy 终结 TLS由 HAProxy 提供证书) |
| `haproxy-proxy-http-tls.cfg` | §5 PROXY + HTTP/TLS 检查 |
## 与 Ansible / OpenWrt
可与 Ansible 共用(复制到 OpenWrt 或通过 playbook 下发)。一键把 **uhttpd 80/443 + HAProxy 18080/18443** 落到路由器见 `scripts/01-08-deploy-openwrt-haproxy.sh`