跳转到内容

快速开始

单机生产部署包含一个 SyncTV 进程、一个 PostgreSQL 和一个 Redis。Kubernetes 或多副本部署先完成单机闭环,再进入 Helm 部署集群配置

  • Docker 和 Docker Compose 可用。
  • GNU Make 和 openssl 可用于生成环境文件。
  • 当前目录可以长期保存 Compose 文件、.env.postgres.env.redis.env.synctv 和数据卷。
  • 已准备 root 用户密码。生产环境使用密码管理器生成。
  1. 获取生产 Compose 配置:

    Terminal window
    git clone --depth 1 https://github.com/zijiren233/synctv.git synctv
    cd synctv
  2. 生成 .env.postgres.env.redis.env.synctv

    Terminal window
    make compose-init
  3. 编辑 .env.synctv,至少设置 root 密码:

    SYNCTV_BOOTSTRAP_ROOT_PASSWORD=replace-with-a-strong-password
  4. 检查 Compose 渲染结果:

    Terminal window
    make compose-config
  5. 启动服务:

    Terminal window
    make compose-up
Terminal window
make compose-ps
curl -fsS http://localhost:8080/health/ready

成功后打开:

http://localhost:8080

默认 root 用户名是 root。密码来自 .env.synctv 中的 SYNCTV_BOOTSTRAP_ROOT_PASSWORD

环境变量用途
SYNCTV_JWT_SECRET签发 access token、refresh token 和 guest token
SYNCTV_SECURITY_OPAQUE_SERVER_SETUP_SECRETOPAQUE 密码认证的服务端长期 secret
SYNCTV_SECURITY_CREDENTIAL_ENCRYPTION_KEY加密 Provider 凭据
SYNCTV_BOOTSTRAP_ROOT_PASSWORD首次创建 root 用户
现象处理
make compose-config 提示变量缺失运行 make compose-init,并在当前目录保留 .env.postgres.env.redis.env.synctv
/health/ready 失败运行 make compose-logs SERVICE=synctv,先看第一条启动错误。
浏览器跨域错误.env.synctv 中设置 SYNCTV_SERVER_CORS_ALLOWED_ORIGINS,只填写 origin。
root 用户无法登录确认数据库首次启动时已设置 SYNCTV_BOOTSTRAP_ROOT_PASSWORD,并查看启动日志中的 bootstrap 结果。