fix(deploy): nginx 上游运行期重新解析 + 就绪探针;内存上限按 8C/32G 重新分配
mirror-to-gitee / mirror (push) Successful in 9s
mirror-to-gitee / mirror (push) Successful in 9s
问题:容器重建换 IP 后,网关与 admin-ui 仍往旧 IP 打,/openapi 与 /api 整片 502,必须手动重启 nginx 容器才恢复(2026-11-03 实机踩到)。 编排 - admin-svr / openapi / admin-ui / docs 增加 healthcheck - admin-ui、gateway、nginx 改 depends_on: condition: service_healthy, 保证 nginx 启动时后端已就绪 - 新增 deploy/compose.memlimit.yml(原来只存在于某台演示机上): 全套上限 8.5G、实测常驻 2G,留给同机其它服务 20G+; MySQL buffer pool 128M→768M、max_connections 151→300 nginx - gateway / admin-ui / iotlcm.conf 示例 统一改 resolver 127.0.0.11 valid=10s + upstream zone/resolve:运行期跟随 IP 变化,不必重启(实测 6s 内自愈)
This commit is contained in:
@@ -175,6 +175,14 @@ services:
|
||||
condition: service_healthy
|
||||
rabbitmq:
|
||||
condition: service_healthy
|
||||
# 就绪探针:nginx 类容器只在启动时解析一次后端 IP,
|
||||
# 没有它就无法用 depends_on 的 service_healthy 保证启动顺序(见 gateway)
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--quiet", "--output-document=/dev/null", "http://127.0.0.1:8008/api.json"]
|
||||
interval: 10s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
start_period: 20s
|
||||
|
||||
admin-ui:
|
||||
image: 'crpi-qflrqrxoohlkkvgc.cn-chengdu.personal.cr.aliyuncs.com/iotlcm/iotlcm:iotlcm-admin-ui-v1.0.4'
|
||||
@@ -191,7 +199,14 @@ services:
|
||||
networks:
|
||||
- iotlcm-network
|
||||
depends_on:
|
||||
- admin-svr
|
||||
admin-svr:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--quiet", "--output-document=/dev/null", "http://127.0.0.1/"]
|
||||
interval: 10s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
start_period: 5s
|
||||
|
||||
openapi:
|
||||
image: 'crpi-qflrqrxoohlkkvgc.cn-chengdu.personal.cr.aliyuncs.com/iotlcm/iotlcm:iotlcm-openapi-v1.0.4'
|
||||
@@ -213,6 +228,12 @@ services:
|
||||
condition: service_healthy
|
||||
rabbitmq:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--quiet", "--output-document=/dev/null", "http://127.0.0.1:8000/api.json"]
|
||||
interval: 10s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
start_period: 20s
|
||||
|
||||
upstream-chan:
|
||||
image: 'crpi-qflrqrxoohlkkvgc.cn-chengdu.personal.cr.aliyuncs.com/iotlcm/iotlcm:iotlcm-upstream-chan-v1.0.4'
|
||||
@@ -370,6 +391,12 @@ services:
|
||||
- "127.0.0.1:8019:80"
|
||||
networks:
|
||||
- iotlcm-network
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--quiet", "--output-document=/dev/null", "http://127.0.0.1/docs/"]
|
||||
interval: 10s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
start_period: 10s
|
||||
|
||||
# ---------------- 可选:运营商接口挡板 ----------------
|
||||
# 模拟中国移动 OneLink 接口,用于在没有真实运营商环境时联调整条链路:
|
||||
@@ -418,10 +445,14 @@ services:
|
||||
networks:
|
||||
- iotlcm-network
|
||||
depends_on:
|
||||
- admin-ui
|
||||
- openapi
|
||||
- app-web
|
||||
- docs
|
||||
admin-ui:
|
||||
condition: service_healthy
|
||||
openapi:
|
||||
condition: service_healthy
|
||||
docs:
|
||||
condition: service_healthy
|
||||
app-web:
|
||||
condition: service_started
|
||||
profiles:
|
||||
- with-nginx
|
||||
|
||||
@@ -437,10 +468,16 @@ services:
|
||||
- ./data/logs/gateway:/var/log/nginx
|
||||
networks:
|
||||
- iotlcm-network
|
||||
# 后端必须"健康"后才起网关:否则 nginx 会在后端拿到 IP 之前把 upstream
|
||||
# 解析结果缓存下来,容器重启换 IP 后所有请求变成 502(2026-11-03 踩过)。
|
||||
# 配置里另有 resolver + resolve,可在运行期自动跟随 IP 变化。
|
||||
depends_on:
|
||||
- admin-ui
|
||||
- openapi
|
||||
- docs
|
||||
admin-ui:
|
||||
condition: service_healthy
|
||||
openapi:
|
||||
condition: service_healthy
|
||||
docs:
|
||||
condition: service_healthy
|
||||
profiles:
|
||||
- with-gateway
|
||||
|
||||
|
||||
Reference in New Issue
Block a user