feat(ai): temporal worker for lesson plan workflow
- deploy temporal server (postgresql + auto-setup + ui) in docker-compose - new temporal/ module: workflow + activities + worker manager - convert lesson plan 4-step orchestration to temporal workflow - activities wrap existing analyze/recommend/generate/prepare_review steps - worker injects failover_chain/content_client/data_ana_client via module globals - start() uses temporal client.start_workflow, falls back to asyncio in dev - register temporal ports 7233/8085 in port-allocation Implements M6.5 of v2.1 migration plan (ADR-030).
This commit is contained in:
@@ -346,6 +346,63 @@ services:
|
||||
interval: 15s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
# ============================================================
|
||||
# Temporal Server - AI 工作流引擎(v2.1 §8.2 ADR-030)
|
||||
# 仅用于 AI 耗时工作流 + Saga,CRUD 短事务禁止
|
||||
# ============================================================
|
||||
temporal-postgresql:
|
||||
image: docker.m.daocloud.io/library/postgres:13
|
||||
container_name: edu-temporal-postgres
|
||||
profiles: ["p3", "p4", "p5", "p6"]
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_USER: temporal
|
||||
POSTGRES_PASSWORD: ${TEMPORAL_POSTGRES_PASSWORD:-temporal}
|
||||
POSTGRES_DB: temporal
|
||||
volumes:
|
||||
- temporal_pg_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U temporal"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
temporal:
|
||||
image: temporalio/auto-setup:1.23
|
||||
container_name: edu-temporal
|
||||
profiles: ["p3", "p4", "p5", "p6"]
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
temporal-postgresql:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
DBHOST: temporal-postgresql
|
||||
DBPORT: 5432
|
||||
DBUSER: temporal
|
||||
DBPASSWORD: ${TEMPORAL_POSTGRES_PASSWORD:-temporal}
|
||||
DBNAME: temporal
|
||||
DB_PLUGIN: postgres
|
||||
# 暴露 frontend gRPC 端口 7233 供 Worker 连接
|
||||
SERVICES: "frontend,history,matching,worker"
|
||||
ports:
|
||||
- "7233:7233"
|
||||
healthcheck:
|
||||
test: ["CMD", "tctl", "--address", "localhost:7233", "cluster", "health"]
|
||||
interval: 15s
|
||||
timeout: 5s
|
||||
start_period: 30s
|
||||
retries: 10
|
||||
temporal-ui:
|
||||
image: temporalio/ui:2.30.0
|
||||
container_name: edu-temporal-ui
|
||||
profiles: ["p3", "p4", "p5", "p6"]
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- temporal
|
||||
environment:
|
||||
TEMPORAL_ADDRESS: temporal:7233
|
||||
TEMPORAL_CORS_ORIGINS: "http://localhost:4000,http://localhost:4001,http://localhost:4002,http://localhost:4003"
|
||||
ports:
|
||||
- "8085:8080"
|
||||
volumes:
|
||||
mysql_data:
|
||||
redis_data:
|
||||
@@ -356,3 +413,4 @@ volumes:
|
||||
prometheus_data:
|
||||
alertmanager_data:
|
||||
loki_data:
|
||||
temporal_pg_data:
|
||||
|
||||
Reference in New Issue
Block a user