Skip to main content

Docker Deployment

Deploy QuickRTC locally using Docker and Docker Compose.

Prerequisites

Quick Start

# Clone the repository
git clone https://github.com/vidya-hub/QuickRtc.git
cd QuickRtc/quickrtc-example

# Development mode (foreground)
./run.sh dev

# OR using docker-compose directly
docker-compose up --build

Access the application:

With SSL (HTTPS)

WebRTC requires HTTPS in production. Enable SSL with:

./run.sh ssl

Access via: https://localhost (port 443)

note

You'll see a browser warning for the self-signed certificate. Click "Advanced" and proceed to accept it.

Production Mode

For production deployments:

# Set your public IP for WebRTC (auto-detected if not set)
export ANNOUNCED_IP=your.public.ip.address

# Run in detached mode
./run.sh prod

# OR with SSL
./run.sh ssl-prod

Available Commands

CommandDescription
./run.sh devStart in development mode (foreground)
./run.sh prodStart in production mode (background)
./run.sh sslStart with SSL/nginx (foreground)
./run.sh ssl-prodStart with SSL in production mode (background)
./run.sh stopStop all services
./run.sh logsView all logs
./run.sh logs-serverView server logs
./run.sh logs-clientView client logs
./run.sh statusShow container status
./run.sh cleanStop and remove all containers/images

Docker Compose Configuration

The default docker-compose.yml:

version: '3.8'
services:
server:
build: ./server
ports:
- "3000:3000"
- "40000-40100:40000-40100/udp"
environment:
- ANNOUNCED_IP=${ANNOUNCED_IP:-}
- RTC_MIN_PORT=40000
- RTC_MAX_PORT=40100

client:
build: ./client
ports:
- "80:80"
depends_on:
- server

Custom Configuration

Change WebRTC Port Range

export RTC_MIN_PORT=50000
export RTC_MAX_PORT=50100
./run.sh ssl-prod

Use Custom Domain

For local development with a custom domain:

  1. Add to /etc/hosts:

    127.0.0.1 rtc.local
  2. Update nginx configuration to use your domain

  3. Generate certificates for your domain

Troubleshooting

Port already in use

# Check what's using port 80
lsof -i :80

# Stop conflicting service or use different port

Container won't start

# View logs
./run.sh logs

# Check container status
docker ps -a

# Rebuild from scratch
./run.sh clean
./run.sh dev

WebRTC not connecting

  1. Ensure ANNOUNCED_IP is set correctly
  2. Check UDP ports are exposed
  3. Verify firewall allows UDP traffic
# Check your public IP
curl ifconfig.me

# Set and restart
export ANNOUNCED_IP=$(curl -s ifconfig.me)
./run.sh ssl-prod