feat: 按历史痕迹恢复 nginx 同域入口

This commit is contained in:
Cheng Zhou
2026-03-31 09:16:41 +08:00
parent ada3beca8e
commit 9535fece6c
8 changed files with 122 additions and 30 deletions
+7 -9
View File
@@ -4,14 +4,14 @@
- 生产入口:`docker-compose.yaml`
- 初始化方式:`docker compose run --rm backend-init`
- 启动方式:`docker compose up -d --build`
- 运行拓扑:`frontend``backend``db`
- 对外入口:仓库外部统一反向代理;建议将 `/` 转发到 `frontend`,将 `/api``/health` 转发到 `backend`
- 运行拓扑:`nginx``backend``db`
- 对外入口:`nginx` 提供前端静态资源,并同域反代后端 API
- 数据库 schema 来源:Alembic migration,不再依赖 `database/init.sql`
- 默认无任何 demo 数据;生产初始化只确保固定管理员 `admin@huapont.cn / admin123` 存在
- 验证方式:
- `docker compose config`
- `curl -i http://127.0.0.1:4173/`
- `curl -i http://127.0.0.1:8000/health`
- `curl -i http://127.0.0.1/`
- `curl -i http://127.0.0.1/health`
## 账号与注册
- 初始化管理员:`admin@huapont.cn / admin123`(通过生产初始化命令显式创建)
@@ -28,11 +28,9 @@
- 普通成员(无项目角色):仅浏览
## 访问方式
- 前端:`http://localhost:4173`
- 后端 API`http://localhost:8000/api/v1/*`
- 生产环境建议通过外部反向代理提供同域访问,前端代码默认请求同域 `/api/v1/*`
- 如果本地直接访问 `http://localhost:4173`,可在 `frontend/.env` 中设置 `VITE_API_BASE_URL=http://localhost:8000`,让前端直连后端 API
- `docker compose` 构建前端容器时,默认不注入 `VITE_API_BASE_URL`,生产会走同域 `/api/v1/*`;仅在本地直连后端时才显式设置 `VITE_API_BASE_URL=http://localhost:8000`
- 前端:`http://localhost`
- 后端 API同域 `/api/v1/*`
- `nginx` 负责托管前端静态资源,并将 `/api``/health` 转发到 `backend`
## 仓库治理文档
- 分支治理规范:`docs/branch-governance.md`