rogee e4c0186f96
douyin-release-gate / verify (push) Failing after 21m22s
fix(events): isolate subscription overflow instead of killing the shared channel
One slow account's full subscription buffer no longer tears down the
WebSocket shared by all accounts on the gateway. The overflowing
subscription is retired with an explicit error and replays unacked
deliveries on resubscribe; the buffer grows from 2 to 64 messages.
2026-10-08 21:57:12 +08:00

CreatorHub

面向团队的新媒体多账号运营管理平台,统一管理浏览器环境、代理资源、账号池、负责人和运营任务。

当前阶段

业务范围与验收以 docs/plan01.md 为准;离线检查不能替代真实平台验收。

浏览器环境由每台机器上的 native browser gateway + Xvfb 管理。gateway 不访问 Docker socket,不创建容器、镜像、卷或网络;登录 Profile 和正式素材持久保留,任务临时资源按执行归属清理。

当前目标是单机单节点闭环;多节点调度、A/B 环境和跨机恢复另立目标。

本地运行

native gateway 必须先在宿主机以非 root 用户运行。准备已安装的 fingerprint Chromium、Xvfb、systemd user session 和 gateway 配置:

mkdir -p ~/.config/creatorhub
cp deploy/browser-gateway.env.example ~/.config/creatorhub/browser-gateway.env
$EDITOR ~/.config/creatorhub/browser-gateway.env
scripts/install-native-browser-gateway.sh
curl --fail --silent --show-error http://127.0.0.1:8081/healthz

首次部署可生成控制面凭据:

export CREATORHUB_PORT=8080
export CONTROL_PLANE_USERNAME=creatorhub
export CONTROL_PLANE_PASSWORD="$(openssl rand -hex 24)"
export CREATORHUB_CREDENTIAL_MASTER_KEY="$(openssl rand -base64 32)"

docker compose config --quiet
docker compose up --detach --build

Compose 只运行 control-plane 和 PostgreSQL,浏览器 gateway 仍是宿主机 systemd user service。启动后检查:

docker compose ps
curl --fail --silent --show-error "http://127.0.0.1:${CREATORHUB_PORT:-8080}/healthz"
curl --fail --silent --show-error "http://127.0.0.1:${CREATORHUB_PORT:-8080}/readyz"
docker compose logs --tail=200 creator-hub postgres

打开 http://127.0.0.1:${CREATORHUB_PORT:-8080} 登录。首次配置:

  1. 在「网关管理」注册 gateway。control-plane 在 Compose 中运行时使用 http://host.docker.internal:8081;裸机运行 control-plane 时使用 http://127.0.0.1:8081。令牌必须与 gateway 配置一致。
  2. 创建抖音账号和运行环境,显式启动环境;浏览器由 gateway 使用宿主机配置的默认运行时。
  3. 在账号页显示登录二维码,完成登录后核验浏览器身份。
  4. 按验证文档手工完成抖音采集、结果保存、停止、再启动和资源释放检查。

已有数据的重启必须复用原控制面主密钥、gateway 令牌、Profile 根目录和素材目录。不要使用 docker compose down -v,也不要删除 gateway 的 Profile 根目录。

停止控制面和数据库:

docker compose down
systemctl --user stop creatorhub-browser-gateway.service

本地开发(分开启动)

首次安装前端依赖:

npm --prefix web ci --ignore-scripts

分别在四个终端运行:

npm run db        # PostgreSQL 依赖
npm run gateway   # native browser gateway
npm run backend   # Go control-plane,Air 自动重载
npm run frontend  # Umi Max 前端,支持 HMR

npm run backend 依赖 Linux 的 flock(util-linux),同一工作目录只允许一个后台进程;重复启动会明确报错并退出,重启前请在原终端按 Ctrl+C。不要绕过启动脚本直接运行 Air,以免多个进程同时重编译和启动同一个程序。

npm run backend 不会自动启动数据库或 gateway;先启动 db 和 gateway。npm run gateway 直接运行当前用户的 native gateway,不要求安装 systemd 服务。修改 browser_gateway 的 Python 文件后,重启该命令。

服务地址:

端 地址 说明
前端 http://127.0.0.1:8099 固定端口(STRICT_PORT,被占用时启动报错而非递增);/api 代理到本地 control-plane
control-plane http://127.0.0.1:8082 Go 热加载
native browser gateway http://127.0.0.1:28187 宿主机 Xvfb/浏览器生命周期
PostgreSQL 127.0.0.1:15433(可由 CREATORHUB_POSTGRES_PORT 覆盖) 仅数据库依赖使用容器

开发默认登录信息和目录可在 .env.example、deploy/browser-gateway.env.example 中查看。不要把真实密码、Cookie、验证码或令牌写入仓库。

最小检查:

node --test scripts/dev-backend.test.mjs
go test ./...
go vet ./...
go build ./cmd/control-plane
go test -race ./...
npm --prefix web ci --ignore-scripts
npm --prefix web run build
docker compose config --quiet
S
Description
No description provided
Readme
4.1 MiB
Languages
Go 56.8%
Python 19%
JavaScript 13%
TypeScript 10.9%
PLpgSQL 0.2%