Having a small problem with a Docker setup on Digital Ocean

Hi everyone

I have built a simple broadcasting platform with Mediasoup and I am now trying to set it up on Digital Ocean inside of a Docker container.

Locally, everything works without a hitch.

On Digital Ocean I am able to connect and initiate a connection but when creating a transport as a producer, it is stuck on producing and when creating a consumer it is stuck on subscribing.

After googling and reading the docs, I think this has something to do with the listen and announced ip’s not being properly set up? But as there is no real documentation on Docker and Digital Ocean, I am not sure how to proceed here.

I figured the announced ip might be my digital ocean droplet ip but that doesn’t seem to do the trick.

Right now, my setup looks like this:

const mediaCodecs: RtpCodecCapability[] = [
  {
    kind: 'audio',
    mimeType: 'audio/opus',
    clockRate: 48000,
    channels: 2,
  },
  {
    kind: 'video',
    mimeType: 'video/VP8',
    clockRate: 90000,
    parameters: {
      'x-google-start-bitrate': 1000,
    },
  },
];

const webRtcTransport = {
  listenIps: [{ ip: '127.0.0.1', announcedIp: null }],
  enableUdp: true,
  enableTcp: true,
  preferUdp: true,
  maxIncomingBitrate: 1500000,
  initialAvailableOutgoingBitrate: 1000000,
};

const workerConfig = {
  rtcMinPort: 40000,
  rtcMaxPort: 49999,
};

Any help would be extremely welcome.

Announced ip is the external ip which is available for accessing from a web browser for example… If u r running mediasoup server on a machine which is behind a firewall or so… You need to put the firewall ip as the announced ip and write firewall rules to send the traffic to your mediasoup server through firewall… Also if u r able to create the transport please check the ice candidates once… You must be having server ips in ice candidates.

1 Like

Not sure what docs you have read if finally you end setting announcedIp: null. Anyway:

I tried setting it to my digital ocean droplet ip but that didn’t work.
Thanks anyway

I am getting the transport options back:

And I am able to call createTransport with those options, but it is stuck on connecting.

Not really worked with Docker, but I believe you’ve to run the container in the host network. And set the IP addresses according to the mediasoup docs.

It’s easier but NOT required to run the container in the host network.

1 Like

Please, don’t start pasting random logs. You have a configuration issue. Read the links and information provided here.

That is what I am trying to do and I am trying to provide information so someone might help me figure out what I am doing wrong.

I have read the documentation and tried to put everything together but I haven’t succeeded, otherwise I wouldn’t be asking it in Discourse.

This might be frustrating to someone who is very experienced with Mediasoup but I am not and I am just genuinely looking for some help to set up my first project.

1 Like

I don’t know Digital Ocean but I assume you run mediasoup in a host with private IP (that must be listenIp) and such a host has a public IP outside in your provider that redirect the traffic to your host private IP. Such a public IP must be the announcedIp parameter.

I don’t know if, in addition to that, you are also running Docker or not. Anyway, you need to have a public IP with all UDP/TCP ports (or the configured range) redirected to your host. If your host runs Docker then you also need a second redirection to your Docker container, etc etc.

Thanks for the detailed explanation! Having a better understanding and using docker in network host mode made it work! So thanks again for the help!