背景:此前误将宿主端口冲突当作新建 compose 服务的理由,实际应按技术架构使用本机已有 PostgreSQL/Redis。 改动: - 删除 lingxi-pg / lingxi-redis 容器及数据卷,不再另起数据库; - DATABASE_URL 改回 127.0.0.1:5432/lingxi,REDIS_URL 改回 127.0.0.1:6379; - 在已有 docker-postgres-1 中创建 lingxi 库并执行迁移/seed; - compose 仅保留无法拉取镜像的 S3 兼容服务; - README、A0 报告同步依赖来源。 影响面:仅本地开发依赖与文档;代码/接口/数据模型不变。 回滚方式:git revert 本提交,并按旧 compose 重新初始化(不推荐)。 验证:migrate deploy、db:seed、test:int、pnpm ci:local(85.9s)全部通过。
This commit is contained in:
1 parent
68b5ca20f4
commit
620cb93a46
4 files changed
+19
-55
No files matched your search
@@ -9,7 +9,7 @@
|
||||
| WBS | 状态 | 落地内容 |
|
||||
| --- | --- | --- |
|
||||
| A0-INF-01 Monorepo / 工具链 | 完成 | pnpm workspace + Turborepo;TS strict、ESLint 9 flat + Prettier + commitlint + lint-staged + husky;`.nvmrc` / `engines` / `packageManager` / preinstall 仅允许 pnpm;目录与 AGENTS.md §5 一致 |
|
||||
| A0-INF-02 本地依赖与迁移种子 | 完成(种子范围受限,见 §4.4) | `infra/docker-compose.dev.yaml`(PG 18 / Redis 7.4 / S3 兼容服务)+ 健康检查;`.env.example`;Prisma 初始化与首版迁移;`system_configs` 幂等种子 |
|
||||
| A0-INF-02 本地依赖与迁移种子 | 完成(种子范围受限,见 §4.4) | 复用本机 `docker-postgres-1`(PostgreSQL 18,5432)与 `docker-redis-1`(6379);`infra/docker-compose.dev.yaml` 仅管理 S3 兼容服务;`.env.example`;Prisma 初始化与首版迁移;`system_configs` 幂等种子 |
|
||||
| A0-INF-03 CI 与质量门禁 | 完成 | `.gitea/workflows/ci.yml`:install → format → lint → typecheck → test → build → migrate → test:int → openapi:export/diff → e2e;新增 `pnpm ci:local` 在无 runner 时本地执行同一门禁;失败阻断 |
|
||||
| A0-BE-01 API 骨架 | 完成 | NestJS 11 + Fastify;Pino + `trace_id`;统一错误体 `{code,message,details,trace_id}`;`GET /health`;`/api/docs` 与 OpenAPI JSON;Zod 管道;CORS / Helmet |
|
||||
| A0-BE-02 Prisma 基线 | 完成 | `PrismaService` 封装;`outbox_events` / `idempotency_keys` / `system_configs`;ULID `char(26)`、软删/时间字段约定;首版迁移可重复执行 |
|
||||
@@ -41,16 +41,16 @@
|
||||
| `pnpm test:int` | 通过(真实 PostgreSQL + Redis,`/health` 200) |
|
||||
| `pnpm test:e2e` | 通过(4/4,Playwright/Chrome) |
|
||||
| `pnpm openapi:export` + `pnpm openapi:diff` | 通过;快照含 20 个错误码,OpenAPI `3.1.0` |
|
||||
| `pnpm compose:up` | 通过;`lingxi-pg` / `lingxi-redis` / `lingxi-s3` 均 healthy |
|
||||
| `pnpm compose:up` | 通过;`lingxi-s3` healthy;PG / Redis 使用本机已运行容器,`/health` 与 `test:int` 验证连通 |
|
||||
| API 启动 | `/health` 200、`/api/docs` 200、`/api/openapi.json` 200 |
|
||||
| Worker 启动 | 连接 Redis 成功,收到 SIGTERM 后正常退出 |
|
||||
| 种子幂等 | 连续执行两次,`system_configs` 保持 7 条 |
|
||||
|
||||
## 4. 与文档的差异与待确认
|
||||
|
||||
### 4.1 宿主端口(环境适配)
|
||||
### 4.1 本地依赖来源(环境适配)
|
||||
|
||||
本机已有容器占用 5432 / 6379,A0 compose 宿主端口改为 **15432(PG)/ 16379(Redis)/ 19000–19001(S3)**,容器内端口不变。`.env.example` 已按宿主端口提供连接串;本地数据库为 `lingxi`,用户 `postgres`,密码 `postgres`(仅开发环境)。CI services 使用标准端口,凭据同为 `postgres/postgres`。
|
||||
本地 PostgreSQL 与 Redis **复用本机已有 Docker 服务**,不另起容器:`docker-postgres-1`(PostgreSQL 18,`127.0.0.1:5432`,库 `lingxi`、用户 `postgres`、密码 `postgres`)与 `docker-redis-1`(`127.0.0.1:6379`)。`infra/docker-compose.dev.yaml` 仅保留 S3 兼容服务(宿主 `19000/19001`)。CI services 使用标准 5432/6379,凭据同为 `postgres/postgres`。
|
||||
|
||||
### 4.2 对象存储镜像不可得(环境适配)
|
||||
|
||||
@@ -80,7 +80,7 @@ npm 上 `oasdiff` 为占位包(0.0.1-security),A0 暂用自研 `scripts/op
|
||||
|
||||
当前离线 Gitea 未部署 Actions runner,推送后远程 CI 会停留在 `queued`。A0 增加 `pnpm ci:local`:按 `.gitea/workflows/ci.yml` 的顺序在本地执行 compose、格式、Lint、类型、单测、构建、迁移与种子、集成、OpenAPI 契约与 e2e,全部通过才退出 0;runner 就绪后远程工作流可直接接管。
|
||||
|
||||
本地开发数据库已按约定改为:库名 `lingxi`、用户 `postgres`、密码 `postgres`;compose、`.env.example`、CI services 三处保持一致。
|
||||
本地开发库为 `lingxi` / `postgres` / `postgres`,直接连接本机已有 PostgreSQL 容器;`.env.example` 与 CI services 保持一致。
|
||||
|
||||
### 4.8 前端视觉方向
|
||||
|
||||
|
||||
Reference in new issue
Block a user