diff --git a/README.md b/README.md index 8a3d00c..3204f0d 100644 --- a/README.md +++ b/README.md @@ -152,11 +152,12 @@ N8N_BASE_URL=http://127.0.0.1:5670 - 触发 `real_cut_pipeline` - 触发 `ai_video_pipeline` - 历史旧运行链已完成移除,当前运行时只保留 StoryForge 自身服务与外部执行引擎 -- 当前公网接入采用“云服务器 HTTPS 入口 + 本机桥接隧道 + 本机现网执行链”模式: +- 当前公网接入采用“云服务器 HTTPS 入口 + 云服务器本地 collector + 本地桥接执行引擎”模式: - `https://storyforge.hyzq.net/` 由云服务器 `nginx` 提供 HTTPS 入口 - `/` 静态页由云服务器本地 `StoryForge Web V4` 直出 - - `/v2/*`、`/openapi.json`、`/healthz` 反向代理到本机 `collector-service` - - `cutvideo / huobao / 本机模型 / NAS 录制` 继续由本机和局域网执行链提供 + - `/v2/*`、`/openapi.json`、`/healthz` 反向代理到云服务器本地 `collector-service` + - 业务数据库已上云,当前路径为云服务器本地 `storyforge.db` + - `n8n / cutvideo / huobao / 本机模型 / ASR / NAS 录制` 继续由本机和局域网执行链提供,并通过受控桥接暴露给云上的 `collector-service` ## 说明 diff --git a/deploy/STORYFORGE_PUBLIC_GATEWAY.md b/deploy/STORYFORGE_PUBLIC_GATEWAY.md index 2de74c9..863d639 100644 --- a/deploy/STORYFORGE_PUBLIC_GATEWAY.md +++ b/deploy/STORYFORGE_PUBLIC_GATEWAY.md @@ -4,36 +4,43 @@ 1. 云服务器 `nginx` 提供 `https://storyforge.hyzq.net/` 2. 云服务器本地 `storyforge-web-v4.service` 承接静态前端 -3. 本机 `collector-service` 继续承接业务与局域网执行引擎 -4. 本机通过 SSH 反向隧道只桥接 API 到云服务器 +3. 云服务器本地 `collector-service` 直接承接业务 API 与数据库 +4. 本机通过 SSH 反向隧道只桥接本地和局域网执行引擎到云服务器 ## 端口映射 -- 云服务器 `127.0.0.1:18181` -> 本机 `127.0.0.1:8081` +- 云服务器 `127.0.0.1:8081` -> 云服务器本地 `collector-service` - 云服务器 `127.0.0.1:19191` -> 云服务器本地 `StoryForge Web V4` 静态服务 +- 云服务器 `127.0.0.1:15670` -> 本机 `n8n :5670` +- 云服务器 `127.0.0.1:18317` -> 本机模型网关 `:8317` +- 云服务器 `127.0.0.1:18088` -> 本机 `ASR :8088` +- 云服务器 `127.0.0.1:15678` -> 本机 `huobao :5678` +- 云服务器 `127.0.0.1:17860` -> 局域网 Windows `cutvideo :7860` +- 云服务器 `127.0.0.1:19106` -> 局域网 NAS `live-recorder :19106` ## 本机常驻服务 -- `com.storyforge.collector` - `com.storyforge.cloud-bridge` +- 本机 `com.storyforge.collector` 可保留为本地开发,不再是公网必需项 - 本机 `com.storyforge.web-v4` 仍可保留为本地预览,不再是公网必需项 ## 云服务器 `nginx` 路由 - `/` -> `127.0.0.1:19191` -- `/v2/*` -> `127.0.0.1:18181` -- `/openapi.json` -> `127.0.0.1:18181/openapi.json` -- `/healthz` -> `127.0.0.1:18181/healthz` -- `/downloads/*` -> `127.0.0.1:18181/downloads/*` +- `/v2/*` -> `127.0.0.1:8081` +- `/openapi.json` -> `127.0.0.1:8081/openapi.json` +- `/healthz` -> `127.0.0.1:8081/healthz` +- `/downloads/*` -> `127.0.0.1:8081/downloads/*` ## 当前优点 +- `collector-service` 和数据库已经上云,公网主链不再依赖本机业务 API - 不需要把 `cutvideo / huobao / NAS live-recorder / 本机模型` 全部搬上云 - 公网入口统一 - 前端静态页不再依赖本机桥接 -- 本机现网能力不需要改造即可对外开放 +- 本地和局域网执行层不需要迁移即可继续提供能力 ## 当前限制 -- 本机 API 桥接断开时,登录和业务 API 不可用 -- 这是公网 staging / 私有运营入口,更接近“公网可访问的现网桥接”,不是最终完全云原生部署 +- 本地桥接断开时,相关执行引擎会不可用,但登录和基础业务 API 仍可用 +- 这仍是混合部署测试架构,不是最终完全云原生部署 diff --git a/deploy/com.storyforge.cloud-bridge.plist.example b/deploy/com.storyforge.cloud-bridge.plist.example index fad7dde..971eeba 100644 --- a/deploy/com.storyforge.cloud-bridge.plist.example +++ b/deploy/com.storyforge.cloud-bridge.plist.example @@ -23,7 +23,17 @@ -o UserKnownHostsFile=/Users/kris/.ssh/known_hosts -R - 127.0.0.1:18181:127.0.0.1:8081 + 127.0.0.1:15670:127.0.0.1:5670 + -R + 127.0.0.1:18317:127.0.0.1:8317 + -R + 127.0.0.1:18088:127.0.0.1:8088 + -R + 127.0.0.1:15678:127.0.0.1:5678 + -R + 127.0.0.1:17860:192.168.31.18:7860 + -R + 127.0.0.1:19106:192.168.31.188:19106 ubuntu@111.231.132.51 RunAtLoad diff --git a/deploy/storyforge-collector.service.example b/deploy/storyforge-collector.service.example new file mode 100644 index 0000000..fd3840d --- /dev/null +++ b/deploy/storyforge-collector.service.example @@ -0,0 +1,26 @@ +[Unit] +Description=StoryForge Collector Service +After=network.target + +[Service] +User=ubuntu +Group=ubuntu +WorkingDirectory=/home/ubuntu/storyforge/collector-service +Environment=DATA_DIR=/home/ubuntu/storyforge/data/collector +Environment=DATABASE_PATH=/home/ubuntu/storyforge/data/collector/storyforge.db +Environment=JOBS_DIR=/home/ubuntu/storyforge/data/collector/jobs +Environment=DOWNLOADS_DIR=/home/ubuntu/storyforge/data/collector/downloads +Environment=MODELS_DIR=/home/ubuntu/storyforge/data/collector/models +Environment=DEFAULT_EXTERNAL_BASE_URL=https://storyforge.hyzq.net +Environment=LOCAL_OPENAI_BASE_URL=http://127.0.0.1:18317/v1 +Environment=ASR_HTTP_BASE_URL=http://127.0.0.1:18088 +Environment=N8N_BASE_URL=http://127.0.0.1:15670 +Environment=HUOBAO_BASE_URL=http://127.0.0.1:15678 +Environment=CUTVIDEO_BASE_URL=http://127.0.0.1:17860 +Environment=LIVE_RECORDER_BASE_URL=http://127.0.0.1:19106 +ExecStart=/home/ubuntu/storyforge/collector-service/.venv/bin/python -m uvicorn app.main:app --host 127.0.0.1 --port 8081 +Restart=always +RestartSec=3 + +[Install] +WantedBy=multi-user.target diff --git a/deploy/storyforge-hyzq-net-nginx.conf b/deploy/storyforge-hyzq-net-nginx.conf index acf5010..72a8a9d 100644 --- a/deploy/storyforge-hyzq-net-nginx.conf +++ b/deploy/storyforge-hyzq-net-nginx.conf @@ -23,7 +23,7 @@ server { location = /healthz { auth_basic off; - proxy_pass http://127.0.0.1:18181/healthz; + proxy_pass http://127.0.0.1:8081/healthz; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; @@ -33,7 +33,7 @@ server { location = /openapi.json { auth_basic off; - proxy_pass http://127.0.0.1:18181/openapi.json; + proxy_pass http://127.0.0.1:8081/openapi.json; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; @@ -43,7 +43,7 @@ server { location = /api/v1/app/update/latest { auth_basic off; - proxy_pass http://127.0.0.1:18181/api/v1/app/update/latest; + proxy_pass http://127.0.0.1:8081/api/v1/app/update/latest; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; @@ -53,7 +53,7 @@ server { location ^~ /downloads/ { auth_basic off; - proxy_pass http://127.0.0.1:18181/downloads/; + proxy_pass http://127.0.0.1:8081/downloads/; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; @@ -65,7 +65,7 @@ server { location ^~ /v2/ { auth_basic off; - proxy_pass http://127.0.0.1:18181/v2/; + proxy_pass http://127.0.0.1:8081/v2/; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; @@ -78,7 +78,7 @@ server { location ^~ /docs { auth_basic off; - proxy_pass http://127.0.0.1:18181; + proxy_pass http://127.0.0.1:8081; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; @@ -91,7 +91,7 @@ server { location ^~ /redoc { auth_basic off; - proxy_pass http://127.0.0.1:18181; + proxy_pass http://127.0.0.1:8081; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr;