build: local stack, container images and the end-to-end smoke script
docker-compose brings up PostgreSQL 16 with pgvector and Redis 7 on non-standard host ports so it never collides with an existing local database. scripts/smoke.sh is the proof: compose, migrate, boot the API, issue a token, call the real DeepSeek API and print the resulting ob_ai_call and bl_ledger rows. services/vision and services/matting are placeholders noting that the local RTX 5090 makes BiRefNet and RTMPose developable without cloud GPU.
This commit is contained in:
Executable
+41
@@ -0,0 +1,41 @@
|
||||
# `deploy/`
|
||||
|
||||
| 文件 | 用途 |
|
||||
| --- | --- |
|
||||
| `docker-compose.dev.yml` | 本地开发栈:PostgreSQL 16 + pgvector、Redis 7(均带 healthcheck) |
|
||||
| `Dockerfile.api` | API 镜像(gunicorn + uvicorn worker) |
|
||||
| `Dockerfile.worker` | Celery worker 镜像(队列由 `CELERY_QUEUES` 注入) |
|
||||
|
||||
```bash
|
||||
make up # 只起 postgres + redis
|
||||
make down
|
||||
docker compose -f deploy/docker-compose.dev.yml --profile app up -d # 连 api/worker 一起
|
||||
```
|
||||
|
||||
本地端口刻意用 **55432 / 56379**,避免和开发机上已有的 PG/Redis 撞车。
|
||||
|
||||
## V1 生产形态(架构 §14.1)
|
||||
|
||||
单可用区 + Docker Compose,不上 K8s(TD-03、团队规模):
|
||||
|
||||
```
|
||||
CLB → CVM-app: nginx / api / admin / worker-cpu / worker-io / beat / vision-svc
|
||||
CVM-gpu(按需启停): tryon-svc / worker-gpu / matting
|
||||
云数据库 PostgreSQL(pgvector) · 云数据库 Redis · COS×4 + CDN · CLS
|
||||
```
|
||||
|
||||
**GPU 实例按需启停是 V1 最有效的成本手段**:队列有积压时拉起,空闲一段时间后
|
||||
释放(NFR-COST-04)。
|
||||
|
||||
## 规矩
|
||||
|
||||
- **镜像里不许有密钥**(架构 §11.2)。配置一律从环境变量注入,生产走 SSM/KMS。
|
||||
`env_file: ../.env` 只在本地 compose 用。
|
||||
- 数据库迁移是发布流程里的**独立步骤**,先迁移后发布(§14.3)。
|
||||
- 镜像打标签化版本,不要用 `latest` 发布。
|
||||
- 容器以非 root 用户运行,两个 Dockerfile 都已如此。
|
||||
|
||||
## 还没有的东西
|
||||
|
||||
nginx 配置、TLS 终止、CLB/CDN 配置、COS 四桶的生命周期策略(临时桶 ≤ 2 小时,
|
||||
CR-02)、Grafana 三张看板、告警规则、备份与恢复演练脚本(FR-SYS-09)。
|
||||
Reference in New Issue
Block a user