Document dylive.nomadro.com Caddy routes and SeaweedFS feiniu/s3 hosts.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
03888989d2
commit
d3840ee73b
11
README.md
11
README.md
@ -107,6 +107,17 @@ python scripts\sync_cookie_and_probe.py
|
||||
|
||||
前缀 `DY_`,见 `backend/app/config.py`(如 `DY_PB_URL`、`DY_OFFLINE_INTERVAL_SEC`)。
|
||||
|
||||
## 线上地址
|
||||
|
||||
| 用途 | URL |
|
||||
|------|-----|
|
||||
| 控制台 | https://dylive.nomadro.com/ |
|
||||
| API | https://dylive.nomadro.com/api/health |
|
||||
| PocketBase | https://dylive.nomadro.com/_/ |
|
||||
| SeaweedFS S3 | https://feiniu.nomadro.com/ (别名 https://s3.nomadro.com/) |
|
||||
|
||||
反代由本机 **Caddy** 自动 HTTPS;后端进程:`4015` Next / `8014` API / `8092` PB / `8333` SeaweedFS S3。
|
||||
|
||||
## 说明
|
||||
|
||||
- 为方便部署同步,仓库包含 `backend/data/`(SQLite、封面、Cookie 设置)与 `pb/pb_data/`。
|
||||
|
||||
103
scripts/setup_caddy_dylive.py
Normal file
103
scripts/setup_caddy_dylive.py
Normal file
@ -0,0 +1,103 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Configure Caddy for dylive + feiniu/s3 SeaweedFS."""
|
||||
import paramiko
|
||||
|
||||
HOST = "107.173.30.245"
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect(HOST, 22, "root", "Xiao4669805", timeout=30, allow_agent=False, look_for_keys=False)
|
||||
|
||||
cmd = r"""
|
||||
set -e
|
||||
|
||||
cp -a /etc/caddy/Caddyfile /etc/caddy/Caddyfile.bak.$(date +%Y%m%d%H%M%S)
|
||||
|
||||
# Douyin live monitor
|
||||
cat >/etc/caddy/sites/dylive.nomadro.com.caddy <<'EOF'
|
||||
# DouyinWEB — Next.js + FastAPI + PocketBase
|
||||
# https://dylive.nomadro.com
|
||||
|
||||
dylive.nomadro.com {
|
||||
encode gzip
|
||||
|
||||
handle /api/* {
|
||||
reverse_proxy 127.0.0.1:8014
|
||||
}
|
||||
|
||||
handle /covers/* {
|
||||
reverse_proxy 127.0.0.1:8014
|
||||
}
|
||||
|
||||
# PocketBase admin / API mirror
|
||||
handle /_/* {
|
||||
reverse_proxy 127.0.0.1:8092
|
||||
}
|
||||
|
||||
handle {
|
||||
reverse_proxy 127.0.0.1:4015
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
# SeaweedFS S3 (开源带 F:飞牛 feiniu)
|
||||
cat >/etc/caddy/sites/feiniu.nomadro.com.caddy <<'EOF'
|
||||
# SeaweedFS S3 API
|
||||
# https://feiniu.nomadro.com
|
||||
|
||||
feiniu.nomadro.com {
|
||||
encode gzip
|
||||
request_body {
|
||||
max_size 200MB
|
||||
}
|
||||
reverse_proxy 127.0.0.1:8333
|
||||
}
|
||||
EOF
|
||||
|
||||
cat >/etc/caddy/sites/s3.nomadro.com.caddy <<'EOF'
|
||||
# SeaweedFS S3 API (alias)
|
||||
# https://s3.nomadro.com
|
||||
|
||||
s3.nomadro.com {
|
||||
encode gzip
|
||||
request_body {
|
||||
max_size 200MB
|
||||
}
|
||||
reverse_proxy 127.0.0.1:8333
|
||||
}
|
||||
EOF
|
||||
|
||||
# validate + reload
|
||||
caddy validate --config /etc/caddy/Caddyfile
|
||||
systemctl reload caddy
|
||||
sleep 2
|
||||
systemctl is-active caddy
|
||||
|
||||
# update API public S3 base to feiniu HTTPS
|
||||
sed -i 's|Environment=DY_S3_PUBLIC_BASE=.*|Environment=DY_S3_PUBLIC_BASE=https://feiniu.nomadro.com|' /etc/systemd/system/douyinweb-api.service
|
||||
grep DY_S3_PUBLIC /etc/systemd/system/douyinweb-api.service
|
||||
systemctl daemon-reload
|
||||
systemctl restart douyinweb-api
|
||||
sleep 4
|
||||
|
||||
echo '--- https checks ---'
|
||||
curl -sI --max-time 20 https://dylive.nomadro.com/ | head -15
|
||||
echo
|
||||
curl -s -o /dev/null -w 'dylive:%{http_code}\n' --max-time 20 https://dylive.nomadro.com/
|
||||
curl -s -o /dev/null -w 'dylive_api:%{http_code}\n' --max-time 20 https://dylive.nomadro.com/api/health
|
||||
curl -s --max-time 20 https://dylive.nomadro.com/api/health | head -c 250
|
||||
echo
|
||||
curl -s -o /dev/null -w 'feiniu:%{http_code}\n' --max-time 15 https://feiniu.nomadro.com/
|
||||
curl -s -o /dev/null -w 's3:%{http_code}\n' --max-time 15 https://s3.nomadro.com/
|
||||
|
||||
SID=$(curl -s https://dylive.nomadro.com/api/sessions/active | python3 -c "import sys,json; d=json.load(sys.stdin); ss=d.get('sessions') or []; print(next((x['id'] for x in ss if x.get('cover_url')), ''))")
|
||||
echo SID=$SID
|
||||
if [ -n "$SID" ]; then
|
||||
curl -s -o /dev/null -w 'cover:%{http_code} size:%{size_download}\n' --max-time 20 "https://dylive.nomadro.com/api/sessions/$SID/cover"
|
||||
fi
|
||||
"""
|
||||
_, o, _ = c.exec_command(cmd, timeout=180, get_pty=True)
|
||||
print(o.read().decode("utf-8", errors="replace")[-6000:])
|
||||
c.close()
|
||||
print("\nhttps://dylive.nomadro.com/")
|
||||
print("https://feiniu.nomadro.com/ (SeaweedFS S3)")
|
||||
print("https://s3.nomadro.com/ (S3 alias)")
|
||||
Loading…
Reference in New Issue
Block a user