Commit Graph

5 Commits

Author SHA1 Message Date
hailin e8e2d14fbc fix(health): 修正NestJS服务健康检查URL路径 /health → /api/v1/health
NestJS服务注册了全局路由前缀 api/v1,HealthController 实际挂载在
/api/v1/health 而非 /health,导致 Docker HEALTHCHECK 返回 404。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 05:50:26 -08:00
hailin c5787020d2 feat(health): 为全部12个微服务添加Docker健康检查
## 变更概要
所有后端微服务均增加 Docker HEALTHCHECK 指令,统一通过 GET /health
端点检测服务存活状态。解决 `docker ps` 中13个容器无 (healthy) 状态的问题。

## NestJS 服务 (9个)
- auth-service (:3010), user-service (:3001), issuer-service (:3002),
  clearing-service (:3004), compliance-service (:3005), ai-service (:3006),
  notification-service (:3008), telemetry-service (:3011), admin-service (:3012)
- 7个服务的 app.module.ts 新增 `import { HealthModule } from '@genex/common'`
  注册标准健康检查控制器 (GET /health, /health/ready, /health/live)
- telemetry-service 和 admin-service 已有自建 HealthController,无需导入
- Dockerfile: HEALTHCHECK --interval=30s --start-period=15s --retries=3

## Go 服务 (3个)
- trading-service (:3003), translate-service (:3007), chain-indexer (:3009)
- 已有 /health 端点 (Gin 路由),仅 Dockerfile 添加 HEALTHCHECK
- Dockerfile: HEALTHCHECK --interval=30s --start-period=10s --retries=3

## Kafka Connect
- docker-compose.yml 添加 healthcheck (curl http://localhost:8083/)

## 健康检查方式
- 所有服务统一使用 `wget --spider http://localhost:PORT/health`
  (node:20-alpine 和 alpine:3.19 均自带 BusyBox wget)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 05:39:25 -08:00
hailin d48bd3acb9 feat(docker): 重构Monorepo构建 — 支持@genex/common共享包
- docker-compose.yml build context从service目录改为backend根目录
- 所有NestJS Dockerfile改为先构建共享@genex/common包
- 共享包编译后复制到service的node_modules供运行时解析
- 新增backend/.dockerignore减少构建上下文体积

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 19:00:27 -08:00
hailin 12bb31ede1 fix(docker): 所有NestJS服务Dockerfile使用npm install替代npm ci
项目未包含package-lock.json,npm ci要求该文件存在才能运行。
改用npm install确保Docker构建正常完成。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 17:33:31 -08:00
hailin ad93bc728f feat: 完成全部后端微服务开发 (10服务/373文件/15586行代码)
## 架构概览
- 10个微服务: 7 NestJS + 3 Go/Gin
- DDD + Clean Architecture (Domain/Application/Infrastructure/Interface 四层)
- Kong API Gateway (8080) 统一入口
- PostgreSQL + Redis + Kafka(KRaft) + MinIO 基础设施

## 微服务清单
| 服务 | 技术 | 端口 | 职责 |
|------|------|------|------|
| auth-service | NestJS | 3010 | JWT双Token认证(15min+7d)、注册/登录/刷新/登出 |
| user-service | NestJS | 3001 | 用户Profile、KYC审核、钱包(充值/提现)、消息 |
| issuer-service | NestJS | 3002 | 发行方入驻、券CRUD/搜索/购买、定价引擎、信用评分 |
| trading-service | Go/Gin | 3003 | 撮合引擎(价格-时间优先)、订单簿、做市商API |
| clearing-service | NestJS | 3004 | 交易结算、退款、Breakage、ASC 606会计分录 |
| compliance-service | NestJS | 3005 | AML(5模式)、OFAC筛查、Travel Rule、SAR报告 |
| ai-service | NestJS | 3006 | ACL反腐败层→外部AI Agent集群(含本地降级) |
| translate-service | Go/Gin | 3007 | 区块链地址映射翻译 |
| notification-service | NestJS | 3008 | 推送/短信/邮件/站内通知、事件消费 |
| chain-indexer | Go/Gin | 3009 | 区块链索引器(Mock) |

## Admin API (18个管理模块)
覆盖admin-web全部18+页面:
Dashboard、用户管理、系统管理、用户分析、发行方管理、券管理、
券分析、商户核销、交易监控、做市商管理、财务管理、报表中心、
风控中心、合规审计、争议处理、保险理赔、AI Agent面板、通知管理

## 数据库
- 31个SQL迁移 (000-031) + 种子数据
- 乐观锁(@VersionColumn) + 悲观锁(SELECT FOR UPDATE) + Redis分布式锁
- Outbox Pattern保证消息可靠投递 + 24h幂等窗口

## 共享包
- @genex/common: Guards/Decorators/DTOs/Outbox/Health/Locking/AI-Client
- @genex/kafka-client: 生产者/消费者/Topic定义/KRaft集群支持

## 部署与测试
- docker-compose.yml: 全栈一键启动
- Swagger文档: 7个NestJS服务 /docs 端点
- E2E测试脚本: scripts/run-e2e.sh (Auth→Profile→Wallet→Trading→Admin)
- 迁移脚本: scripts/migrate.sh + scripts/test-setup.sh

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 17:09:12 -08:00