架构 - 后端从 flat routes/ 重构为 modules/<domain>/ 模块化结构(8个模块) - 四层架构:Route -> Service -> Repository -> Prisma - 新增 shared/ 基础设施(AppError 异常体系、ALS 上下文、prom-client 指标) - 前端 Toast/Skeleton/Alert 组件基建 + formulaService 模板 安全 - JWT 签名算法修复(HS256 用 createHmac 而非 createHash) - 密码哈希 async scrypt + timingSafeEqual - API Key 从 localStorage 迁移至服务端 runtime/config.json - Helmet 安全头 + rate-limit 全局限流 100 req/min - 全局 auth preHandler + RBAC + Ownership 中间件 颜色引擎 - 色匹配切换为 cube 粗筛 + CIEDE2000 精排 - PantoneColor 表 + 种子数据 + 搜索端点 - AI 配色 Prompt 注入成分库 colorant 列表 配方推演 - 本地优化引擎(同 category 替换 + 成本排序) - baseFormulaId 支持 + Pareto 散点图 文档 - ADR-0003 四层架构、ADR-0004 RBAC 授权模型 - 更新 ADR-0001/0002 - api-reference.md(29端点)、project-overview.md 部署 - Dockerfile * 2 + nginx.conf + docker-compose.prod.yml - 健康探针 + 优雅关闭 + pg_dump 备份脚本 - ESLint + Prettier + tsconfig strict
71 lines
1.9 KiB
YAML
71 lines
1.9 KiB
YAML
services:
|
|
traefik:
|
|
image: traefik:latest
|
|
container_name: colorfull-traefik
|
|
command:
|
|
- "--api.insecure=true"
|
|
- "--providers.docker=true"
|
|
- "--entrypoints.web.address=:80"
|
|
- "--entrypoints.websecure.address=:443"
|
|
ports:
|
|
- "80:80"
|
|
- "443:443"
|
|
volumes:
|
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
|
restart: unless-stopped
|
|
|
|
postgres:
|
|
build:
|
|
context: ./docker
|
|
dockerfile: Dockerfile.pgvector
|
|
container_name: colorfull-db
|
|
environment:
|
|
POSTGRES_DB: colorfull
|
|
POSTGRES_USER: colorfull
|
|
POSTGRES_PASSWORD: "${DB_PASSWORD:-colorfull}"
|
|
ports:
|
|
- "5432:5432"
|
|
volumes:
|
|
- pgdata:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U colorfull -d colorfull"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
restart: unless-stopped
|
|
labels:
|
|
- "traefik.enable=false"
|
|
|
|
backend:
|
|
build: ./backend
|
|
container_name: colorfull-backend
|
|
environment:
|
|
NODE_ENV: production
|
|
PORT: 3001
|
|
DATABASE_URL: postgresql://colorfull:${DB_PASSWORD:-colorfull}@postgres:5432/colorfull
|
|
JWT_SECRET: "${JWT_SECRET}"
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
restart: unless-stopped
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.http.routers.backend.rule=Host(`localhost`) && PathPrefix(`/api`)"
|
|
- "traefik.http.services.backend.loadbalancer.server.port=3001"
|
|
- "traefik.http.services.backend.loadbalancer.healthcheck.path=/api/health/live"
|
|
- "traefik.http.services.backend.loadbalancer.healthcheck.interval=10s"
|
|
|
|
frontend:
|
|
build: ./frontend
|
|
container_name: colorfull-frontend
|
|
depends_on:
|
|
- backend
|
|
restart: unless-stopped
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.http.routers.frontend.rule=Host(`localhost`)"
|
|
- "traefik.http.services.frontend.loadbalancer.server.port=80"
|
|
|
|
volumes:
|
|
pgdata:
|