feat(infra): api-gateway 环境变量补全 + build context 修复 + docker-compose.test 新增

This commit is contained in:
SpecialX
2026-07-14 16:04:20 +08:00
parent a70977ad4b
commit 2796d7c88f
3 changed files with 162 additions and 6 deletions

View File

@@ -23,25 +23,31 @@ services:
# ============================================================
api-gateway:
build:
context: ./repo/services/api-gateway
dockerfile: Dockerfile
context: ./repo
dockerfile: services/api-gateway/Dockerfile
container_name: edu-api-gateway
restart: unless-stopped
environment:
API_GATEWAY_PORT: ${API_GATEWAY_PORT:-8080}
ENV: production
JWT_SECRET: ${JWT_SECRET}
JWT_ISSUER: ${JWT_ISSUER:-next-edu-cloud}
JWT_AUDIENCE: ${JWT_AUDIENCE:-next-edu-cloud}
# RS256 公钥端点(非 DevMode 下必填config.go W7 防护)
IAM_JWKS_URL: http://iam:3002/v1/iam/.well-known/jwks.json
# 生产环境强制关闭 dev-token 旁路
DEV_MODE: "false"
CLASSES_SERVICE_URL: http://classes:3001
IAM_SERVICE_URL: http://iam:3002
TEACHER_BFF_URL: http://teacher-bff:3003
STUDENT_BFF_URL: http://student-bff:3009
PARENT_BFF_URL: http://parent-bff:3010
CORE_EDU_SERVICE_URL: http://core-edu:3004
CONTENT_SERVICE_URL: http://content:3005
DATA_ANA_SERVICE_URL: http://data-ana:3006
MSG_SERVICE_URL: http://msg:3007
AI_SERVICE_URL: http://ai:3008
CORS_ORIGINS: ${CORS_ORIGINS:-http://localhost:3000,http://localhost:4000,http://localhost:4001,http://localhost:4002,http://localhost:4003}
OTEL_EXPORTER_OTLP_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT:-http://otel-collector:4318}
LOG_LEVEL: ${LOG_LEVEL:-info}
ports:
@@ -116,9 +122,19 @@ services:
restart: unless-stopped
environment:
PORT: 3003
TEACHER_BFF_DEV_MODE: "false"
REDIS_URL: ${REDIS_URL}
IAM_GRPC_TARGET: iam:50052
IAM_SERVICE_URL: http://iam:3002
CLASSES_SERVICE_URL: http://classes:3001
CORE_EDU_GRPC_TARGET: core-edu:50053
CORE_EDU_SERVICE_URL: http://core-edu:3004
CONTENT_GRPC_TARGET: content:50054
DATA_ANA_GRPC_TARGET: data-ana:50055
MSG_GRPC_TARGET: msg:50056
MSG_SERVICE_URL: http://msg:3007
AI_GRPC_TARGET: ai:50058
OTEL_EXPORTER_OTLP_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT:-http://otel-collector:4318}
LOG_LEVEL: ${LOG_LEVEL:-info}
NODE_ENV: production
depends_on:
@@ -280,9 +296,12 @@ services:
JWT_SECRET: ${JWT_SECRET}
REDIS_URL: ${REDIS_URL}
KAFKA_BROKERS: ${KAFKA_BROKERS:-kafka:29092}
KAFKA_NOTIFICATION_TOPIC: edu.notification.requested
# ARB-013 canonical topic name (v2 alignment with msg Outbox publisher).
KAFKA_NOTIFICATION_TOPIC: edu.notify.notification.sent
KAFKA_CONSUMER_GROUP: push-gateway
INTERNAL_API_TOKEN: ${INTERNAL_API_TOKEN:-edu-internal-token}
# PUSH_INTERNAL_TOKEN is the canonical env var (ARB-013 alignment with
# msg). INTERNAL_API_TOKEN kept as backward-compat alias.
PUSH_INTERNAL_TOKEN: ${PUSH_INTERNAL_TOKEN:-${INTERNAL_API_TOKEN:-edu-internal-token}}
JWKS_URL: http://iam:3002/v1/iam/.well-known/jwks.json
WS_ALLOWED_ORIGINS: ${WS_ALLOWED_ORIGINS:-http://localhost:3000,http://localhost:4000,http://localhost:4001,http://localhost:4002,http://localhost:4003}
MAX_CONNS_PER_USER: "5"