deploy: harden compose harness

This commit is contained in:
dela
2026-05-24 21:18:19 +08:00
parent ea22d06dab
commit 542eeefdbd
9 changed files with 110 additions and 13 deletions

View File

@@ -84,6 +84,9 @@ go test ./internal/<pkg>/...
# 全部测试
make test # 等价于 go test ./...
# 生产部署 / 架构守卫
make guard
# 启动(需要先 make docker-up && make migrate-up
make run
```
@@ -122,6 +125,7 @@ grep -ri "apikey\|x-mbx-apikey\|hmac\|secret_key\|api_secret" --include="*.go" .
4. **Rate limit**:默认 20 req/s`config.Binance.RPS`)。新增 collector 任务前估算 weight 预算Binance 2400 weight/min IP 上限)。
5. **国内网络**`fapi.binance.com` 直连不稳定,通过 `HTTPS_PROXY` 环境变量挂代理。
6. **Upsert 幂等**5 张表的主键都包含时间维度,所有 repo 的 `UpsertMany` 使用 `ON CONFLICT DO UPDATE`,可安全重复执行。
7. **Compose 部署约束**`.env.example` 不给默认 DB 密码;宿主机端口只改 `APP_HOST_PORT`;容器内 `APP_PORT` 固定 8080migration 必须在 app 前完成;`.dockerignore` 必须排除 `.env` / `.env.*`
---