Skip to main content
Version: Current

部署要求

规模建议

场景BackendRedis
开发2 vCPU / 2GB256MB
200+ 并发活动4 vCPU / 4GB512MB+

软件

Node.js 18+ · Redis 5.6+ · PostgreSQL 14+ · HTTPS 反向代理(生产)

网络

  • WebSocket 升级不可被代理阻断
  • Backend 需访问 Redis、PostgreSQL
  • Frontend 需访问 Backend(NEXT_PUBLIC_API_BASE
  • NextAuth verify-code 由 Frontend 服务端 调用 Backend(Server-side fetch)

Nginx WebSocket 示例

location /socket.io/ {
proxy_pass http://backend:4000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400;
}

环境变量(生产额外注意)

  • STAFF_ADMIN_PASSWORD / STAFF_DISPLAY_PASSWORD 使用强密码
  • 生产关闭 NextAuth debug: trueauth.ts
  • NEXT_PUBLIC_THEME 活动前确定

Migration

npx prisma migrate deploy

健康探测

curl -f https://api.example.com/health