2020-06-06 14:39:54 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
cd $(dirname $0)/..
|
|
|
|
|
2020-06-06 20:05:39 +02:00
|
|
|
if ! [ -x "$(command -v curl)" ]; then
|
|
|
|
echo "Error: curl is not installed, but the setup script relies on it."
|
|
|
|
echo "on debian based operating systems try following command:"
|
|
|
|
echo " $ sudo apt-get install curl"
|
|
|
|
exit 1
|
|
|
|
fi
|
2020-06-06 14:39:54 +02:00
|
|
|
|
|
|
|
# load .env
|
|
|
|
if [ -f .env ]
|
|
|
|
then
|
|
|
|
echo "Error: the configuration file .env already exists."
|
|
|
|
echo "either edit variables manually in there or remove the file and try this script again"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-06-06 20:05:39 +02:00
|
|
|
|
2020-07-12 19:15:40 +02:00
|
|
|
EXTERNAL_IPv4=$(curl -4 -s https://icanhazip.com)
|
2021-02-17 22:35:58 +01:00
|
|
|
EXTERNAL_IPv6=$(curl -6 -s -m 10 https://icanhazip.com || true)
|
2020-06-06 20:05:39 +02:00
|
|
|
|
|
|
|
greenlight=""
|
2020-06-06 14:39:54 +02:00
|
|
|
while [[ ! $greenlight =~ ^(y|n)$ ]]; do
|
|
|
|
read -p "Should greenlight be included? (y/n): " greenlight
|
|
|
|
done
|
|
|
|
|
2020-06-06 20:05:39 +02:00
|
|
|
https_proxy=""
|
2020-06-06 14:39:54 +02:00
|
|
|
while [[ ! $https_proxy =~ ^(y|n)$ ]]; do
|
|
|
|
read -p "Should an automatic HTTPS Proxy be included? (y/n): " https_proxy
|
|
|
|
done
|
|
|
|
|
2021-06-01 17:51:55 +02:00
|
|
|
coturn=""
|
2021-06-08 18:28:24 +02:00
|
|
|
while [[ ! $coturn =~ ^(y|n)$ ]]; do
|
|
|
|
read -p "Should a coturn be included? (y/n): " coturn
|
|
|
|
done
|
|
|
|
if [ "$coturn" == "y" ] && [ ! "$https_proxy" == "y" ]
|
2021-06-01 17:51:55 +02:00
|
|
|
then
|
2021-06-08 18:28:24 +02:00
|
|
|
echo "Coturn needs TLS to function properly."
|
|
|
|
echo " Since automatic HTTPS Proxy is disabled,"
|
|
|
|
echo " you must provide a relative or absolute path"
|
|
|
|
echo " to your certificates."
|
|
|
|
while [[ -z "$CERTPATH" ]]; do
|
2021-10-17 00:01:07 +02:00
|
|
|
read -p "Please enter path to cert.pem: " CERTPATH
|
2021-06-08 18:28:24 +02:00
|
|
|
done
|
|
|
|
while [[ -z "$KEYPATH" ]]; do
|
2021-10-17 00:01:07 +02:00
|
|
|
read -p "Please enter path to key.pem: " KEYPATH
|
2021-06-01 17:51:55 +02:00
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2020-06-06 14:39:54 +02:00
|
|
|
DOMAIN=""
|
|
|
|
while [[ -z "$DOMAIN" ]]; do
|
|
|
|
read -p "Please enter the domain name: " DOMAIN
|
|
|
|
done
|
|
|
|
|
2020-08-15 03:42:43 +02:00
|
|
|
recording=""
|
2020-09-06 14:18:09 +02:00
|
|
|
echo "Should the recording feature be included?"
|
|
|
|
echo " IMPORTANT: this is currently a big privacy issues, because it will "
|
|
|
|
echo " record everything which happens in the conference, even when the button"
|
2021-07-29 00:32:42 +02:00
|
|
|
echo " suggests, that it does not."
|
|
|
|
echo " make sure that you always get people's consent, before they join a room!"
|
2020-09-06 14:18:09 +02:00
|
|
|
echo " https://github.com/bigbluebutton/bigbluebutton/issues/9202"
|
2020-08-15 03:42:43 +02:00
|
|
|
while [[ ! $recording =~ ^(y|n)$ ]]; do
|
2020-09-06 14:18:09 +02:00
|
|
|
read -p "Choice (y/n): " recording
|
2020-08-15 03:42:43 +02:00
|
|
|
done
|
|
|
|
|
2021-10-17 00:01:07 +02:00
|
|
|
prometheus_exporter=""
|
|
|
|
while [[ ! $prometheus_exporter =~ ^(y|n)$ ]]; do
|
|
|
|
read -p "Should a Prometheus exporter be included? (y/n): " prometheus_exporter
|
|
|
|
done
|
|
|
|
if [ "$prometheus_exporter" == "y" ] && [ "$recording" == "y" ]
|
|
|
|
then
|
|
|
|
echo "Should Prometheus exporter optimization be enabled?"
|
|
|
|
echo " This instructs exporter to collect expensive recordings metrics by querying the disk instead of the API."
|
|
|
|
echo " Enabling this can substantially decrease the scrape time required for the exporter to respond to metrics requests"
|
|
|
|
prometheus_exporter_optimization=""
|
|
|
|
while [[ ! $prometheus_exporter_optimization =~ ^(y|n)$ ]]; do
|
|
|
|
read -p "Choice (y/n): " prometheus_exporter_optimization
|
|
|
|
done
|
2021-11-27 12:38:44 +01:00
|
|
|
|
|
|
|
if [ "$recording" == "y" ]
|
|
|
|
then
|
|
|
|
|
|
|
|
remove_old_recording=""
|
|
|
|
while [[ ! $remove_old_recording =~ ^(y|n)$ ]]; do
|
|
|
|
read -p "Should old recordings be removed? (y/n): " remove_old_recording
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ "$remove_old_recording" == "y" ]
|
|
|
|
then
|
|
|
|
recording_max_age_days=""
|
|
|
|
while [[ ! $recording_max_age_days =~ ^[0-9]{1,4}$ ]]; do
|
|
|
|
read -p "Please enter max age(days) for keeping recordings: " recording_max_age_days
|
|
|
|
done
|
|
|
|
fi
|
2021-10-17 20:26:26 +02:00
|
|
|
|
2021-10-17 00:01:07 +02:00
|
|
|
fi
|
|
|
|
|
2020-06-06 14:39:54 +02:00
|
|
|
ip_correct=""
|
|
|
|
while [[ ! $ip_correct =~ ^(y|n)$ ]]; do
|
2020-07-12 19:15:40 +02:00
|
|
|
read -p "Is $EXTERNAL_IPv4 your external IPv4 address? (y/n): " ip_correct
|
2020-06-06 14:39:54 +02:00
|
|
|
done
|
|
|
|
|
2020-07-12 19:15:40 +02:00
|
|
|
if [ ! "$ip_correct" == "y" ]
|
|
|
|
then
|
|
|
|
EXTERNAL_IPv4=""
|
2020-07-31 09:42:23 +02:00
|
|
|
while [[ ! $EXTERNAL_IPv4 =~ ^[1-9][0-9]{0,2}\.[0-9]{0,3}\.[0-9]{0,3}\.[1-9][0-9]{0,2}$ ]]; do
|
2020-07-12 19:15:40 +02:00
|
|
|
read -p "Please enter correct IPv4 address: " EXTERNAL_IPv4
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2020-07-13 17:52:14 +02:00
|
|
|
if [ -n "$EXTERNAL_IPv6" ]
|
2020-06-06 14:39:54 +02:00
|
|
|
then
|
2020-07-13 17:52:14 +02:00
|
|
|
ip_correct=""
|
|
|
|
while [[ ! $ip_correct =~ ^(y|n)$ ]]; do
|
|
|
|
read -p "Is $EXTERNAL_IPv6 your external IPv6 address? (y/n): " ip_correct
|
2020-06-06 14:39:54 +02:00
|
|
|
done
|
2020-07-13 17:52:14 +02:00
|
|
|
|
|
|
|
if [ ! "$ip_correct" == "y" ]
|
|
|
|
then
|
|
|
|
EXTERNAL_IPv6=""
|
2020-07-31 09:42:23 +02:00
|
|
|
while [[ ! $EXTERNAL_IPv6 =~ ^[0-9a-z:]{3,39}$ ]]; do
|
2020-07-13 17:52:14 +02:00
|
|
|
read -p "Please enter correct IPv6 address: " EXTERNAL_IPv6
|
|
|
|
done
|
|
|
|
fi
|
2020-06-06 14:39:54 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# write settings
|
|
|
|
cp sample.env .env
|
2020-07-12 19:15:40 +02:00
|
|
|
sed -i "s/EXTERNAL_IPv4=.*/EXTERNAL_IPv4=$EXTERNAL_IPv4/" .env
|
2020-07-13 17:52:14 +02:00
|
|
|
sed -i "s/EXTERNAL_IPv6=.*/EXTERNAL_IPv6=$EXTERNAL_IPv6/" .env
|
2020-06-06 14:39:54 +02:00
|
|
|
sed -i "s/DOMAIN=.*/DOMAIN=$DOMAIN/" .env
|
|
|
|
|
|
|
|
if [ ! "$greenlight" == "y" ]
|
|
|
|
then
|
|
|
|
sed -i "s/ENABLE_GREENLIGHT.*/#ENABLE_GREENLIGHT=true/" .env
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! "$https_proxy" == "y" ]
|
|
|
|
then
|
|
|
|
sed -i "s/ENABLE_HTTPS_PROXY.*/#ENABLE_HTTPS_PROXY=true/" .env
|
|
|
|
fi
|
2020-08-15 03:42:43 +02:00
|
|
|
|
2020-08-29 16:30:00 +02:00
|
|
|
if [ "$recording" == "y" ]
|
2020-08-15 03:42:43 +02:00
|
|
|
then
|
2020-08-29 16:30:00 +02:00
|
|
|
sed -i "s/#ENABLE_RECORDING.*/ENABLE_RECORDING=true/" .env
|
2020-08-15 03:42:43 +02:00
|
|
|
fi
|
2020-06-06 14:39:54 +02:00
|
|
|
|
2021-11-27 12:38:44 +01:00
|
|
|
if [ "$remove_old_recording" == "y" ]
|
|
|
|
then
|
|
|
|
sed -i "s/#REMOVE_OLD_RECORDING=.*/REMOVE_OLD_RECORDING=true/" .env
|
|
|
|
sed -i "s/#RECORDING_MAX_AGE_DAYS=.*/RECORDING_MAX_AGE_DAYS=$recording_max_age_days/" .env
|
|
|
|
fi
|
|
|
|
|
2021-06-01 17:51:55 +02:00
|
|
|
if [ "$coturn" == "y" ]
|
|
|
|
then
|
|
|
|
sed -i "s/.*TURN_SERVER=.*/TURN_SERVER=turns:$DOMAIN:5349?transport=tcp/" .env
|
|
|
|
TURN_SECRET=$(head /dev/urandom | tr -dc A-Za-f0-9 | head -c 32)
|
|
|
|
sed -i "s/.*TURN_SECRET=.*/TURN_SECRET=$TURN_SECRET/" .env
|
|
|
|
sed -i "s/.*STUN_IP=.*/STUN_IP=$EXTERNAL_IPv4/" .env
|
|
|
|
else
|
|
|
|
sed -i "s/ENABLE_COTURN.*/#ENABLE_COTURN=true/" .env
|
|
|
|
fi
|
|
|
|
|
2021-06-08 18:28:24 +02:00
|
|
|
if [ -n "$CERTPATH" ] && [ -n "$KEYPATH" ]
|
|
|
|
then
|
2021-08-02 16:05:22 +02:00
|
|
|
sed -i "s,#COTURN_TLS_CERT_PATH=.*,COTURN_TLS_CERT_PATH=$CERTPATH," .env
|
|
|
|
sed -i "s,#COTURN_TLS_KEY_PATH=.*,COTURN_TLS_KEY_PATH=$KEYPATH," .env
|
2021-06-08 18:28:24 +02:00
|
|
|
fi
|
|
|
|
|
2021-02-17 07:36:06 +01:00
|
|
|
if [ "$prometheus_exporter" == "y" ]
|
|
|
|
then
|
2021-10-17 00:01:07 +02:00
|
|
|
sed -i "s/#ENABLE_PROMETHEUS_EXPORTER=.*/ENABLE_PROMETHEUS_EXPORTER=true/" .env
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$prometheus_exporter_optimization" == "y" ]
|
|
|
|
then
|
|
|
|
sed -i "s/#ENABLE_PROMETHEUS_EXPORTER_OPTIMIZATION=.*/ENABLE_PROMETHEUS_EXPORTER_OPTIMIZATION=true/" .env
|
2021-02-17 07:36:06 +01:00
|
|
|
fi
|
|
|
|
|
2020-06-06 14:39:54 +02:00
|
|
|
# change secrets
|
2020-06-06 20:05:39 +02:00
|
|
|
RANDOM_1=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 40)
|
|
|
|
RANDOM_2=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 40)
|
|
|
|
RANDOM_3=$(head /dev/urandom | tr -dc a-f0-9 | head -c 128)
|
2021-12-13 18:16:22 +01:00
|
|
|
RANDOM_4=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 40)
|
|
|
|
RANDOM_5=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 40)
|
|
|
|
|
2020-06-06 14:39:54 +02:00
|
|
|
sed -i "s/SHARED_SECRET=.*/SHARED_SECRET=$RANDOM_1/" .env
|
|
|
|
sed -i "s/ETHERPAD_API_KEY=.*/ETHERPAD_API_KEY=$RANDOM_2/" .env
|
|
|
|
sed -i "s/RAILS_SECRET=.*/RAILS_SECRET=$RANDOM_3/" .env
|
2021-12-13 18:16:22 +01:00
|
|
|
sed -i "s/FSESL_PASSWORD=.*/FSESL_PASSWORD=$RANDOM_4/" .env
|
|
|
|
sed -i "s/POSTGRESQL_SECRET=.*/POSTGRESQL_SECRET=$RANDOM_5/" .env
|
2020-06-06 14:39:54 +02:00
|
|
|
|
2021-02-11 15:33:49 +01:00
|
|
|
./scripts/generate-compose
|
|
|
|
|
2020-06-06 14:39:54 +02:00
|
|
|
echo "--------------------------------------------------"
|
|
|
|
echo "configuration file .env got successfully created!"
|
|
|
|
echo ""
|
|
|
|
echo "you can look through it for further adjusments"
|
|
|
|
echo " $ nano .env"
|
|
|
|
echo ""
|
2021-02-11 15:33:49 +01:00
|
|
|
echo "make sure to recreate the docker-compose.yml after each change"
|
|
|
|
echo " $ ./scripts/generate-compose"
|
|
|
|
echo ""
|
2020-06-06 14:39:54 +02:00
|
|
|
echo "to start bigbluebutton run"
|
2021-02-17 07:36:06 +01:00
|
|
|
echo " $ docker-compose up -d"
|