I am building a WebRTC project that needs a Coturn server. I am struggling to setup a localhost version to use for development. Please do not suggest using a third party TURN server. I have been using them to this point and have had inconsistent connection and latency issues so now intend to host one.
The project is using docker. The coturn image I am using is
https://github.com/kevzettler/coturnDockerLongTermCredentials
I am trying to manually docker run the container and get it working.
docker run \
--name turnserver \
--net=host \
-e "TURN_PORT_START=49152" \
-e "TURN_PORT_END=65535" \
-e "TURN_REALM=projectName" \
-d \
-t \
meetrix/coturn-long-term-cred
To test connections to the turn server I am using
https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/
and pointing it to turn:0.0.0.0
I am able to do this on a production hosting machine and connect successfully using the trickle-ice page. localhost however, is failing.
I want to get a local Coturn setup so I can dev offline. The primary issue I believe is around open PORTS.
Coturn expects a large range of ports open 49152-65535. If we update
the docker command to explicitly expose these ports like:
docker run \
--name turnserver \
-p 3478:3478/udp \
-p 3478:3478 \
-p 49152-65535:49152-65535/udp \
-e "TURN_PORT_START=49152" \
-e "TURN_PORT_END=65535" \
-e "TURN_REALM=projectname" \
-d \
-t \
meetrix/coturn-long-term-cred
The docker daemon will crash.
This is why the initial run command, and production uses --net=host. --net=host will
use the host machines firewall instead of dockers.
The host machine
for this local dev environment is a macOS Sierra. I suspect the ports
are not open at the macOS level in the --net=host scenario.