feat(api-gateway): retire teacher/student/parent-bff, route GraphQL to apollo-router
v2.1 M9+M10: BFF layer and old portals retired.
- api-gateway: remove TeacherBffURL/StudentBffURL/ParentBffURL config
- api-gateway: add ApolloRouterURL config and /api/graphql route
- api-gateway: /api/admin/graphql now proxies to apollo-router
- api-gateway: health checks now ping apollo-router instead of BFF
- deploy.yml: replace teacher-bff service block with apollo-router
- deploy.yml: add config-service service block (M3 dependency)
- deploy.yml: remove teacher-portal and admin-portal service blocks
- source code in services/{teacher,student,parent}-bff/ and apps/*-portal/ retained for rollback
This commit is contained in:
@@ -39,15 +39,14 @@ services:
|
||||
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
|
||||
# v2.1 M9:apollo-router 替代 teacher-bff / student-bff / parent-bff
|
||||
APOLLO_ROUTER_URL: http://apollo-router:3000
|
||||
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}
|
||||
CORS_ORIGINS: ${CORS_ORIGINS:-http://localhost:3000,http://localhost:4000,http://localhost:4001,http://localhost:4002,http://localhost:4003,http://localhost:4010}
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT:-http://otel-collector:4318}
|
||||
LOG_LEVEL: ${LOG_LEVEL:-info}
|
||||
ports:
|
||||
@@ -55,6 +54,8 @@ services:
|
||||
depends_on:
|
||||
classes:
|
||||
condition: service_healthy
|
||||
apollo-router:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--quiet", "--spider", "http://localhost:8080/healthz"]
|
||||
interval: 30s
|
||||
@@ -114,39 +115,75 @@ services:
|
||||
- edu-net
|
||||
- edu-shared
|
||||
|
||||
teacher-bff:
|
||||
# v2.1 M3:config-service 从 iam 拆出(插件配置 + 布局 + 用户偏好)
|
||||
config-service:
|
||||
build:
|
||||
context: ./repo
|
||||
dockerfile: services/teacher-bff/Dockerfile
|
||||
container_name: edu-teacher-bff
|
||||
dockerfile: services/config-service/Dockerfile
|
||||
container_name: edu-config-service
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
PORT: 3003
|
||||
TEACHER_BFF_DEV_MODE: "false"
|
||||
PORT: 3011
|
||||
GRPC_PORT: 50059
|
||||
DATABASE_URL: ${DATABASE_URL}
|
||||
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
|
||||
# GraphQL 子图信任凭证(ADR-036)
|
||||
ROUTER_AUTH_SECRET: ${ROUTER_AUTH_SECRET:-edu-router-secret-change-in-production}
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT:-http://otel-collector:4318}
|
||||
LOG_LEVEL: ${LOG_LEVEL:-info}
|
||||
NODE_ENV: production
|
||||
depends_on:
|
||||
iam:
|
||||
condition: service_healthy
|
||||
classes:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--quiet", "--spider", "http://localhost:3003/healthz"]
|
||||
test: ["CMD", "wget", "--quiet", "--spider", "http://localhost:3011/healthz"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
start_period: 20s
|
||||
start_period: 30s
|
||||
retries: 5
|
||||
networks:
|
||||
- edu-net
|
||||
- edu-shared
|
||||
|
||||
# v2.1 M9:teacher-bff / student-bff / parent-bff 已下线,由 apollo-router 替代
|
||||
# 源码保留在 services/{teacher,student,parent}-bff/ 以便回滚
|
||||
apollo-router:
|
||||
build:
|
||||
context: ./repo
|
||||
dockerfile: infra/apollo-router/Dockerfile
|
||||
container_name: edu-apollo-router
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
# 路由配置文件位于 /dist/router.yaml(Dockerfile COPY)
|
||||
APOLLO_ROUTER_CONFIG_PATH: /dist/router.yaml
|
||||
# 信任凭证(子图 RouterAuthGuard 校验,ADR-036)
|
||||
ROUTER_AUTH_SECRET: ${ROUTER_AUTH_SECRET:-edu-router-secret-change-in-production}
|
||||
# 子图 URL 覆盖(通过 router.yaml override_subgraph_url 配置)
|
||||
IAM_SUBGRAPH_URL: http://iam:3002/graphql
|
||||
CONFIG_SERVICE_SUBGRAPH_URL: http://config-service:3011/graphql
|
||||
CORE_EDU_SUBGRAPH_URL: http://core-edu:3004/graphql
|
||||
CONTENT_SUBGRAPH_URL: http://content:3005/graphql
|
||||
MSG_SUBGRAPH_URL: http://msg:3007/graphql
|
||||
DATA_ANA_SUBGRAPH_URL: http://data-ana:3006/graphql
|
||||
AI_SUBGRAPH_URL: http://ai:3008/graphql
|
||||
ports:
|
||||
- "${APOLLO_ROUTER_PORT:-3000}:3000"
|
||||
depends_on:
|
||||
iam:
|
||||
condition: service_healthy
|
||||
core-edu:
|
||||
condition: service_healthy
|
||||
content:
|
||||
condition: service_healthy
|
||||
msg:
|
||||
condition: service_healthy
|
||||
config-service:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--quiet", "--spider", "http://localhost:8088/healthz"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
start_period: 10s
|
||||
retries: 3
|
||||
networks:
|
||||
- edu-net
|
||||
@@ -318,64 +355,9 @@ services:
|
||||
- edu-net
|
||||
- edu-shared
|
||||
|
||||
teacher-portal:
|
||||
build:
|
||||
context: ./repo
|
||||
dockerfile: apps/teacher-portal/Dockerfile
|
||||
container_name: edu-teacher-portal
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
PORT: 3000
|
||||
API_GATEWAY_URL: http://api-gateway:8080
|
||||
ports:
|
||||
- "${TEACHER_PORTAL_PORT:-3000}:3000"
|
||||
depends_on:
|
||||
api-gateway:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--quiet", "--spider", "http://localhost:3000/"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
start_period: 20s
|
||||
retries: 3
|
||||
networks:
|
||||
- edu-net
|
||||
- edu-shared
|
||||
|
||||
admin-portal:
|
||||
build:
|
||||
context: ./repo
|
||||
dockerfile: apps/admin-portal/Dockerfile
|
||||
container_name: edu-admin-portal
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
PORT: 4003
|
||||
API_GATEWAY_URL: http://api-gateway:8080
|
||||
# 生产环境强制关闭 mock,使用真实后端
|
||||
NEXT_PUBLIC_API_MOCKING: "disabled"
|
||||
NEXT_PUBLIC_MF_ENABLED: "false"
|
||||
NEXT_PUBLIC_SHELL_URL: http://admin-portal:4003
|
||||
NEXT_PUBLIC_WS_URL: ws://push-gateway:8081/ws
|
||||
NEXT_PUBLIC_OTEL_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT:-http://otel-collector:4318}
|
||||
NEXT_PUBLIC_WEB_VITALS_ENDPOINT: /api/admin/web-vitals
|
||||
ports:
|
||||
- "${ADMIN_PORTAL_PORT:-4003}:4003"
|
||||
depends_on:
|
||||
api-gateway:
|
||||
condition: service_healthy
|
||||
teacher-bff:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--quiet", "--spider", "http://localhost:4003/api/ready"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
start_period: 20s
|
||||
retries: 3
|
||||
networks:
|
||||
- edu-net
|
||||
- edu-shared
|
||||
# v2.1 M10:teacher-portal / admin-portal 已下线,由 portal-shell 替代
|
||||
# 源码保留在 apps/{teacher,student,parent,admin}-portal/ 以便回滚
|
||||
# portal-shell 部署在 infra/docker-compose.yml(开发环境)中,端口 4010
|
||||
|
||||
networks:
|
||||
# 应用服务内部网络
|
||||
|
||||
Reference in New Issue
Block a user