|
| 1 | +# Deployment & Scaling: Pixel Streaming with Docker & Cloud |
| 2 | + |
| 3 | +## 1. Docker Compose Example |
| 4 | + |
| 5 | +```yaml |
| 6 | +version: "3.8" |
| 7 | +services: |
| 8 | + ue_streamer: |
| 9 | + image: myproject-pixelstream:latest |
| 10 | + runtime: nvidia |
| 11 | + network_mode: host |
| 12 | + environment: |
| 13 | + - NVIDIA_DRIVER_CAPABILITIES=all |
| 14 | + |
| 15 | + signaling: |
| 16 | + image: ghcr.io/epicgames/pixel-streaming-signalling-server:5.6 |
| 17 | + network_mode: host |
| 18 | + |
| 19 | + turn: |
| 20 | + image: coturn/coturn:latest |
| 21 | + command: ["turnserver", "-n", "--log-file=stdout"] |
| 22 | + ports: |
| 23 | + - "3478:3478/udp" |
| 24 | + - "3478:3478/tcp" |
| 25 | +``` |
| 26 | +
|
| 27 | +> Note: Use network_mode: host on Linux for lowest latency. On Windows, map ports manually. |
| 28 | +
|
| 29 | +## 2. Cloud Hosting |
| 30 | +
|
| 31 | +- **AWS**: EC2 GPU (G4/G5), ECS/EKS for containers, Auto Scaling Group for orchestration. |
| 32 | +- **Azure**: NV-series VMs, VM Scale Sets, Azure Pixel Streaming Marketplace Template. |
| 33 | +- **Google Cloud**: GPU instances, GKE for containers. |
| 34 | +
|
| 35 | +## 3. Staging vs Production |
| 36 | +
|
| 37 | +- **Staging:** Single instance, protected by simple auth or VPN. Use for testing/QA. |
| 38 | +
|
| 39 | +- **Production:** |
| 40 | + - Use autoscaling (ASG/Scale Sets) for demand-based scaling. |
| 41 | + - Implement a matchmaker or routing backend to assign users to sessions. |
| 42 | + - Terminate idle sessions after timeout to control costs. |
| 43 | + - Consider GPU quotas and encoder limits per node. |
| 44 | +
|
| 45 | +## 4. Authentication & Security |
| 46 | +
|
| 47 | +- Protect signaling server with HTTPS and valid TLS certs. |
| 48 | +- Gate frontend via web auth (OAuth, SSO, etc). |
| 49 | +- Optionally, require API token for WebSocket upgrade or use reverse proxy for access control. |
| 50 | +- Secure TURN/STUN credentials. |
| 51 | +
|
| 52 | +## 5. Scaling Scenarios |
| 53 | +
|
| 54 | +- 1:1 Streaming: One UE instance per user/session for max interactivity. |
| 55 | +- SFU-based: One UE instance, SFU forwards to many viewers (spectators only, single controller). |
| 56 | +- Use horizontal scaling for high concurrency. |
| 57 | +
|
| 58 | +## 6. Best Practices |
| 59 | +
|
| 60 | +- Use health checks to detect and restart failed containers. |
| 61 | +- Monitor GPU/CPU usage for scaling triggers. |
| 62 | +- Regularly update all images (UE, signaling, TURN) for security. |
| 63 | +- Log all connections, user actions, and errors for traceability. |
| 64 | +
|
| 65 | +## 7. Troubleshooting |
| 66 | +
|
| 67 | +- If video is black, check GPU drivers and encoding settings. |
| 68 | +- If clients can't connect, check port forwarding, signaling logs, and TURN config. |
| 69 | +- For high latency, prefer host networking and regional cloud instances close to users. |
0 commit comments