Add optional frpc deployment profile

- Add frpc/frpc.toml template for mapping the local Docker web entry on port 4002 to the public frps server.

- Add an optional Docker Compose frpc service behind the frpc profile, mounting the reusable frpc.toml configuration.

- Document how to enable the frpc profile, inspect frpc logs, and keep normal local startup unchanged.

- Clarify that public deployments should map only port 4002 and let Nginx Proxy Manager provide HTTPS for sstwbg.example.com instead of exposing 4443.

- Update Docker and deployment docs to match the reusable frpc workflow.
This commit is contained in:
2026-05-08 16:38:39 +08:00
parent 3313811d2f
commit a781227474
5 changed files with 78 additions and 6 deletions

View File

@@ -85,6 +85,7 @@ docker-compose up -d --build
- `web`:前端静态站点,暴露 `http://localhost:4002``https://localhost:4443`
- `api`NestJS API暴露 `http://localhost:3002`
- `db`PostgreSQL 16暴露 `localhost:5433`
- `frpc``# XXX` 可选公网隧道客户端,通过 `--profile frpc` 启用,读取 `frpc/frpc.toml` 把本机 `4002` 映射到公网 frps。
- `uploads_data`:后端文件持久化 volume。
`api` 容器启动时默认会等待数据库健康,执行 `prisma migrate deploy``prisma db seed`,再启动 NestJS API。可通过 `RUN_DB_MIGRATIONS``RUN_DB_SEED` 关闭自动初始化。
@@ -120,7 +121,10 @@ docker-compose up -d --build
export SESSION_SECRET="替换为足够长的随机字符串"
export SESSION_COOKIE_SECURE="true"
export TRUST_PROXY="true"
docker-compose up -d --build
# XXX 先编辑 frpc/frpc.toml替换 serverAddr 和 auth.token再启用 frpc profile。
docker-compose --profile frpc up -d --build
docker-compose logs -f frpc
```
Nginx Proxy Manager 代理 `sstwbg.example.com` 时:
@@ -130,6 +134,8 @@ Nginx Proxy Manager 代理 `sstwbg.example.com` 时:
- 绑定 SSL 证书并开启 `Force SSL`,否则浏览器不会开放公网麦克风权限。
- Advanced 中建议设置 `client_max_body_size 100m;``proxy_read_timeout 3600s;``proxy_send_timeout 3600s;`
`# XXX` 公网正式访问只映射 `4002` 即可;不要把 Docker 自签名 HTTPS 演示入口 `4443` 映射到公网域名。
## 麦克风访问
浏览器不允许普通局域网 HTTP 页面调用麦克风代码无法绕过这个限制。Docker 演示环境建议使用:

View File

@@ -4,13 +4,14 @@
## 服务组成
`docker-compose.yaml` 启动三个服务:
`docker-compose.yaml` 默认启动三个核心服务,另提供一个可选 frpc 服务:
| 服务 | 容器名 | 说明 | 宿主机端口 |
| --- | --- | --- | --- |
| `web` | `tuwen_web` | Nginx 托管前端静态文件,并代理 `/api` 到后端 | `4002``4443` |
| `api` | `tuwen_api` | NestJS API、Session、AI/语音代理、文件上传 | `3002` |
| `db` | `tuwen_db` | PostgreSQL 16 | `5433` |
| `frpc` | `tuwen_frpc` | `# XXX` 可选公网隧道客户端,通过 `--profile frpc` 启用 | 使用 `frpc/frpc.toml` |
持久化 volume
@@ -124,7 +125,10 @@ https://localhost:4443
export SESSION_SECRET="替换为足够长的随机字符串"
export SESSION_COOKIE_SECURE="true"
export TRUST_PROXY="true"
docker-compose up -d --build
# XXX 先编辑 frpc/frpc.toml替换 serverAddr 和 auth.token再启用 frpc profile。
docker-compose --profile frpc up -d --build
docker-compose logs -f frpc
```
Nginx Proxy Manager 配置要点:
@@ -136,6 +140,8 @@ Nginx Proxy Manager 配置要点:
- SSL 页签绑定证书并开启 `Force SSL`,保证浏览器开放麦克风权限。
- Advanced 中建议设置 `client_max_body_size 100m;``proxy_read_timeout 3600s;``proxy_send_timeout 3600s;`
`# XXX` 公网正式访问只映射 `4002` 即可;不要把本机自签名 HTTPS 演示入口 `4443` 直接映射为公网域名入口。公网 HTTPS 应由 Nginx Proxy Manager 负责。
公网验收先访问 `https://sstwbg.example.com/api/health`再登录并测试报告保存、视频抽帧、AI 对话和语音听写。
## 生产部署前必须修改