Deploying mediaserver with Docker Compose

The following sample give you example of how deploying a mediasoup server with Docker Compose. Don't forget to adjust the following settings:

  • replace mydomain.com by you domain.
  • replace PUBLIC_IP value by you real server IP
  • replace ANNOUNCED_IP value by you internet public IP
  • replace API_USER and API_SERVER values by user you choose.
  • replace JWT_SECRET value by random secret.
services:
backend:
image: docker.io/iabsis/mediasoup-api
ports:
- "3443:3443"
environment:
## Define random key here
- JWT_SECRET=aadsrwerrf

## Configure credentials used to consume mediasoup API
- API_USER=abcd
- API_SECRET=1234

## Define here the public IP server
- PUBLIC_IP=1.2.3.4

## If server is behind nat, you might need to advertise
# the real public IP by commenting out this line.
- ANNOUNCED_IP=1.2.3.4

## You will need to open UDP port in the follow range, you
# can adjust the range if required.
# - RTC_MIN_PORT=40000
# - RTC_MAX_PORT=49000

## The best practice is to use reverse proxy, but if you want
# this API to serve directly HTTPS, you might need to configure the
# following lines
# - HTTP_ONLY=true
- LISTEN=3443
- CERT=/etc/mediasoup-api/certs/example.com/fullchain.pem
- KEY=/etc/mediasoup-api/certs/example.com/privkey.pem

## Redis server
- REDIS_HOST=redis

depends_on:
- redis
volumes:
- ./data/certbot/:/etc/mediasoup-api/certs

redis:
image: redis

certbot:
image: certbot/certbot:latest
volumes:
- ./data/certbot/:/etc/letsencrypt/live
command: certonly --standalone -d turn.mydomain.com --non-interactive --agree-tos --email info@mydomain.com

certbot-renew:
image: certbot/certbot:latest
volumes:
- ./data/certbot/:/etc/letsencrypt/live
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"

Put the content bellow in docker-compose.yml file and run the following command

docker compose up -d

Check the service is correctly started with the following command

docker compose logs -f
Rating
0 0

There are no comments for now.

to be the first to leave a comment.