Docker image not working (audio/video not streaming) on aws ec2, it is working on local

We are using github action ci/cd for deplyment and facing issues.
Issue : can not consuming stream/ participant’s audio and video is not working
Note : 1. it is working when we deploy directly on aws ec2 without docker,
2. and it is also working on local machine with and without docker
3. we have use public ip in IP and private ip in ANNOUNCED_IP and vice versa


docker-compose.yml

version: '3'
services:
  bitovn_bridge:
    container_name: bitovn_bridge
    image: bitovnbridge/bitovn-bridge:0.2
    environment:
      LISTEN_PORT: ${LISTEN_IP} 
      ANNOUNCED_IP: ${ANNOUNCED_IP} // public ip
      LISTEN_IP: ${LISTEN_IP} // '0.0.0.0'
      IP: ${IP} // "172.xx.xx.xx"
      DEBUG: ${DEBUG}


    ports:
      - "3000:3000"
    restart: always

in docker file
EXPOSE 3000
EXPOSE 10000-10100/udp


mediasoup config

const os = require("os");

module.exports = {
  listenIp: process.env.LISTEN_IP,
  listenPort: process.env.LISTEN_PORT,
  sslCrt: "../private/ssl/cert.pem",
  sslKey: "../private/ssl/key.pem",

  mediasoup: {
    numWorkers: Object.keys(os.cpus()).length,
    worker: {
      rtcMinPort: 10000,
      rtcMaxPort: 10100,
      logLevel: "warn",
      logTags: [
        "info",
        "ice",
        "score",
        "simulcast",
        "svc",
      ],
    },

    router: {
      mediaCodecs: [
        {
          kind: "audio",
          mimeType: "audio/opus",
          clockRate: 48000,
          channels: 2,
        },
        {
          clockRate: 90000,
          mimeType: "video/VP8",
          parameters: {
            "x-google-start-bitrate": 1000,
          },
        },


      ],
    },
    // WebRtcTransport settings
    webRtcTransport: {
      listenIps: [
        {
          ip: process.env.IP, //private ip
          announcedIp: process.env.ANNOUNCED_IP, // public ip
        },
      ],
      maxIncomingBitrate: 1500000,
      initialAvailableOutgoingBitrate: 1000000,
    },
  },
};

This line looks suspicious. You’re assigning an IP address to a port.

Docker on EC2 should work fine. I’d recommend setting network_mode: host, but I’m not sure that’s the problem.

It looks like your ip / announcedIp settings are correct.

Make sure you’re not using alpine-linux. People (including me) have reported problems getting UDP to work properly, and I don’t think anyone has figured out why.

Good luck!

Sir which Linux variant I should use instead alpine

My mediasoup dockerfile is based off the node:16 official docker image.

1 Like

Never had issues with Ubuntu server, I develop on Ubuntu Desktop goes hand in hand.

1 Like

Now it is working, Alpine was blocking UDP traffic. I have used Ubuntu and node 14