feat(p1): complete P1 foundation stage
- monorepo: pnpm workspace + go.work + pyproject.toml + commitlint/husky - infra: docker-compose (minimal + full profiles) + init-sql + prometheus - arch-scan: multi-language scanner skeleton (TS/Go/Python/Proto) - shared-proto: buf v2 + classes.proto (ClassService CRUD contract) - api-gateway: Go/Gin + JWT HS256 auth + reverse proxy + request ID - classes: NestJS golden template (error system + observability + middleware + CRUD + tests) - teacher-portal: Next.js + paper-feel UI design system - CI/CD: 4 workflows (go/ts/py/proto) - docs: migration guide + project_rules + coding-standards + git-workflow + ui-design-system + 004 + 9 module READMEs + known-issues + spec/plan migration + roadmap
This commit is contained in:
40
infra/docker-compose.minimal.yml
Normal file
40
infra/docker-compose.minimal.yml
Normal file
@@ -0,0 +1,40 @@
|
||||
name: edu-minimal
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:8.0
|
||||
container_name: edu-mysql
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-changeme}
|
||||
MYSQL_DATABASE: ${MYSQL_DATABASE:-next_edu_cloud}
|
||||
MYSQL_USER: ${MYSQL_USER:-edu}
|
||||
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-changeme}
|
||||
ports:
|
||||
- "3306:3306"
|
||||
volumes:
|
||||
- mysql_data:/var/lib/mysql
|
||||
- ./init-sql:/docker-entrypoint-initdb.d:ro
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${MYSQL_ROOT_PASSWORD:-changeme}"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: edu-redis
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "6379:6379"
|
||||
command: redis-server --appendonly yes
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 10s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
|
||||
volumes:
|
||||
mysql_data:
|
||||
redis_data:
|
||||
154
infra/docker-compose.yml
Normal file
154
infra/docker-compose.yml
Normal file
@@ -0,0 +1,154 @@
|
||||
name: edu-full
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:8.0
|
||||
container_name: edu-mysql
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-changeme}
|
||||
MYSQL_DATABASE: ${MYSQL_DATABASE:-next_edu_cloud}
|
||||
MYSQL_USER: ${MYSQL_USER:-edu}
|
||||
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-changeme}
|
||||
ports:
|
||||
- "3306:3306"
|
||||
volumes:
|
||||
- mysql_data:/var/lib/mysql
|
||||
- ./init-sql:/docker-entrypoint-initdb.d:ro
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: edu-redis
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "6379:6379"
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 10s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
kafka:
|
||||
image: confluentinc/cp-kafka:7.6.0
|
||||
container_name: edu-kafka
|
||||
profiles: ["p3", "p4", "p5", "p6"]
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
zookeeper:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
KAFKA_BROKER_ID: 1
|
||||
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
|
||||
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092
|
||||
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
|
||||
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
|
||||
ports:
|
||||
- "9092:9092"
|
||||
healthcheck:
|
||||
test: ["CMD", "kafka-topics", "--bootstrap-server", "localhost:9092", "--list"]
|
||||
interval: 15s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
zookeeper:
|
||||
image: confluentinc/cp-zookeeper:7.6.0
|
||||
container_name: edu-zookeeper
|
||||
profiles: ["p3", "p4", "p5", "p6"]
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
ZOOKEEPER_CLIENT_PORT: 2181
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-z", "localhost", "2181"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
clickhouse:
|
||||
image: clickhouse/clickhouse-server:24.3
|
||||
container_name: edu-clickhouse
|
||||
profiles: ["p4", "p5", "p6"]
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "8123:8123"
|
||||
- "9000:9000"
|
||||
volumes:
|
||||
- clickhouse_data:/var/lib/clickhouse
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--spider", "-q", "http://localhost:8123/ping"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
neo4j:
|
||||
image: neo4j:5.20
|
||||
container_name: edu-neo4j
|
||||
profiles: ["p4", "p5", "p6"]
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
NEO4J_AUTH: neo4j/${NEO4J_PASSWORD:-changeme}
|
||||
ports:
|
||||
- "7474:7474"
|
||||
- "7687:7687"
|
||||
volumes:
|
||||
- neo4j_data:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "cypher-shell", "-u", "neo4j", "-p", "${NEO4J_PASSWORD:-changeme}", "RETURN 1"]
|
||||
interval: 15s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
elasticsearch:
|
||||
image: docker.elastic.co/elasticsearch/elasticsearch:8.13.0
|
||||
container_name: edu-es
|
||||
profiles: ["p5", "p6"]
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
discovery.type: single-node
|
||||
xpack.security.enabled: "false"
|
||||
ES_JAVA_OPTS: "-Xms512m -Xmx512m"
|
||||
ports:
|
||||
- "9200:9200"
|
||||
volumes:
|
||||
- es_data:/usr/share/elasticsearch/data
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:9200/_cluster/health"]
|
||||
interval: 15s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
jaeger:
|
||||
image: jaegertracing/all-in-one:1.57
|
||||
container_name: edu-jaeger
|
||||
profiles: ["observability"]
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
COLLECTOR_OTLP_ENABLED: "true"
|
||||
ports:
|
||||
- "16686:16686"
|
||||
- "4318:4318"
|
||||
prometheus:
|
||||
image: prom/prometheus:v0.51.0
|
||||
container_name: edu-prometheus
|
||||
profiles: ["observability"]
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
|
||||
ports:
|
||||
- "9090:9090"
|
||||
grafana:
|
||||
image: grafana/grafana:10.4.0
|
||||
container_name: edu-grafana
|
||||
profiles: ["observability"]
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
GF_SECURITY_ADMIN_PASSWORD: admin
|
||||
ports:
|
||||
- "3001:3001"
|
||||
volumes:
|
||||
- grafana_data:/var/lib/grafana
|
||||
volumes:
|
||||
mysql_data:
|
||||
redis_data:
|
||||
clickhouse_data:
|
||||
neo4j_data:
|
||||
es_data:
|
||||
grafana_data:
|
||||
17
infra/init-sql/01-init.sql
Normal file
17
infra/init-sql/01-init.sql
Normal file
@@ -0,0 +1,17 @@
|
||||
-- P1: classes 域 schema
|
||||
CREATE TABLE IF NOT EXISTS `classes` (
|
||||
`id` CHAR(36) NOT NULL,
|
||||
`name` VARCHAR(100) NOT NULL,
|
||||
`grade_id` CHAR(36) NOT NULL,
|
||||
`head_teacher_id` CHAR(36) NULL,
|
||||
`description` TEXT NULL,
|
||||
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `idx_classes_grade_id` (`grade_id`),
|
||||
INDEX `idx_classes_head_teacher` (`head_teacher_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- P2 起增加 users / roles / permissions 表(IAM 服务)
|
||||
-- P3 起增加 exams / homework / grades 表(CoreEdu 服务)
|
||||
-- 各服务独立数据库或独立 schema,P1 先用同库不同表前缀
|
||||
12
infra/prometheus.yml
Normal file
12
infra/prometheus.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
global:
|
||||
scrape_interval: 15s
|
||||
evaluation_interval: 15s
|
||||
|
||||
scrape_configs:
|
||||
- job_name: 'api-gateway'
|
||||
static_configs:
|
||||
- targets: ['host.docker.internal:8080']
|
||||
|
||||
- job_name: 'classes-service'
|
||||
static_configs:
|
||||
- targets: ['host.docker.internal:3001']
|
||||
Reference in New Issue
Block a user