bbb-docker/scripts/generate-compose
2023-02-14 23:15:32 +08:00

69 lines
2.6 KiB
Bash
Executable File

#!/bin/bash
set -e
cd $(dirname $0)/..
# load .env
if [ -f .env ]
then
# exclude WELCOME_MESSAGE && WELCOME_FOOTER && CLIENT_TITLE because it may contain invalid characters
export $(cat .env | sed 's/#.*//g' | grep -v "WELCOME_FOOTER" | grep -v "WELCOME_MESSAGE" | grep -v "CLIENT_TITLE" | xargs)
fi
# check for non-optional environment variables,
# which got introduced later and may miss in existing
# .env files during upgrades
if [ -z "$EXTERNAL_IPv4" ]; then
echo "ERROR: EXTERNAL_IPv4 is not set in .env"
echo "BBB won't work without it."
exit 1
fi
if [ "$ENABLE_COTURN" == true ]; then
if [ -z "$ENABLE_HTTPS_PROXY" ] && [ -z "$COTURN_TLS_CERT_PATH" ]; then
echo "ERROR: coturn requires TLS certificates."
echo "Either enable the https proxy for certificate retrival"
echo "or provide a path to your certificates in .env file."
exit 1
fi
if [ -z "$ENABLE_HTTPS_PROXY" ] && [ "$DEV_MODE" == true ]; then
echo "ERROR: the https proxy can't get a certificate if ran locally and therefor coturn will never start"
echo "you should disable coturn in .env"
exit 1
fi
fi
export $(cat tags.env | sed 's/#.*//g' | xargs)
docker run \
--rm \
-v $(pwd)/docker-compose.tmpl.yml:/docker-compose.tmpl.yml \
-e BBB_BUILD_TAG=${BBB_BUILD_TAG} \
-e TAG_COMMON_MESSAGE=${TAG_COMMON_MESSAGE} \
-e TAG_APPS_AKKA=${TAG_APPS_AKKA} \
-e TAG_FSESL_AKKA=${TAG_FSESL_AKKA} \
-e TAG_BBB_WEB=${TAG_BBB_WEB} \
-e TAG_HTML5=${TAG_HTML5} \
-e TAG_FS_CONFIG=${TAG_FS_CONFIG} \
-e TAG_LEARNING_DASHBOARD=${TAG_LEARNING_DASHBOARD} \
-e TAG_RECORDINGS=${TAG_RECORDINGS} \
-e TAG_WEBRTC_SFU=${TAG_WEBRTC_SFU} \
-e TAG_WEBHOOKS=${TAG_WEBHOOKS} \
-e TAG_PLAYBACK=${TAG_PLAYBACK} \
-e TAG_PADS=${TAG_PADS} \
-e DEV_MODE=${DEV_MODE:-false} \
-e EXTERNAL_IPv6=${EXTERNAL_IPv6:-} \
-e ENABLE_RECORDING=${ENABLE_RECORDING:-false} \
-e REMOVE_OLD_RECORDING=${REMOVE_OLD_RECORDING:-false} \
-e RECORDING_MAX_AGE_DAYS=${RECORDING_MAX_AGE_DAYS:-14} \
-e ENABLE_HTTPS_PROXY=${ENABLE_HTTPS_PROXY:-false} \
-e ENABLE_WEBHOOKS=${ENABLE_WEBHOOKS:-false} \
-e ENABLE_COTURN=${ENABLE_COTURN:-false} \
-e ENABLE_GREENLIGHT=${ENABLE_GREENLIGHT:-false} \
-e ENABLE_PROMETHEUS_EXPORTER=${ENABLE_PROMETHEUS_EXPORTER:-false} \
-e ENABLE_PROMETHEUS_EXPORTER_OPTIMIZATION=${ENABLE_PROMETHEUS_EXPORTER_OPTIMIZATION:-false} \
-e NUMBER_OF_BACKEND_NODEJS_PROCESSES=${NUMBER_OF_BACKEND_NODEJS_PROCESSES:-1} \
-e NUMBER_OF_FRONTEND_NODEJS_PROCESSES=${NUMBER_OF_FRONTEND_NODEJS_PROCESSES:-1} \
jwilder/dockerize -template /docker-compose.tmpl.yml \
> docker-compose.yml