admin管理员组

文章数量:1405148

I am trying to deploy janus-gateway-server(build from the latest version of main) with a proxy-service as a sidecar. The main idea is to hide janus-gateway-server from exposing all its rest endpoints to the outside world, the webrtc clients can reach janus-gateway-server through my proxy for signalling, but for media I will have to expose the rtp ports anyway.

in janus.jcfg - I have restricted the port range for the webrtc side for media in janus.sip.plugin.jcfg - i have restricted the port range for the sip side for media

I do not know what to do for the signalling ports? I did not find anything mentioned about it in the janus documentation. I found a reply from @lorenzo saying that we cannot restrict the signalling port range- /t/sip-client-port-in-invite-message/1217

  1. Then how can I add that in the security rules of the EC2 instance, that these ports can be accessed by these webrtc clients CIDAR range only.

Now comes the deployment part. I tried using host network, everything works fine. But I am skeptical to use host network.

Here is the docker-compose file for host-network- ✅ (This is working fine)

services:
  janus-gateway-server:
    container_name: janus-gateway-server
    build:
      context: ./janus-gateway-server
      dockerfile: Dockerfile-janus-gateway-server
    restart: always
    volumes:
      - janus-config:/opt/janus/etc/janus/
    network_mode: "host"
    command: ["/opt/janus/bin/janus"]
    depends_on:
      - janus-proxy-service

  janus-proxy-service:
    container_name: janus-proxy-service
    build:
      context: ./janus-proxy-service
      dockerfile: Dockerfile-janus-proxy
    restart: always
    environment:
      - JANUS_WS_URL=ws://localhost:8188
    network_mode: "host"

volumes:
  janus-config:

I wanted to work with bridge network, but as exposing the rtp ports causes the janus-gateway-server to get stuck during startup indefinitely, even in extra large instance in ec2.

Here is the docker-compose file for bridge mode- ❌(Fails to even startup the container)

services:
  janus-gateway-server:
    container_name: janus-gateway-server
    build:
      context: ./janus-gateway-server
      dockerfile: Dockerfile-janus-gateway-server
    restart: always
    volumes:
      - janus-config:/opt/janus/etc/janus/
    networks:
      - janus-network
    command: ["/opt/janus/bin/janus"]
    depends_on:
      - janus-proxy-service
    ports:
      - "40000-45000:40000-45000/udp"

  janus-proxy-service:
    container_name: janus-proxy-service
    build:
      context: ./janus-proxy-service
      dockerfile: Dockerfile-janus-proxy
    restart: always
    environment:
      - JANUS_WS_URL=ws://janus-gateway-server:8188
    networks:
      - janus-network
    ports:
      - "8080:8080"

volumes:
  janus-config:

networks:
  janus-network:
    driver: bridge
  1. If I use bridge mode, how can I deploy it without getting stuck? Am I doing anything wrong here?
  2. Also do I need to set the nat_1_1 mapping?
  3. And do I need to turn this flag on in janus.plugin.sip.jcfg file?
# Indicate if the server is behind NAT. If so, the server will use STUN
    # to guess its own public IP address and use it in the Contact header of
    # outgoing requests
    behind_nat = false

I went throught Alessandro's presentation- .php?t=docker

He suggested to use docker's macvlan network, I tried that, but it seems EC2 does not support it. None of my containers could talk to the internet and no one from the internet could reach my containers.

"Amazon EC2 networking doesn’t allow to use private ips in the containers through bridges or macvlan."

Here is the docker-compose file for the macvlan networking- ❌(does not work)

services:
  janus-gateway-server:
    container_name: janus-gateway-server
    build:
      context: ./janus-gateway-server
      dockerfile: Dockerfile-janus-gateway-server
    restart: always
    volumes:
      - janus-config:/opt/janus/etc/janus/
    networks:
      janus_macvlan:
        ipv4_address: 12.0.2.100
    command: ["/opt/janus/bin/janus"]
    depends_on:
      - janus-proxy-service

  janus-proxy-service:
    container_name: janus-proxy-service
    build:
      context: ./janus-proxy-service
      dockerfile: Dockerfile-janus-proxy
    restart: always
    environment:
      - JANUS_WS_URL=ws://12.0.2.100:8188
    networks:
      janus_macvlan:
        ipv4_address: 12.0.2.101

volumes:
  janus-config:

networks:
  janus_macvlan:
    name: janus_macvlan
    driver: macvlan
    driver_opts:
      parent: enX0
      promisc: "true"
    ipam:
      config:
        - subnet: 12.0.2.0/24
          gateway: 12.0.2.1


I am stuck currently. If anyone is using docker to deploy janus-gateway-server, please help me. What is the correct way to deploy janus-gateway-server in EC2? Or any service where we need to expose a lot of ports?

本文标签: amazon ec2Deploy janusgateway server with SIP plugin inside Docker in AWS EC2Stack Overflow