Drone→105 部署后访问 app.mixingx.local/agent-0/ 报
ERR_TOO_MANY_REDIRECTS。根因:values.yaml 的 webBasePath 带尾斜杠
(/agent-0/),_frontend.tpl 注入 VITE_BASE_PATH,agent/edge Dockerfile
sed s|/__BASE__|...$VITE_BASE_PATH|g 配合 nginx.conf 本身已带的尾斜杠
(location /__BASE__/、return 302 /__BASE__/)→ 拼成 /agent-0//。渲染后的
location /agent-0// 匹配不到 /agent-0/(单斜杠)→ 落 location / →
return 302 /agent-0// → try_files 在 alias 下找不到 → 死循环。
sso/ultra 不受影响(nginx.conf 硬编码 /sso/,不走 __BASE__ 占位符)。
双重修复:
1. values.yaml agent-0/edge-0 webBasePath 去尾斜杠(对齐 add-node.sh 约定)
2. monorepo agent/edge Dockerfile 加 BASE=${BASE%/} 兜底(已在 submodule
90657c0 推送),即使 values 误配带斜杠也不会再死循环
验证:sh 模拟 5 种 VITE_BASE_PATH 输入全部渲染单斜杠 location /agent-0/。
174 lines
6.0 KiB
YAML
174 lines
6.0 KiB
YAML
# ═══════════════════════════════════════════════════════════════
|
|
# MixingX Helm Chart — values
|
|
# 架构:独立 DB + 四胞胎(agent/edge podAffinity) + 共享基础设施
|
|
# ═══════════════════════════════════════════════════════════════
|
|
|
|
# ── 全局 ──
|
|
registry: 192.168.1.105:8888/mixingx
|
|
tag: latest
|
|
|
|
# 时区(部署地域覆盖):中国 Asia/Shanghai,海外按需改如 America/New_York
|
|
# 注入所有容器的 TZ env,覆盖镜像内默认时区(镜像内置 Asia/Shanghai 兜底)
|
|
timezone: Asia/Shanghai
|
|
|
|
# ── 共享基础设施(所有服务连同一个) ──
|
|
sharedInfra:
|
|
postgres: # postgres 连接参数(每个独立 postgres 共用)
|
|
username: postgres
|
|
password: "Admin12345"
|
|
port: 5432
|
|
redis:
|
|
host: redis-service
|
|
port: 6379
|
|
password: "Admin12345"
|
|
rabbitmq:
|
|
host: messaging-service
|
|
port: 5672
|
|
username: guest
|
|
password: guest
|
|
mongo:
|
|
host: mongo-service
|
|
port: 27017
|
|
username: admin
|
|
password: "Admin12345"
|
|
database: mixingx_audit
|
|
otlp:
|
|
endpoint: http://k8s-dashboard-service:18889
|
|
protocol: grpc
|
|
|
|
# ═══════════════════════════════════════════════════════════════
|
|
# 类型 A:四胞胎(agent/edge)— 后端+前端+独立DB,podAffinity 同节点
|
|
# 每个实例生成:后端 Deployment + 前端 Deployment + 独立 postgres StatefulSet
|
|
# 默认各 1 个,以后按需加(加一行 values + helm upgrade)
|
|
# ═══════════════════════════════════════════════════════════════
|
|
instances:
|
|
- name: agent-0
|
|
image: agent
|
|
role: agent
|
|
webName: agent-web-0 # 前端服务名(显式,因为命名不统一:agent-web-0 / ultra-web)
|
|
webImage: agent-web
|
|
# 注:webBasePath 不要带尾斜杠!Dockerfile 的 sed `s|/__BASE__|${VITE_BASE_PATH}|g`
|
|
# 配合 nginx.conf 的 `location /__BASE__/`(本身已带尾斜杠),再带尾斜杠会拼成
|
|
# /agent-0//(双斜杠)→ 浏览器 ERR_TOO_MANY_REDIRECTS 死循环。
|
|
# sso/ultra 不受影响(它们的 nginx.conf 用硬编码 /sso/,不走 __BASE__ 占位符)。
|
|
webBasePath: /agent-0
|
|
serviceId: agent-0
|
|
database: agent-db-0
|
|
pgStorage: 5Gi
|
|
description: "Agent 实例 0" # Gateway 中文展示名(mixingx.io/description annotation)
|
|
affinity: true # 前端和 DB 必须和后端同节点
|
|
|
|
- name: edge-0
|
|
image: edge
|
|
role: edge
|
|
webName: edge-web-0
|
|
webImage: edge-web
|
|
webBasePath: /edge-0 # 不带尾斜杠(同上,见 agent-0 注释)
|
|
serviceId: edge-0
|
|
database: edge-db-0
|
|
pgStorage: 5Gi
|
|
description: "Edge 实例 0"
|
|
affinity: true
|
|
|
|
# 加点位示例(取消注释 + helm upgrade 即生效):
|
|
# 注意:webBasePath 不能带尾斜杠,否则 Dockerfile sed 拼出双斜杠 → 重定向死循环
|
|
# - name: agent-beijing
|
|
# image: agent
|
|
# role: agent
|
|
# webName: agent-web-beijing
|
|
# webImage: agent-web
|
|
# webBasePath: /agent-beijing
|
|
# serviceId: agent-beijing
|
|
# database: agent-db-beijing
|
|
# pgStorage: 5Gi
|
|
# description: "北京厂区 注塑车间"
|
|
# affinity: true
|
|
|
|
# ═══════════════════════════════════════════════════════════════
|
|
# 类型 B:独立不亲和(sso/ultra)— 后端+前端+独立DB,无亲和,多副本
|
|
# 固定数量,不动态添加
|
|
# ═══════════════════════════════════════════════════════════════
|
|
standalones:
|
|
- name: sso
|
|
image: sso
|
|
role: sso
|
|
webName: sso-web
|
|
webImage: sso-web
|
|
webBasePath: /sso/
|
|
serviceId: sso
|
|
database: sso-db
|
|
pgStorage: 10Gi
|
|
description: "统一登录"
|
|
replicas: 2
|
|
affinity: false
|
|
|
|
- name: ultra
|
|
image: ultra
|
|
role: ultra
|
|
webName: ultra-web
|
|
webImage: ultra-web
|
|
webBasePath: /ultra/
|
|
database: ultra-db
|
|
pgStorage: 10Gi
|
|
description: "Ultra 看板"
|
|
replicas: 2
|
|
affinity: false
|
|
|
|
# ═══════════════════════════════════════════════════════════════
|
|
# 类型 C/D:无独立 DB 的服务
|
|
# ═══════════════════════════════════════════════════════════════
|
|
gateway:
|
|
image: gateway
|
|
port: 8080
|
|
replicas: 2
|
|
rbac: true # serviceAccountName: gateway-sa
|
|
|
|
audit:
|
|
enabled: true
|
|
image: audit
|
|
port: 5600
|
|
replicas: 2
|
|
|
|
# ── 共享数据层(非 postgres) ──
|
|
sharedDatastores:
|
|
- name: redis
|
|
image: docker.io/library/redis:8.6
|
|
port: 6379
|
|
storage: 2Gi
|
|
mountPath: /data
|
|
- name: mongo
|
|
image: docker.io/library/mongo:8.3
|
|
port: 27017
|
|
storage: 5Gi
|
|
mountPath: /data/db
|
|
- name: messaging
|
|
image: docker.io/library/rabbitmq:4.3-management
|
|
port: 5672
|
|
storage: 2Gi
|
|
mountPath: /var/lib/rabbitmq
|
|
|
|
# ── 协议模拟器(测试环境) ──
|
|
mocks:
|
|
- name: opcua-peripheral
|
|
image: opcua
|
|
port: 25006
|
|
scene: /scenes/opcua/peripheral-plc.json
|
|
- name: opcua-trimming
|
|
image: opcua
|
|
port: 25008
|
|
scene: /scenes/opcua/trimming-machine.json
|
|
- name: opcua-meter
|
|
image: opcua
|
|
port: 25010
|
|
scene: /scenes/opcua/meter.json
|
|
- name: s7-diecast
|
|
image: s7-diecast
|
|
port: 11021
|
|
|
|
# ── Ingress ──
|
|
ingress:
|
|
enabled: true
|
|
domain: app.mixingx.local
|
|
gatewayService: gateway-service # 所有流量 → gateway,由 gateway 动态路由
|
|
gatewayPort: 8080
|