I reviewed this mediasoup v3 with Docker and have something slightly different in that I am getting a different error:
ERROR: for voice_server Cannot start service voice_server: Ports are not available: listen tcp 0.0.0.0:49163: bind: address already in use
(the port changes per load)
I'm also losing audio output when running a containerized version of a server with mediasoup vs when I don't have it containerized. I tried to set network_mode
to host as a way to avoid forwarding ports to no avail.
Thank you! The docker compose file is as follows:
services:
voice_server:
build: ./voice
environment:
- WEBRTC_LISTEN_IP=127.0.0.1
- RABBITMQ_URL=amqp://guest:guest@rabbitmq:5672
restart: unless-stopped
ports:
- 3000:3000
- "40000-49999:40000-49999"
backend:
build: ./backend
env_file: ./backend/.env
restart: unless-stopped
ports:
- 4001:4001
rabbitmq:
image: rabbitmq:3-management-alpine
container_name: rabbitmq
volumes:
- ./.docker/rabbitmq/data/:/var/lib/rabbitmq/
- ./.docker/rabbitmq/logs/:/var/log/rabbitmq/
environment:
RABBITMQ_ERLANG_COOKIE: ${RABBITMQ_ERLANG_COOKIE}
ports:
- 5672:5672
- 15672:15672
the dockerfile for the voice server is:
FROM node:12
WORKDIR /usr/src/app
COPY package.json package-lock.json ./
RUN npm i
COPY . .
RUN npm run build
ENV NODE_ENV production
CMD [ "node", "dist/index.js" ]
USER node
and the config for mediasoup is
export const config = {
httpIp: "0.0.0.0",
httpPort: 3000,
httpPeerStale: 360000,
mediasoup: {
worker: {
rtcMinPort: 40000,
rtcMaxPort: 49999,
logLevel: "debug",
logTags: [
"info",
"ice",
"dtls",
"rtp",
"srtp",
"rtcp",
] as WorkerLogTag[],
},
router: {
mediaCodecs: [
{
kind: "audio",
mimeType: "audio/opus",
clockRate: 48000,
channels: 2,
},
] as RtpCodecCapability[],
},
webRtcTransport: {
listenIps: [
{
ip: process.env.WEBRTC_LISTEN_IP,
announcedIp: undefined,
},
{
ip: listenIp,
announcedIp: undefined,
},
] as TransportListenIp[],
initialAvailableOutgoingBitrate: 800000,
},
},
} as const;