chore: add Otari local development base

This commit is contained in:
wlx committed 2026-08-20 13:14:03 +08:00
1 parent 06cfbbacc3
commit a4c93ff1a7
8 files changed
+134 -1

No files matched your search

+57
View File
@@ -0,0 +1,57 @@
# Otari 本地基座
这是 D2 的本地开发基座,使用 Otari `v0.4.0` 和 PostgreSQL。它只负责为后续 MOYI 控制面提供可复现的网关与用量基础,不替代 MOYI 用户端或管理端。
## 目录
- `docker-compose.yml`:Otari 与 PostgreSQL 服务、持久化卷和健康检查。
- `config.yml.example`:本地网关配置模板。
- `.env.example`:端口、数据库和密钥变量模板。
- `service_account.json.example`:Vertex AI 配置占位文件,不包含真实凭证。
## 启动
PowerShell:
```powershell
cd infra/otari
Copy-Item .env.example .env
Copy-Item config.yml.example config.yml
Copy-Item service_account.json.example service_account.json
```
编辑 `.env` 和 `config.yml`,至少替换:
- `OTARI_SECRET_KEY`
- `POSTGRES_PASSWORD`
- `master_key`
- 一个真实供应商 Key,或先保持空值只启动管理界面
启动服务:
```powershell
docker compose up -d
docker compose ps
Invoke-WebRequest http://localhost:8000/health
```
预期健康响应:`{"status":"healthy"}`。首次启动后打开 `http://localhost:8000/`,使用 `master_key` 进入 Otari 管理界面。
## 停止与数据
```powershell
docker compose down
```
不要使用 `docker compose down -v`,除非明确要删除本地数据库。PostgreSQL 数据保存在 Docker 卷 `moyi-otari_otari_postgres_data` 中。
## 安全边界
- `.env`、`config.yml` 和 `service_account.json` 不提交到 Git。
- `master_key` 用于网关管理接口,不能作为普通用户调用 Key。
- 供应商 Key 只通过本地环境变量或 Otari 管理界面配置。
- 生产部署必须固定镜像 digest,并重新审计 Otari 及其依赖许可证。
## 版本依据
本节点按 Otari `v0.4.0` 的官方发布说明和官方 Compose/config 示例建立。正式联调前仍需用固定 digest 验证镜像内容和 API 行为。