Files
mnote/infra/convex/README.md
T
2026-01-17 10:12:53 +08:00

48 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Convex 自托管(Windows 本机)
本目录用于在本机通过 Docker Compose 启动 Convex backend + dashboard,并使用 backend 自身的持久化卷存储(包含数据库与文件存储)。
## 启动
1. 确保 `infra/convex/.env` 存在(已在本仓库中生成,且被 `.gitignore` 忽略)。
2. 在本目录执行:
```bash
docker compose --env-file .env up -d
```
## 生成 Dashboard / CLI admin key
在本目录执行:
```bash
docker compose --env-file .env exec backend ./generate_admin_key.sh
```
## 访问地址(默认)
- Dashboard`http://localhost:6791`
- Backend`http://127.0.0.1:3210`
- HTTP Actions`http://127.0.0.1:3211`
- 文件存储:由 Convex 管理(Dashboard 的 Files 页面可查看)
## 快速验证(可选)
### 1) 验证 Convex functions 可用
`wolai-frontend/` 执行:
```bash
npx convex dev --once --tail-logs disable --env-file .env.local --run ping:ping
```
### 2) 验证固定开发用户(阶段 3)
启动前端后访问:`http://localhost:3000/api/dev/whoami`
### 3) 验证异步任务骨架(阶段 5)
启动前端后:
- `POST http://localhost:3000/api/dev/jobs/demo`body 可选:`{ "ms": 800 }`)创建 demo job
- `GET http://localhost:3000/api/dev/jobs/demo?id=<jobId>` 查询状态(queued/running/succeeded/failed