Skip to content
Snippets Groups Projects
Commit 48573829 authored by Felipe Cecagno's avatar Felipe Cecagno
Browse files

fsesl wait for freeswitch; change links by depends_on; remove freeswitch ipv6...

fsesl wait for freeswitch; change links by depends_on; remove freeswitch ipv6 config files; enable wss-binding element on freeswitch; fix kurento listen only
parent ab9a31fe
No related branches found
No related tags found
No related merge requests found
......@@ -15,11 +15,12 @@ RUN apt-get update \
RUN cd /source \
&& sbt debian:packageBin
# FROM ubuntu:16.04
FROM openjdk:8-jre-slim-stretch
COPY --from=builder /source/target/*.deb /root/
RUN dpkg -i /root/*.deb
COPY wait-for-it.sh /usr/local/bin/
CMD ["/usr/share/bbb-fsesl-akka/bin/bbb-fsesl-akka"]
#!/usr/bin/env bash
# Use this script to test if a given TCP host/port are available
cmdname=$(basename $0)
echoerr() { if [[ $QUIET -ne 1 ]]; then echo "$@" 1>&2; fi }
usage()
{
cat << USAGE >&2
Usage:
$cmdname host:port [-s] [-t timeout] [-- command args]
-h HOST | --host=HOST Host or IP under test
-p PORT | --port=PORT TCP port under test
Alternatively, you specify the host and port as host:port
-s | --strict Only execute subcommand if the test succeeds
-q | --quiet Don't output any status messages
-t TIMEOUT | --timeout=TIMEOUT
Timeout in seconds, zero for no timeout
-- COMMAND ARGS Execute command with args after the test finishes
USAGE
exit 1
}
wait_for()
{
if [[ $TIMEOUT -gt 0 ]]; then
echoerr "$cmdname: waiting $TIMEOUT seconds for $HOST:$PORT"
else
echoerr "$cmdname: waiting for $HOST:$PORT without a timeout"
fi
start_ts=$(date +%s)
while :
do
if [[ $ISBUSY -eq 1 ]]; then
nc -z $HOST $PORT
result=$?
else
(echo > /dev/tcp/$HOST/$PORT) >/dev/null 2>&1
result=$?
fi
if [[ $result -eq 0 ]]; then
end_ts=$(date +%s)
echoerr "$cmdname: $HOST:$PORT is available after $((end_ts - start_ts)) seconds"
break
fi
sleep 1
done
return $result
}
wait_for_wrapper()
{
# In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692
if [[ $QUIET -eq 1 ]]; then
timeout $BUSYTIMEFLAG $TIMEOUT $0 --quiet --child --host=$HOST --port=$PORT --timeout=$TIMEOUT &
else
timeout $BUSYTIMEFLAG $TIMEOUT $0 --child --host=$HOST --port=$PORT --timeout=$TIMEOUT &
fi
PID=$!
trap "kill -INT -$PID" INT
wait $PID
RESULT=$?
if [[ $RESULT -ne 0 ]]; then
echoerr "$cmdname: timeout occurred after waiting $TIMEOUT seconds for $HOST:$PORT"
fi
return $RESULT
}
# process arguments
while [[ $# -gt 0 ]]
do
case "$1" in
*:* )
hostport=(${1//:/ })
HOST=${hostport[0]}
PORT=${hostport[1]}
shift 1
;;
--child)
CHILD=1
shift 1
;;
-q | --quiet)
QUIET=1
shift 1
;;
-s | --strict)
STRICT=1
shift 1
;;
-h)
HOST="$2"
if [[ $HOST == "" ]]; then break; fi
shift 2
;;
--host=*)
HOST="${1#*=}"
shift 1
;;
-p)
PORT="$2"
if [[ $PORT == "" ]]; then break; fi
shift 2
;;
--port=*)
PORT="${1#*=}"
shift 1
;;
-t)
TIMEOUT="$2"
if [[ $TIMEOUT == "" ]]; then break; fi
shift 2
;;
--timeout=*)
TIMEOUT="${1#*=}"
shift 1
;;
--)
shift
CLI=("$@")
break
;;
--help)
usage
;;
*)
echoerr "Unknown argument: $1"
usage
;;
esac
done
if [[ "$HOST" == "" || "$PORT" == "" ]]; then
echoerr "Error: you need to provide a host and port to test."
usage
fi
TIMEOUT=${TIMEOUT:-15}
STRICT=${STRICT:-0}
CHILD=${CHILD:-0}
QUIET=${QUIET:-0}
# check to see if timeout is from busybox?
# check to see if timeout is from busybox?
TIMEOUT_PATH=$(realpath $(which timeout))
if [[ $TIMEOUT_PATH =~ "busybox" ]]; then
ISBUSY=1
BUSYTIMEFLAG="-t"
else
ISBUSY=0
BUSYTIMEFLAG=""
fi
if [[ $CHILD -gt 0 ]]; then
wait_for
RESULT=$?
exit $RESULT
else
if [[ $TIMEOUT -gt 0 ]]; then
wait_for_wrapper
RESULT=$?
else
wait_for
RESULT=$?
fi
fi
if [[ $CLI != "" ]]; then
if [[ $RESULT -ne 0 && $STRICT -eq 1 ]]; then
echoerr "$cmdname: strict mode, refusing to execute subprocess"
exit $RESULT
fi
exec "${CLI[@]}"
else
exit $RESULT
fi
......@@ -3,3 +3,5 @@ kurentoIp: KURENTO_IP
redisHost: REDIS_HOST
freeswitch:
ip: FREESWITCH_IP
log:
level: LOG_LEVEL
......@@ -4,4 +4,8 @@ CONTAINER_IP=$(hostname -I | awk '{print $1}')
sed -i "s|^\(localIpAddress\):.*|\1: \"$CONTAINER_IP\"|g" config/production.yml
if [ ! -z "$KURENTO_NAME" ]; then
export KURENTO_IP=$(getent hosts $KURENTO_NAME | awk '{ print $1 }')
fi
npm start
......@@ -12,7 +12,7 @@ services:
bbb-html5:
image: ${TAG_PREFIX}bbb-html5${TAG_SUFFIX}
restart: unless-stopped
links:
depends_on:
- mongo
- redis
environment:
......@@ -24,7 +24,7 @@ services:
bbb-webhooks:
image: ${TAG_PREFIX}bbb-webhooks${TAG_SUFFIX}
restart: unless-stopped
links:
depends_on:
- redis
environment:
REDIS_HOST: redis
......@@ -33,7 +33,7 @@ services:
bbb-freeswitch:
image: ${TAG_PREFIX}bbb-freeswitch${TAG_SUFFIX}
restart: unless-stopped
links:
depends_on:
- coturn
volumes:
- media-audio:/var/freeswitch/meetings
......@@ -41,15 +41,16 @@ services:
bbb-webrtc-sfu:
image: ${TAG_PREFIX}bbb-webrtc-sfu${TAG_SUFFIX}
restart: unless-stopped
links:
depends_on:
- redis
- kurento
- bbb-freeswitch
environment:
KURENTO_IP: ${EXTERNAL_IP}
KURENTO_NAME: kurento
KURENTO_URL: ws://kurento:8888/kurento
REDIS_HOST: redis
FREESWITCH_IP: bbb-freeswitch
LOG_LEVEL: debug
coturn:
image: ${TAG_PREFIX}coturn${TAG_SUFFIX}
......@@ -84,7 +85,7 @@ services:
bbb-apps-akka:
image: ${TAG_PREFIX}bbb-apps-akka${TAG_SUFFIX}
restart: unless-stopped
links:
depends_on:
- redis
environment:
JAVA_OPTS: -Dredis.host=redis
......@@ -92,16 +93,17 @@ services:
bbb-fsesl-akka:
image: ${TAG_PREFIX}bbb-fsesl-akka${TAG_SUFFIX}
restart: unless-stopped
links:
depends_on:
- bbb-freeswitch
- redis
command: ["wait-for-it.sh", "bbb-freeswitch:8021", "--timeout=60", "--strict", "--", "/usr/share/bbb-fsesl-akka/bin/bbb-fsesl-akka"]
environment:
JAVA_OPTS: -Dredis.host=redis -Dfreeswitch.esl.host=bbb-freeswitch
bbb-web:
image: ${TAG_PREFIX}bbb-web${TAG_SUFFIX}
restart: unless-stopped
links:
depends_on:
- redis
volumes:
- bigbluebutton:/var/bigbluebutton
......@@ -125,7 +127,7 @@ services:
nginx:
image: ${TAG_PREFIX}nginx${TAG_SUFFIX}
restart: unless-stopped
links:
depends_on:
- bbb-webhooks
- bbb-web
- bbb-html5
......
......@@ -8,7 +8,8 @@ RUN apt-get update \
RUN echo "deb http://ubuntu.bigbluebutton.org/xenial-200-dev bigbluebutton-xenial main " | tee /etc/apt/sources.list.d/bigbluebutton.list \
&& wget http://ubuntu.bigbluebutton.org/repo/bigbluebutton.asc -O- | apt-key add - \
&& apt-get update \
&& apt-get -y install bbb-freeswitch-core
&& apt-get -y install bbb-freeswitch-core \
&& find /opt/freeswitch/conf/sip_profiles/ -name "*ipv6*" -prune -exec rm -rf "{}" \;
EXPOSE 8021
EXPOSE 5060
......
......@@ -5,7 +5,10 @@ IP=$(hostname -I | cut -d' ' -f1)
xmlstarlet edit --inplace --update '//X-PRE-PROCESS[@cmd="set" and starts-with(@data, "external_rtp_ip=")]/@data' --value "stun:coturn" /opt/freeswitch/conf/vars.xml
xmlstarlet edit --inplace --update '//X-PRE-PROCESS[@cmd="set" and starts-with(@data, "external_sip_ip=")]/@data' --value "stun:coturn" /opt/freeswitch/conf/vars.xml
xmlstarlet edit --inplace --update '//X-PRE-PROCESS[@cmd="set" and starts-with(@data, "local_ip_v4=")]/@data' --value "${IP}" /opt/freeswitch/conf/vars.xml
xmlstarlet edit --inplace --update '//param[@name="ws-binding"]/@value' --value ":7443" /opt/freeswitch/conf/sip_profiles/external.xml
xmlstarlet edit --inplace --update '//param[@name="ws-binding"]/@name' --value "wss-binding" /opt/freeswitch/conf/sip_profiles/external.xml
# add wss-binding element
xmlstarlet edit --inplace --subnode '//settings' --type elem --name 'newsubnode' --value '' /opt/freeswitch/conf/sip_profiles/external.xml
xmlstarlet edit --inplace --insert '//newsubnode' --type attr --name 'name' --value 'wss-binding' /opt/freeswitch/conf/sip_profiles/external.xml
xmlstarlet edit --inplace --insert '//newsubnode' --type attr --name 'value' --value ':7443' /opt/freeswitch/conf/sip_profiles/external.xml
xmlstarlet edit --inplace --rename '//newsubnode' --value 'param' /opt/freeswitch/conf/sip_profiles/external.xml
/opt/freeswitch/bin/freeswitch
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment