deploy: move collector and db to cloud
This commit is contained in:
@@ -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 仍可用
|
||||
- 这仍是混合部署测试架构,不是最终完全云原生部署
|
||||
|
||||
@@ -23,7 +23,17 @@
|
||||
<string>-o</string>
|
||||
<string>UserKnownHostsFile=/Users/kris/.ssh/known_hosts</string>
|
||||
<string>-R</string>
|
||||
<string>127.0.0.1:18181:127.0.0.1:8081</string>
|
||||
<string>127.0.0.1:15670:127.0.0.1:5670</string>
|
||||
<string>-R</string>
|
||||
<string>127.0.0.1:18317:127.0.0.1:8317</string>
|
||||
<string>-R</string>
|
||||
<string>127.0.0.1:18088:127.0.0.1:8088</string>
|
||||
<string>-R</string>
|
||||
<string>127.0.0.1:15678:127.0.0.1:5678</string>
|
||||
<string>-R</string>
|
||||
<string>127.0.0.1:17860:192.168.31.18:7860</string>
|
||||
<string>-R</string>
|
||||
<string>127.0.0.1:19106:192.168.31.188:19106</string>
|
||||
<string>ubuntu@111.231.132.51</string>
|
||||
</array>
|
||||
<key>RunAtLoad</key>
|
||||
|
||||
26
deploy/storyforge-collector.service.example
Normal file
26
deploy/storyforge-collector.service.example
Normal file
@@ -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
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user