Hi, first of all thank you for this wonderful library. And sorry for this question, but I had no other choice, already spent 3 sleepless nights with this.
let me jump straight into the issue I am facing.
I have setted up the Mediasoup in nodejs which is running on Docker ( ubuntu ) & able to stream videos from both peers. But when I implement Nginx both the peers are unable to view there video. But both the Peers are receiving dtlsParamaters, iceCandidates didn’t throw any error.
Here is the complete github link - project link
branch name - implement-scalable-architecture
Here is my docker-compose file
version: "3.8"
services:
mongodb:
image: mongo:5.0.2
restart: unless-stopped
env_file: ./.env
environment:
- MONGO_INITDB_ROOT_USERNAME=$MONGODB_USER
- MONGO_INITDB_ROOT_PASSWORD=$MONGODB_PASSWORD
ports:
- $MONGODB_LOCAL_PORT:$MONGODB_DOCKER_PORT
volumes:
- mongo-db:/data/db
networks:
- backend
nginx:
image: nginx:alpine
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./server/certificates/ssl:/etc/nginx/certs
ports:
- "3000:80"
- "443:443"
- "3001-3999:3001-3999"
depends_on:
- server
networks:
- backend
- frontend
redis:
image: redis:alpine
expose:
- "6379"
server:
container_name: "airbooth-server-c"
image: "airbooth-server-i"
depends_on:
- mongodb
build:
context: ./server
dockerfile: Dockerfile
restart: unless-stopped
env_file: ./.env
tty: true
expose:
- "3000"
- "3001-3999"
environment:
- DB_HOST=mongodb
- DB_USER=$MONGODB_USER
- DB_PASSWORD=$MONGODB_PASSWORD
- DB_NAME=$MONGODB_DATABASE
- DB_PORT=$MONGODB_DOCKER_PORT
- CLIENT_ORIGIN=$CLIENT_ORIGIN
- SERVER_NAME=server_one
volumes:
- ./server:/server/
- server-node-modules:/server/node_modules
networks:
- backend
- frontend
client-airbooth-app:
image: client-airbooth-i
build:
context: ./client/airbooth-app
dockerfile: Dockerfile
container_name: client-airbooth-c
volumes:
- ./client/airbooth-app:/client/airbooth-app
- client-airbooth-app-node-modules:/client/airbooth-app/node_modules/
ports:
- "4006:5173"
stdin_open: true
environment:
- NODE_ENV=development
client-inspector-admin:
image: client-inspector-admin-i
build:
context: ./client/inspector-admin
dockerfile: Dockerfile
container_name: client-inspector-admin-c
volumes:
- ./client/inspector-admin:/client/inspector-admin
- client-inspector-admin-node-modules:/client/inspector-admin/node_modules/
ports:
- "4007:5174"
stdin_open: true
environment:
- NODE_ENV=development
client-IAM-app:
image: client-iam-i
build:
context: ./client/IAM-app
dockerfile: Dockerfile
container_name: client-IAM-c
volumes:
- ./client/IAM-app:/client/IAM-app
- client-IAM-app-node-modules:/client/IAM-app/node_modules/
ports:
- "4008:5173"
stdin_open: true
environment:
- NODE_ENV=development
volumes:
mongo-db:
server-node-modules:
client-airbooth-app-node-modules:
client-inspector-admin-node-modules:
client-IAM-app-node-modules:
networks:
backend:
frontend:
This is my NginX config file:
worker_processes 1;
events {
worker_connections 1024;
}
http {
server {
listen 80 ssl;
listen 3001-3999;
ssl_certificate /etc/nginx/certs/nginx-selfsigned.crt;
ssl_certificate_key /etc/nginx/certs/nginx-selfsigned.key;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_pass http://nodes;
# enable WebSockets
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
upstream nodes {
# enable sticky session with either "hash" (uses the complete IP address)
hash $remote_addr consistent;
# or "ip_hash" (uses the first three octets of the client IPv4 address, or the entire IPv6 address)
# ip_hash;
# or "sticky" (needs commercial subscription)
# sticky cookie srv_id expires=1h domain=.example.com path=/;
server server:3000;
# server server-two:3000;
# server server-three:3000;
}
}
creating transport
const webRtcTransport_options = {
listenIps: [
{
ip: "0.0.0.0",
announcedIp: "127.0.0.1",
},
],
enableUdp: true,
enableTcp: true,
preferUdp: true,
};