diff --git a/bin/down b/bin/down index 19a04b2..73702bf 100755 --- a/bin/down +++ b/bin/down @@ -1,3 +1,8 @@ #!/bin/bash basedir=$(dirname "$0")/.. -mutagen-compose -f "$basedir"/docker-compose.yml down +if [[ "$OSTYPE" == "linux-gnu"* ]]; then + IP_ADDR=$(ifconfig -l | xargs -n1 ipconfig getifaddr) +elif [[ "$OSTYPE" == "darwin"* ]]; then + IP_ADDR=$(ip route get 1 | awk '{print $NF;exit}') +fi +PRIVATE_NETWORK_IP=${ADDR} mutagen-compose -f "$basedir"/docker-compose.yml down diff --git a/bin/up b/bin/up index 4875d7b..32a330c 100755 --- a/bin/up +++ b/bin/up @@ -8,4 +8,10 @@ mutagen daemon start echo -e ${prefix}The mutagen daemon will stay running until you stop it manually with \`mutagen daemon stop\`.$suffix echo -e ${prefix}Running mutagen-compose...$suffix -mutagen-compose -f "$basedir"/docker-compose.yml up --build --detach + +if [[ "$OSTYPE" == "linux-gnu"* ]]; then + IP_ADDR=$(ifconfig -l | xargs -n1 ipconfig getifaddr) +elif [[ "$OSTYPE" == "darwin"* ]]; then + IP_ADDR=$(ip route get 1 | awk '{print $NF;exit}') +fi +PRIVATE_NETWORK_IP=${ADDR} mutagen-compose -f "$basedir"/docker-compose.yml up --build --detach diff --git a/docker-compose.yml b/docker-compose.yml index c9aab61..90514ad 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,6 +9,8 @@ services: user: postgres volumes: - pgdata:/var/lib/postgresql/data + ports: + - "5432:5432" dialog: build: context: . @@ -18,8 +20,16 @@ services: HTTPS_CERT_FULLCHAIN: /etc/ssl/fullchain.pem HTTPS_CERT_PRIVKEY: /etc/ssl/privkey.pem INTERACTIVE: "false" + MEDIASOUP_MIN_PORT: 40000 + MEDIASOUP_MAX_PORT: 40050 + MEDIASOUP_ANNOUNCED_IP: ${PRIVATE_NETWORK_IP} ports: - "4443:4443" + # This should be the same as MEDIASOUP_MIN_PORT and MEDIASOUP_MAX_PORT + # You might neeed to increase this number depending on how many clients you are connecting. + # (Keep the ports range small to improve container startup time) + - "40000-40050:40000-40050" + - "40000-40050:40000-40050/udp" volumes: - dialog:/code working_dir: /code