2.8 KiB
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 4000studio-panelserved by nginx on port 80 inside containerbroadcast-panelon port 5175reverse-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.hostavanzacast-studio.bfzqqk.easypanel.hostavanzacast-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 stackdocker/nginx/default.conf- nginx config for reverse proxypackages/backend-api/.env.production- production environment variables for backend-api (placeholder)
Build & Run
- 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
- 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.
- Verify the UIs
Open in browser (or use Playwright):
- https://avanzacast-broadcastpanel.bfzqqk.easypanel.host
- https://avanzacast-studio.bfzqqk.easypanel.host
- 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.tsand ensure allowed origins include your domains, then rebuild/restart. - If the backend dies with EBADF or IO errors: run
npx tsx src/index.tsin 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.productionfile created contains placeholders; replace with real values on the server.