fix: 使用宿主机 IP 进行健康检查
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled

改用 172.17.16.14 替代 localhost

确保健康检查在 host 网络模式下正常工作
This commit is contained in:
lzh
2026-01-13 18:15:31 +08:00
parent b3d13dacc8
commit 93e8848845

View File

@@ -41,7 +41,7 @@ services:
memory: ${GATEWAY_MEMORY_LIMIT}
cpus: '1.0'
healthcheck:
test: ["CMD", "sh", "-c", "wget --no-verbose --tries=1 --spider http://172.17.16.14:48080/ || exit 1"]
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://172.17.16.14:48080/actuator/health"]
interval: ${HEALTH_CHECK_INTERVAL}
timeout: ${HEALTH_CHECK_TIMEOUT}
retries: ${HEALTH_CHECK_RETRIES}
@@ -74,7 +74,7 @@ services:
memory: ${SYSTEM_MEMORY_LIMIT}
cpus: '1.0'
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:48081/actuator/health"]
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://172.17.16.14:48081/actuator/health"]
interval: ${HEALTH_CHECK_INTERVAL}
timeout: ${HEALTH_CHECK_TIMEOUT}
retries: ${HEALTH_CHECK_RETRIES}
@@ -107,7 +107,7 @@ services:
memory: ${INFRA_MEMORY_LIMIT}
cpus: '1.0'
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:48082/actuator/health"]
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://172.17.16.14:48082/actuator/health"]
interval: ${HEALTH_CHECK_INTERVAL}
timeout: ${HEALTH_CHECK_TIMEOUT}
retries: ${HEALTH_CHECK_RETRIES}
@@ -141,7 +141,7 @@ services:
memory: ${IOT_SERVER_MEMORY_LIMIT}
cpus: '1.5'
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:48083/actuator/health"]
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://172.17.16.14:48083/actuator/health"]
interval: ${HEALTH_CHECK_INTERVAL}
timeout: ${HEALTH_CHECK_TIMEOUT}
retries: ${HEALTH_CHECK_RETRIES}
@@ -219,7 +219,7 @@ services:
memory: ${IOT_GATEWAY_MEMORY_LIMIT}
cpus: '1.5'
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:48084/actuator/health"]
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://172.17.16.14:48084/actuator/health"]
interval: ${HEALTH_CHECK_INTERVAL}
timeout: ${HEALTH_CHECK_TIMEOUT}
retries: ${HEALTH_CHECK_RETRIES}
@@ -251,7 +251,7 @@ services:
memory: ${OPS_MEMORY_LIMIT}
cpus: '0.5'
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:48085/actuator/health"]
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://172.17.16.14:48085/actuator/health"]
interval: ${HEALTH_CHECK_INTERVAL}
timeout: ${HEALTH_CHECK_TIMEOUT}
retries: ${HEALTH_CHECK_RETRIES}