fix: health check 路径补充 /v1 前缀
Some checks failed
CI/CD Pipeline / Code Quality (push) Successful in 14s
CI/CD Pipeline / Unit Tests (push) Successful in 8s
CI/CD Pipeline / Build & Deploy Test (push) Has been skipped
CI/CD Pipeline / Build & Deploy Production (push) Failing after 57s

API 路由挂载在 /v1 下,/health 路径被 auth 中间件拦截返回 401,
统一改为 /v1/health。
This commit is contained in:
Wang Zhuoxuan 2026-04-18 03:27:44 +08:00
parent e076c3be19
commit af55992627
3 changed files with 5 additions and 5 deletions

View File

@ -69,7 +69,7 @@ jobs:
run: | run: |
sleep 10 sleep 10
for i in {1..5}; do for i in {1..5}; do
if bun -e "fetch('http://localhost:3001/health').then(r=>r.ok?process.exit(0):process.exit(1)).catch(()=>process.exit(1))"; then if bun -e "fetch('http://localhost:3001/v1/health').then(r=>r.ok?process.exit(0):process.exit(1)).catch(()=>process.exit(1))"; then
echo "Test environment is healthy!" echo "Test environment is healthy!"
exit 0 exit 0
fi fi
@ -107,7 +107,7 @@ jobs:
run: | run: |
sleep 15 sleep 15
for i in {1..5}; do for i in {1..5}; do
if bun -e "fetch('http://localhost:3000/health').then(r=>r.ok?process.exit(0):process.exit(1)).catch(()=>process.exit(1))"; then if bun -e "fetch('http://localhost:3000/v1/health').then(r=>r.ok?process.exit(0):process.exit(1)).catch(()=>process.exit(1))"; then
echo "Production deployment successful!" echo "Production deployment successful!"
exit 0 exit 0
fi fi

View File

@ -44,7 +44,7 @@ EXPOSE 3000
# 健康检查 # 健康检查
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \ HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD curl -f http://localhost:3000/health || exit 1 CMD curl -f http://localhost:3000/v1/health || exit 1
# 启动应用 # 启动应用
CMD ["node", "dist/index.js"] CMD ["node", "dist/index.js"]

View File

@ -22,7 +22,7 @@ services:
network_mode: host network_mode: host
env_file: .env.prod env_file: .env.prod
healthcheck: healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/health"] test: ["CMD", "curl", "-f", "http://localhost:3000/v1/health"]
interval: 30s interval: 30s
timeout: 10s timeout: 10s
retries: 3 retries: 3
@ -48,7 +48,7 @@ services:
network_mode: host network_mode: host
env_file: .env.test env_file: .env.test
healthcheck: healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3001/health"] test: ["CMD", "curl", "-f", "http://localhost:3001/v1/health"]
interval: 30s interval: 30s
timeout: 10s timeout: 10s
retries: 3 retries: 3