AvanzaCast/DEPLOY_PROD.md

2.8 KiB

AvanzaCast - Production Deployment (Docker Compose)

This file shows how to build and run the production stack locally (or on a server) with Docker Compose. It sets up:

  • backend-api (token server) on port 4000
  • studio-panel served by nginx on port 80 inside container
  • broadcast-panel on port 5175
  • reverse-proxy (nginx) mapping the three domains to containers

Prerequisites

  • Docker and docker-compose installed on the host
  • DNS or hosts entries mapping the following hostnames to the server IP:
    • avanzacast-broadcastpanel.bfzqqk.easypanel.host
    • avanzacast-studio.bfzqqk.easypanel.host
    • avanzacast-servertokens.bfzqqk.easypanel.host
  • TLS/SSL: this example doesn't include certificates. Use a separate step with Certbot / Let's Encrypt or your load balancer to provide SSL. Do NOT expose token server over plain HTTP in production without TLS.

Files created

  • docker-compose.prod.yml - compose file to build and run the stack
  • docker/nginx/default.conf - nginx config for reverse proxy
  • packages/backend-api/.env.production - production environment variables for backend-api (placeholder)

Build & Run

  1. Build and start the stack
# from repo root
docker compose -f docker-compose.prod.yml up --build -d

# check status
docker compose -f docker-compose.prod.yml ps
  1. Verify backend health and CORS
# verify backend health
curl -i http://localhost:4000/health

# simulate the broadcast requesting token
curl -i -H "Origin: https://avanzacast-broadcastpanel.bfzqqk.easypanel.host" \
  "http://localhost:4000/api/token?room=studio-demo&username=simulator"

You should see an Access-Control-Allow-Origin header in the response. If it returns 500 with LiveKit credentials not configured, add real LIVEKIT_API_KEY and LIVEKIT_API_SECRET to packages/backend-api/.env.production and restart.

  1. Verify the UIs

Open in browser (or use Playwright):

  1. Run E2E test locally (Playwright)
cd packages/studio-panel
chmod +x run_playwright_test.sh
./run_playwright_test.sh

# artifacts will be in /tmp:
ls -lh /tmp/playwright_debug.log /tmp/playwright_run_output.log /tmp/sim_postmessage_simulator.png /tmp/sim_postmessage_studio.png

Troubleshooting

  • If CORS is blocked: edit packages/backend-api/src/index.ts and ensure allowed origins include your domains, then rebuild/restart.
  • If the backend dies with EBADF or IO errors: run npx tsx src/index.ts in foreground to get full stack trace, paste here.
  • For TLS termination: configure nginx with certificates or put the stack behind a TLS-enabled LB.

Security

  • Do not commit real secrets to the repo. Use environment variables or a secret manager. The .env.production file created contains placeholders; replace with real values on the server.