Update to install version 2.3

This commit is contained in:
2021-05-28 02:27:57 +02:00
parent 2cac76f6e0
commit 4d6a4575dc
7 changed files with 1702 additions and 442 deletions

152
archive/README.install Normal file
View File

@ -0,0 +1,152 @@
# ===================
#
# see:
# - https://docs.bigbluebutton.org/2.2/install.html
# - https://bigbluebutton.org/html5/
#
# Requirements:
#
# - webserver nginx is installed
# - lets encrypt certificates available for $FQDN_HOSTNAME
#
# ===================
# ---
# 0.) Requirements
# ---
# Install Nginx Webserver
#
cd /usr/local/src/nginx
./install_nginx.sh
# Install update mechanism for lets encrypt certificates
#
cd /usr/local/src/dehydrated-cron
./install_dehydrated.sh
# Create certificate(s)
#
vim /var/lib/dehydrated/domains.txt
/var/lib/dehydrated/cron/dehydrated_cron.sh
# ---
# 1.) Run script bbb-pre-install.sh
# ---
/usr/local/src/bigbluebutton/bbb-pre-install.sh
# ---
# 2.) Install BigBlueButton
# ---
apt-get install bigbluebutton
# --
# Adjust /etc/nginx/sites-enabled/bigbluebutton to support
# SSL Protocls
# --
if [[ ! -f "/etc/nginx/sites-available/bigbluebutton.ORIG" ]] ; then
cp -a /etc/nginx/sites-available/bigbluebutton /etc/nginx/sites-available/bigbluebutton.ORIG
fi
vim /etc/nginx/sites-enabled/bigbluebutton
systemctl restart nginx
apt-get update
apt-get upgrade
apt-get install bbb-html5
# ---
# 3.) Optional: install Demo API
# ---
apt-get install bbb-demo
# ---
# 4.) Run script bbb-post-install.sh
# ---
/usr/local/src/bigbluebutton/bbb-post-install.sh
# ---
# 5.) Install Greenlight - Run script bbb-greenlight-install.sh
# ---
/usr/local/src/bigbluebutton/bbb-greenlight-install.sh
# --
# Installation finished
# --
# =====================================================================================
1. Install Docker on Ubuntu.
# Remove old versions of Docker
#
apt-get remove docker docker-engine docker.io containerd runc
# Install packages to allow apt to use a repository over HTTPS:
#
apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
# Add Dockers official GPG key:
#
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# set up the stable repository.
#
cat <<EOF > /etc/apt/sources.list.d/docker.list
deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable
EOF
# Update package index
#
apt-get update
# Install the latest version of Docker Engine - Community and containerd,
#
apt-get install docker-ce docker-ce-cli containerd.io
# Deinstall apparmor
#
apt-get remove apparmor
# Create the Greenlight directory for its configuration to live in.
#
mkdir ~/greenlight && cd ~/greenlight
# Greenlight will read its environment configuration from the .env file.
# To generate this file and install the Greenlight Docker image, run:
#
docker run --rm bigbluebutton/greenlight:v2 cat ./sample.env > .env
# Generating a Secret KeyAnchor link for: generating a secret key
#
# Greenlight needs a secret key in order to run in production. To generate
# this, run:
#
docker run --rm bigbluebutton/greenlight:v2 bundle exec rake secret

793
archive/bbb-greenlight-install.sh Executable file
View File

@ -0,0 +1,793 @@
#!/usr/bin/env bash
cript_name="$(basename $(realpath $0))"
working_dir="$(dirname $(realpath $0))"
#conf_file="${working_dir}/conf/${script_name%%.*}.conf"
conf_file="${working_dir}/conf/bbb.conf"
LOCK_DIR="/tmp/$(basename $0).$$.LOCK"
log_file="${LOCK_DIR}/${script_name%%.*}.log"
# ----------
# Base Function(s)
# ----------
clean_up() {
# Perform program exit housekeeping
rm -rf "$LOCK_DIR"
blank_line
exit $1
}
echononl(){
if $terminal ; then
echo X\\c > /tmp/shprompt$$
if [ `wc -c /tmp/shprompt$$ | awk '{print $1}'` -eq 1 ]; then
echo -e -n " $*\\c" 1>&2
else
echo -e -n " $*" 1>&2
fi
rm /tmp/shprompt$$
fi
}
fatal(){
echo ""
if $terminal ; then
echo -e " [ \033[31m\033[1mFatal\033[m ] $*"
else
echo -e " [ Fatal ] $*"
fi
echo ""
if $terminal ; then
echo -e " \033[1mScript terminated\033[m.."
else
echo -e " Script terminated.."
fi
echo ""
rm -rf $LOCK_DIR
exit 1
}
error (){
echo ""
if $terminal ; then
echo -e " [ \033[31m\033[1mError\033[m ] $*"
else
echo " [ Error ] $*"
fi
echo ""
}
info () {
if $terminal ; then
echo ""
echo -e " [ \033[32m\033[1mInfo\033[m ] $*"
echo ""
fi
}
note () {
if $terminal ; then
echo ""
echo -e " [ \033[33m\033[1mNote\033[m ] $*"
echo ""
fi
}
echo_ok() {
if $terminal ; then
echo -e "\033[85G[ \033[32mok\033[m ]"
fi
}
echo_failed(){
if $terminal ; then
echo -e "\033[85G[ \033[1;31mfailed\033[m ]"
fi
}
echo_skipped() {
if $terminal ; then
echo -e "\033[85G[ \033[37m\033[1mskipped\033[m ]"
fi
}
echo_wait(){
if $terminal ; then
echo -en "\033[85G[ \033[5m\033[1m..\033[m ]"
fi
}
trim() {
local var="$*"
var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters
var="${var%"${var##*[![:space:]]}"}" # remove trailing whitespace characters
echo -n "$var"
}
blank_line() {
if $terminal ; then
echo ""
fi
}
detect_os () {
if $(which lsb_release > /dev/null 2>&1) ; then
DIST="$(lsb_release -i | awk '{print tolower($3)}')"
DIST_VERSION="$(lsb_release -r | awk '{print tolower($2)}')"
DIST_CODENAME="$(lsb_release -c | awk '{print tolower($2)}')"
if [[ "$DIST" = "debian" ]]; then
if $(echo "$DIST_VERSION" | grep -q '\.') ; then
DIST_VERSION=$(echo "$DIST_VERSION" | cut --delimiter='.' -f1)
fi
fi
elif [[ -e "/etc/os-release" ]]; then
. /etc/os-release
DIST=$ID
DIST_VERSION=${VERSION_ID}
fi
# remove whitespace from DIST and DIST_VERSION
DIST="${DIST// /}"
DIST_VERSION="${DIST_VERSION// /}"
}
# ----------
# - Jobhandling
# ----------
# - Run 'clean_up' for signals SIGHUP SIGINT SIGTERM
# -
trap clean_up SIGHUP SIGINT SIGTERM
# - Create lock directory '$LOCK_DIR"
#
mkdir "$LOCK_DIR"
# ----------
# - Some checks ..
# ----------
# - Running in a terminal?
# -
if [[ -t 1 ]] ; then
terminal=true
else
fatal "Script must run in a terminal."
fi
# ==========
# - Begin Main Script
# ==========
# ----------
# - Headline
# ----------
if $terminal ; then
echo ""
echo -e "\033[1m----------\033[m"
echo -e "\033[32m\033[1mRunning script \033[m\033[1m$script_name\033[32m .. \033[m"
echo -e "\033[1m----------\033[m"
fi
# ----------
# Read Configurations from $conf_file
# ----------
# - Give your default values here
# -
DEFAULT_FQDN_HOSTNAME="$(hostname -f)"
DEFAULT_GREENLIGTH_DIR="/usr/local/greenlight"
if [[ -f "$conf_file" ]]; then
source "$conf_file"
else
warn "No configuration file '$conf_file' present.\n
Loading default values.."
fi
[[ -n "$FQDN_HOSTNAME" ]] && DEFAULT_FQDN_HOSTNAME="$FQDN_HOSTNAME"
[[ -n "$GREENLIGTH_DIR" ]] && DEFAULT_GREENLIGTH_DIR="$GREENLIGTH_DIR"
blank_line
echononl "Detect distribution/release of running OS.."
detect_os > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
FQDN_HOSTNAME=
echo ""
echo -e "\033[32m--\033[m"
echo ""
echo "Insert full qualified hostname for BigBlueButton Service"
echo ""
if [[ -n "$DEFAULT_FQDN_HOSTNAME" ]]; then
while [[ "X${FQDN_HOSTNAME}" = "X" ]]; do
echononl "Full qualified hostname [${DEFAULT_FQDN_HOSTNAME}]: "
read FQDN_HOSTNAME
if [[ "X${FQDN_HOSTNAME}" = "X" ]]; then
FQDN_HOSTNAME=$DEFAULT_FQDN_HOSTNAME
fi
if [[ ! $FQDN_HOSTNAME =~ \. ]]; then
echo -e "\n\tGiven Host \033[33m\033[1m$FQDN_HOSTNAME\033[m seems not to be a full qualified hostname.\n"
FQDN_HOSTNAME=""
fi
done
else
while [[ "X${FQDN_HOSTNAME}" = "X" ]]; do
echononl "Full qualified hostname: "
read FQDN_HOSTNAME
if [[ "X${FQDN_HOSTNAME}" = "X" ]]; then
echo -e "\n\t\033[33m\033[1mFull qualified hostname is reqired\033[m\n"
fi
if [[ ! $FQDN_HOSTNAME =~ \. ]]; then
echo -e "\n\tGiven Host \033[33m\033[1m$FQDN_HOSTNAME\033[m seems not to be a full qualified hostname.\n"
FQDN_HOSTNAME=""
fi
done
fi
HOSTNAME="${FQDN_HOSTNAME%%.*}"
GREENLIGTH_DIR=
echo ""
echo -e "\033[32m--\033[m"
echo ""
echo "Give the path into install 'greelight':"
echo ""
if [[ -n "$DEFAULT_GREENLIGTH_DIR" ]]; then
while [[ "X${GREENLIGTH_DIR}" = "X" ]]; do
echononl "Full qualified hostname [${DEFAULT_GREENLIGTH_DIR}]: "
read GREENLIGTH_DIR
if [[ "X${GREENLIGTH_DIR}" = "X" ]]; then
GREENLIGTH_DIR=$DEFAULT_GREENLIGTH_DIR
fi
if [[ ! -d "$(dirname "$GREENLIGTH_DIR")" ]]; then
echo -e "\n\tBase directory \033[33m\033[1m$(dirname "$GREENLIGTH_DIR")\033[m not found.\n"
GREENLIGTH_DIR=""
fi
done
else
while [[ "X${GREENLIGTH_DIR}" = "X" ]]; do
echononl "Full qualified hostname: "
read GREENLIGTH_DIR
if [[ "X${GREENLIGTH_DIR}" = "X" ]]; then
echo -e "\n\t\033[33m\033[1mInstall directory is reqired\033[m\n"
fi
if [[ ! -d "$(dirname "$GREENLIGTH_DIR")" ]]; then
echo -e "\n\tBase directory \033[33m\033[1m$(dirname "$GREENLIGTH_DIR")\033[m not found.\n"
GREENLIGTH_DIR=""
fi
done
fi
echo ""
echo ""
echo -e "\t\033[32mStart pre-install script for BigBlueButton Service with the following parameters\033[m"
echo ""
echo -e "\tFull qualified Hostname............: $FQDN_HOSTNAME"
echo -e "\tHostname...........................: $HOSTNAME"
echo ""
echo -e "\tOS Distribution....................: $DIST"
echo -e "\tDistribution's codename............: $DIST_CODENAME"
echo ""
echo -e "\tInstallation directory greenlight..: $GREENLIGTH_DIR"
echo ""
echononl "einverstanden (yes/no): "
read OK
OK=${OK,,}
while [ "X$OK" != "Xyes" -a "X$OK" != "Xno" ]; do
echononl "Wrong entry! [yes/no]: "
read OK
OK=${OK,,}
done
[ $OK = "yes" ] || fatal Repeat with other settings..
echo ""
blank_line
# Stop Service if started
#
echononl "Stop Greenlight Service.."
if $(ps ax | grep -v grep | grep -q /usr/bin/docker-proxy ) ; then
cd $GREENLIGTH_DIR && docker-compose down > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
else
echo_skipped
fi
# Remove old versions of Docker
#
echononl "Remove old versions of Docker .."
apt-get remove -y docker docker-engine docker.io containerd runc > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
# Install packages to allow apt to use a repository over HTTPS
#
echononl "Install packages to allow apt to use a repository over HTTPS .."
apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common -y > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
blank_line
# Add Dockers official GPG key
#
echononl "Add Dockers official GPG key .."
curl -fsSL https://download.docker.com/linux/ubuntu/gpg 2> "$log_file" | sudo apt-key add - >> "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
# Add Dockers stable repository
#
echononl "Add Dockers stable repositor .."
cat <<EOF > /etc/apt/sources.list.d/docker.list 2> "$log_file"
deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable
EOF
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
# Update the apt package index.
#
echononl "Update the apt package index. .."
apt-get update > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
# Install the latest version of Docker Engine - Community and containerd
#
echononl "Install the latest version of Docker Engine - Community and containerd .."
DEBIAN_FRONTEND=noninteractive apt-get -y install docker-ce docker-ce-cli containerd.io > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
blank_line
# Deinstall apparmor
#
# Needed if docker is running in a LX Conatiner
#
echononl "Deinstall apparmor - Needed because docker is running in a LX-Container .."
DEBIAN_FRONTEND=noninteractive apt-get -y remove apparmor > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
blank_line
# Create the Greenlight directory for its configuration to live in.
#
echononl "Create the Greenlight directory for its configuration to live in. .."
if [[ -d "$GREENLIGTH_DIR" ]] ; then
echo_skipped
else
mkdir "$GREENLIGTH_DIR" > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
fi
echononl "Enter Greenlight directory .."
cd "$GREENLIGTH_DIR" > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
# Greenlight will read its environment configuration from the .env file. To generate this
# file and install the Greenlight Docker image, run (inside greenlight directory):
#
# docker run --rm bigbluebutton/greenlight:v2 cat ./sample.env > .env
#
_new_env=false
echononl "Generate environment configuration and install Greenlight Docker image .."
if [[ -s ${GREENLIGTH_DIR}/.env ]]; then
echo_skipped
else
docker run --rm bigbluebutton/greenlight:v2 cat ./sample.env > .env 2> "$log_file"
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
_new_env=true
fi
fi
# Greenlight needs a secret key in order to run in production. To generate this, run:
#
# docker run --rm bigbluebutton/greenlight:v2 bundle exec rake secret
#
_secret_key_found=false
echononl "Generating a Secret Key (in order to run in production).."
if [[ -z "$(grep -E "^\s*SECRET_KEY_BASE\s*=" ${GREENLIGTH_DIR}/.env 2> /dev/null | cut -d '=' -f2)" ]] ; then
_greenlight_secret="$(docker run --rm bigbluebutton/greenlight:v2 bundle exec rake secret 2> "$log_file")"
if [[ -s "$log_file" ]] ; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
else
echo_skipped
_secret_key_found=true
fi
# Set 'SECRET_KEY_BASE' with generated Secret Key
#
_key="SECRET_KEY_BASE"
_val="$_greenlight_secret"
echononl "Set 'SECRET_KEY_BASE' env with generated Secret Key at file '.env'.."
if $_secret_key_found ; then
echo_skipped
else
perl -i -n -p -e "s/^(\s*${_key}\s*=.*)/##! \1\n${_key}=${_val}/" \
${GREENLIGTH_DIR}/.env > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
fi
# Get BigBlueButtons secret ..
#
echononl "Get BigBlueButtons secret .."
_bbb_secret="$(bbb-conf --secret 2> $log_file | grep -i -E "^\s*Secret" 2> $log_file | awk '{print$2}' 2> $log_file)"
if [[ -s "$log_file" ]] ; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
# Set 'BIGBLUEBUTTON_SECRET' with generated Secret Key
#
_key="BIGBLUEBUTTON_SECRET"
_val="$_bbb_secret"
echononl "Set 'BIGBLUEBUTTON_SECRET' env with BBB's Secret Key at file '.env'.."
if $(grep -E -q "^\s*${_key}\s*=\s*${_val}" ${GREENLIGTH_DIR}/.env 2> /dev/null) ; then
echo_skipped
else
perl -i -n -p -e "s/^(\s*${_key}\s*=.*)/##! \1\n${_key}=${_val}/" \
${GREENLIGTH_DIR}/.env > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
fi
# Get BigBlueButtons url ..
#
echononl "Get BigBlueButtons URL .."
_bbb_url="$(bbb-conf --secret 2> $log_file | grep -i -E "^\s*URL" 2> $log_file | awk '{print$2}' 2> $log_file)"
if [[ -s "$log_file" ]] ; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
# Set 'BIGBLUEBUTTON_ENDPOINT' with generated Secret Key
#
_key="BIGBLUEBUTTON_ENDPOINT"
_val="$_bbb_url"
echononl "Set 'BIGBLUEBUTTON_ENDPOINT' env with BBB's Secret Key at file '.env'.."
if $(grep -E -q "^\s*${_key}\s*=\s*${_val}" ${GREENLIGTH_DIR}/.env 2> /dev/null) ; then
echo_skipped
else
perl -i -n -p -e "s#^(\s*${_key}\s*=.*)#\#\#! \1\n${_key}=${_val}#" \
${GREENLIGTH_DIR}/.env > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
fi
# Set ALLOW_GREENLIGHT_ACCOUNTS
#
_key="ALLOW_GREENLIGHT_ACCOUNTS"
_val="false"
echononl "Set 'ALLOW_GREENLIGHT_ACCOUNTS' to false (file .env).."
if $(grep -E -q "^\s*${_key}\s*=\s*${_val}" ${GREENLIGTH_DIR}/.env 2> /dev/null) ; then
echo_skipped
else
perl -i -n -p -e "s#^(\s*${_key}\s*=.*)#\#\#! \1\n${_key}=${_val}#" \
${GREENLIGTH_DIR}/.env > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
fi
blank_line
# randomly generate a password for the PostgreSQL database and replace the entries
# in the .env and docker-compose.yml
#
# export pass=$(openssl rand -hex 8)
# sed -i 's/POSTGRES_PASSWORD=password/POSTGRES_PASSWORD='$_postgresql_pass'/g' docker-compose.yml
# sed -i 's/DB_PASSWORD=password/DB_PASSWORD='$_postgresql_pass'/g' .env
#
_postgresql_pass=""
_pass_generated=false
echononl "Generate password for the PostgreSQL database.."
if $_new_env ; then
_postgresql_pass="$(openssl rand -hex 8 2> $log_file)"
if [[ -s "$log_file" ]] ; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
_pass_generated=true
fi
else
echo_skipped
fi
# Set DB_PASSWORD'
#
_key="DB_PASSWORD"
_val="$_postgresql_pass"
echononl "Set DB_PASSWORD (file .env).."
if $_pass_generated ; then
perl -i -n -p -e "s#^(\s*${_key}\s*=.*)#\#\#! \1\n${_key}=${_val}#" \
${GREENLIGTH_DIR}/.env > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
else
echo_skipped
fi
blank_line
echononl "Verify the configuration settings (.env file).."
cd "${GREENLIGTH_DIR}" \
&& docker run --rm --env-file .env bigbluebutton/greenlight:v2 bundle exec rake conf:check > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
blank_line
# Greenlight will be configured to deploy at the /b subdirectory. This is necessary so
# it doesnt conflict with the other BigBlueButton components. The Nginx configuration
# for this subdirectory is stored in the Greenlight image. To add this configuration file
# to your BigBlueButton server, run:
#
# docker run --rm bigbluebutton/greenlight:v2 cat ./greenlight.nginx | sudo tee /etc/bigbluebutton/nginx/greenlight.nginx
#
echononl "Add nginx configuration to BigBlueButton's service .."
if [[ -f "/etc/bigbluebutton/nginx/greenlight.nginx" ]] ; then
echo_skipped
else
docker run --rm bigbluebutton/greenlight:v2 cat ./greenlight.nginx \
> /etc/bigbluebutton/nginx/greenlight.nginx 2> $log_file
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
fi
blank_line
# Download the current stable release of Docker Compose:
#
echononl "Download the current stable release (v 1.25.4) of Docker Compose .."
curl -L "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s)-$(uname -m)" \
-o /usr/local/bin/docker-compose > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
echononl "Set executable bit to 'docker-compose'.."
chmod +x /usr/local/bin/docker-compose > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
info "To install a different version of Compose, substitute 1.25.4 with the
version of Compose you want to use."
echononl "Create cronjob to start Greenlight service after booting the system.."
if $(crontab -l 2>/dev/null | grep -q -E "^@reboot\s+.*\s+docker-compose up -d" 2> /dev/null) ; then
echo_skipped
else
_crontab_tmp_file="${LOCK_DIR}/crontab_root.$$"
crontab -l > $_crontab_tmp_file 2> /dev/null
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo "" >> $_crontab_tmp_file
echo "# Start greenlight service (docker)" >> $_crontab_tmp_file
echo "#" >> $_crontab_tmp_file
echo "@reboot cd \"$GREENLIGTH_DIR\" && docker-compose up -d" >> $_crontab_tmp_file
crontab $_crontab_tmp_file > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
fi
fi
blank_line
echononl "Copy the docker-compose.yml file from the Greenlight image in to greenlight directory.."
cd ${GREENLIGTH_DIR} \
&& docker run --rm bigbluebutton/greenlight:v2 cat ./docker-compose.yml > docker-compose.yml 2> $log_file
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
echononl "Set 'POSTGRES_PASSWORD' (file docker-compose.yml).."
if $_pass_generated ; then
sed -i 's/POSTGRES_PASSWORD=password/POSTGRES_PASSWORD='$_postgresql_pass'/g' \
${GREENLIGTH_DIR}/docker-compose.yml > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
else
echo_skipped
fi
echononl "Start Greenlight service (vi docker).."
cd ${GREENLIGTH_DIR} && docker-compose up -d > $log_file 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
echononl "Restart nginx service.."
systemctl restart nginx > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
blank_line
note "To create an Administrator account with the default values, in the Greenlight directory,
run the following command:
# cd $GREENLIGTH_DIR
# \033[1mdocker exec greenlight-v2 bundle exec rake admin:create\033[m
If you would like to configure the name, email, or password of the Administrator account,
replace the previous command with this:
# cd $GREENLIGTH_DIR
# \033[1mdocker exec greenlight-v2 bundle exec rake user:create[\"name\",\"email\",\"password\",\"admin\"]\033[m
Once the command has finished it will print the accounts email and password."
note "Optionally, if you wish to have the default landing page at the root of your BigBlueButton
server redirect to Greenlight, add the following entry to the bottom
of /etc/nginx/sites-available/bigbluebutton just before the last } character.
\033[33mlocation = / {
return 307 /b;
}\033[m
To have this change take effect, you must once again restart Nginx."
clean_up 0

644
archive/bbb-post-install.sh Executable file
View File

@ -0,0 +1,644 @@
#!/usr/bin/env bash
script_name="$(basename $(realpath $0))"
working_dir="$(dirname $(realpath $0))"
#conf_file="${working_dir}/conf/${script_name%%.*}.conf"
conf_file="${working_dir}/conf/bbb.conf"
LOCK_DIR="/tmp/$(basename $0).$$.LOCK"
log_file="${LOCK_DIR}/${script_name%%.*}.log"
# ----------
# Base Function(s)
# ----------
clean_up() {
# Perform program exit housekeeping
rm -rf "$LOCK_DIR"
blank_line
exit $1
}
echononl(){
if $terminal ; then
echo X\\c > /tmp/shprompt$$
if [ `wc -c /tmp/shprompt$$ | awk '{print $1}'` -eq 1 ]; then
echo -e -n " $*\\c" 1>&2
else
echo -e -n " $*" 1>&2
fi
rm /tmp/shprompt$$
fi
}
fatal(){
echo ""
if $terminal ; then
echo -e " [ \033[31m\033[1mFatal\033[m ] $*"
else
echo -e " [ Fatal ] $*"
fi
echo ""
if $terminal ; then
echo -e " \033[1mScript terminated\033[m.."
else
echo -e " Script terminated.."
fi
echo ""
rm -rf $LOCK_DIR
exit 1
}
error (){
echo ""
if $terminal ; then
echo -e " [ \033[31m\033[1mError\033[m ] $*"
else
echo " [ Error ] $*"
fi
echo ""
}
info () {
if $terminal ; then
echo ""
echo -e " [ \033[32m\033[1minfo\033[m ] $*"
echo ""
fi
}
echo_ok() {
if $terminal ; then
echo -e "\033[85G[ \033[32mok\033[m ]"
fi
}
echo_failed(){
if $terminal ; then
echo -e "\033[85G[ \033[1;31mfailed\033[m ]"
fi
}
echo_skipped() {
if $terminal ; then
echo -e "\033[85G[ \033[33m\033[1mskipped\033[m ]"
fi
}
echo_wait(){
if $terminal ; then
echo -en "\033[85G[ \033[5m\033[1m..\033[m ]"
fi
}
trim() {
local var="$*"
var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters
var="${var%"${var##*[![:space:]]}"}" # remove trailing whitespace characters
echo -n "$var"
}
blank_line() {
if $terminal ; then
echo ""
fi
}
detect_os () {
if $(which lsb_release > /dev/null 2>&1) ; then
DIST="$(lsb_release -i | awk '{print tolower($3)}')"
DIST_VERSION="$(lsb_release -r | awk '{print tolower($2)}')"
DIST_CODENAME="$(lsb_release -c | awk '{print tolower($2)}')"
if [[ "$DIST" = "debian" ]]; then
if $(echo "$DIST_VERSION" | grep -q '\.') ; then
DIST_VERSION=$(echo "$DIST_VERSION" | cut --delimiter='.' -f1)
fi
fi
elif [[ -e "/etc/os-release" ]]; then
. /etc/os-release
DIST=$ID
DIST_VERSION=${VERSION_ID}
fi
# remove whitespace from DIST and DIST_VERSION
DIST="${DIST// /}"
DIST_VERSION="${DIST_VERSION// /}"
}
# ----------
# - Jobhandling
# ----------
# - Run 'clean_up' for signals SIGHUP SIGINT SIGTERM
# -
trap clean_up SIGHUP SIGINT SIGTERM
# - Create lock directory '$LOCK_DIR"
#
mkdir "$LOCK_DIR"
# ----------
# - Some checks ..
# ----------
# - Running in a terminal?
# -
if [[ -t 1 ]] ; then
terminal=true
else
fatal "Script must run in a terminal."
fi
# ==========
# - Begin Main Script
# ==========
# ----------
# - Headline
# ----------
if $terminal ; then
echo ""
echo -e "\033[1m----------\033[m"
echo -e "\033[32m\033[1mRunning script \033[m\033[1m$script_name\033[32m .. \033[m"
echo -e "\033[1m----------\033[m"
fi
# ----------
# Read Configurations from $conf_file
# ----------
# - Give your default values here
# -
DEFAULT_FQDN_HOSTNAME="$(hostname -f)"
if [[ -f "$conf_file" ]]; then
source "$conf_file"
else
warn "No configuration file '$conf_file' present.\n
Loading default values.."
fi
[[ -n "$FQDN_HOSTNAME" ]] && DEFAULT_FQDN_HOSTNAME="$FQDN_HOSTNAME"
blank_line
echononl "Detect distribution/release of running OS.."
detect_os > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
FQDN_HOSTNAME=
echo ""
echo -e "\033[32m--\033[m"
echo ""
echo "Insert full qualified hostname for BigBlueButton Service"
echo ""
if [[ -n "$DEFAULT_FQDN_HOSTNAME" ]]; then
while [[ "X${FQDN_HOSTNAME}" = "X" ]]; do
echononl "Full qualified hostname [${DEFAULT_FQDN_HOSTNAME}]: "
read FQDN_HOSTNAME
if [[ "X${FQDN_HOSTNAME}" = "X" ]]; then
FQDN_HOSTNAME=$DEFAULT_FQDN_HOSTNAME
fi
if [[ ! $FQDN_HOSTNAME =~ \. ]]; then
echo -e "\n\tGiven Host \033[33m\033[1m$FQDN_HOSTNAME\033[m seems not to be a full qualified hostname.\n"
FQDN_HOSTNAME=""
fi
done
else
while [[ "X${FQDN_HOSTNAME}" = "X" ]]; do
echononl "Full qualified hostname: "
read FQDN_HOSTNAME
if [[ "X${FQDN_HOSTNAME}" = "X" ]]; then
echo -e "\n\t\033[33m\033[1mFull qualified hostname is reqired\033[m\n"
fi
if [[ ! $FQDN_HOSTNAME =~ \. ]]; then
echo -e "\n\tGiven Host \033[33m\033[1m$FQDN_HOSTNAME\033[m seems not to be a full qualified hostname.\n"
FQDN_HOSTNAME=""
fi
done
fi
HOSTNAME="${FQDN_HOSTNAME%%.*}"
echo ""
echo ""
echo -e "\t\033[32mStart pre-install script for BigBlueButton Service with the following parameters\033[m"
echo ""
echo -e "\tFull qualified Hostname..: $FQDN_HOSTNAME"
echo -e "\tHostname.................: $HOSTNAME"
echo ""
echo -e "\tOS Distribution..........: $DIST"
echo -e "\tDistribution's codename..: $DIST_CODENAME"
echo ""
echononl "einverstanden (yes/no): "
read OK
OK=${OK,,}
while [ "X$OK" != "Xyes" -a "X$OK" != "Xno" ]; do
echononl "Wrong entry! [yes/no]: "
read OK
OK=${OK,,}
done
[ $OK = "yes" ] || fatal Repeat with other settings..
echo ""
echo ""
# Make the HTML5 client default
#
if $terminal ; then
echo ""
echo -e " \033[1mMake the HTML5 client the default client\033[m (no longer load the Flash client)"
echo ""
fi
echononl "Set 'attendeesJoinViaHTML5Client=true'.."
if $(grep -q -E "^\s*attendeesJoinViaHTML5Client=true" \
/usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties 2> /dev/null) ; then
echo_skipped
else
perl -i -n -p -e "s/^(attendeesJoinViaHTML5Client=.*)/##!\1\nattendeesJoinViaHTML5Client=true/" \
/usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
fi
echononl "Set 'moderatorsJoinViaHTML5Client=true'.."
if $(grep -q -E "^\s*moderatorsJoinViaHTML5Client=true" \
/usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties 2> /dev/null) ; then
echo_skipped
else
perl -i -n -p -e "s/^(moderatorsJoinViaHTML5Client=.*)/##!\1\nmoderatorsJoinViaHTML5Client=true/" \
/usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties >> "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
fi
blank_line
# Assign the server a hostname
#
if $terminal ; then
echo ""
echo -e " \033[1mAssign the server a hostname '$FQDN_HOSTNAME'\033[m"
echo ""
fi
echononl "Trigger command 'bbb-conf --setip $FQDN_HOSTNAME'"
echo_wait
bbb-conf --setip $FQDN_HOSTNAME > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
echo -e "
\033[32m----------\033[m
\033[1mOutput from assigning a hostname 'bbb-conf --setip $FQDN_HOSTNAME' was:\033[m
$(cat "$log_file")
\033[32m----------\033[m
"
fi
# Configure FreeSWITCH for using SSL
#
# At file /etc/bigbluebutton/nginx/sip.nginx
#
# change:
#
# proxy_pass http://203.0.113.1:5066;
#
# to
# proxy_pass https://203.0.113.1:7443;
# ^ ^^^^
#
if $terminal ; then
echo ""
echo -e " \033[1mConfigure FreeSWITCH for using SSL\033[m"
echo ""
fi
echononl "Replace 'http://' with https:// (/etc/bigbluebutton/nginx/sip.nginx).."
if $(grep -q -E "http://" /etc/bigbluebutton/nginx/sip.nginx 2> /dev/null) ; then
perl -i -n -p -e "s#http://#https://#" /etc/bigbluebutton/nginx/sip.nginx > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
else
echo_skipped
fi
echononl "Replace port 5066 with 7443 (/etc/bigbluebutton/nginx/sip.nginx).."
if $(grep -q -E ":5066\s*;" /etc/bigbluebutton/nginx/sip.nginx 2> /dev/null) ; then
perl -i -n -p -e "s#:5066\s*;#:7443;#" /etc/bigbluebutton/nginx/sip.nginx > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
else
echo_skipped
fi
blank_line
# Configure BigBlueButton to load session via HTTPS
#
if $terminal ; then
echo ""
echo -e " \033[1mConfigure BigBlueButton to load session via HTTPS\033[m"
echo ""
fi
# file '/usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties'
#
# change:
#
# bigbluebutton.web.serverURL=http://${FQDN_HOSTNAME}
#
# to:
#
# bigbluebutton.web.serverURL=https://${FQDN_HOSTNAME}
# ^
#
echononl "Setup 'bigbluebutton.web.serverURL' (bigbluebutton.properties)"
if $(grep -q -E "^\s*bigbluebutton.web.serverURL\s*=\s*http:" /usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties 2> /dev/null) ; then
perl -i -n -p -e "s#^(\s*bigbluebutton.web.serverURL=.*)#\#\#!\1\nbigbluebutton.web.serverURL=https://${FQDN_HOSTNAME}#" \
/usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
else
echo_skipped
fi
# file: /usr/share/red5/webapps/screenshare/WEB-INF/screenshare.properties
#
# change:
#
# JnlpUrl=https://${FQDN_HOSTNAME}/screenshare
#
# to:
#
# JnlpUrl=https://${FQDN_HOSTNAME}/screenshare
# ^
#
echononl "Setup 'jnlpUrl' (screenshare.properties)"
if $(grep -q -E "^\s*jnlpUrl\s*=\s*http:" /usr/share/red5/webapps/screenshare/WEB-INF/screenshare.properties 2> /dev/null) ; then
perl -i -n -p -e "s#^(\s*jnlpUrl\s*=.*)#\#\#!\1\njnlpUrl=https://${FQDN_HOSTNAME}/screenshare#" \
/usr/share/red5/webapps/screenshare/WEB-INF/screenshare.properties > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
else
echo_skipped
fi
# file: /usr/share/red5/webapps/screenshare/WEB-INF/screenshare.properties
#
# change:
#
# jnlpFile=https://${FQDN_HOSTNAME}/screenshare/screenshare.jnlp
#
# to:
#
# jnlpFile=https://${FQDN_HOSTNAME}/screenshare/screenshare.jnlp
# ^
#
echononl "Setup 'jnlpFile' (screenshare.properties)"
if $(grep -q -E "^\s*jnlpFile\s*=\s*http:" /usr/share/red5/webapps/screenshare/WEB-INF/screenshare.properties 2> /dev/null) ; then
perl -i -n -p -e "s#^(\s*jnlpFile\s*=.*)#\#\#!\1\njnlpFile=https://${FQDN_HOSTNAME}/screenshare/screenshare.jnlp#" \
/usr/share/red5/webapps/screenshare/WEB-INF/screenshare.properties > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
else
echo_skipped
fi
# You must also update the file /var/www/bigbluebutton/client/conf/config.xml to
# tell the BigBlueButton client to load components via HTTPS. You can do the update
# with a single command
#
echononl "Change all 'http://' to 'https:/' (/var/www/bigbluebutton/client/conf/config.xml).."
if $(grep -q -E "http://" /var/www/bigbluebutton/client/conf/config.xml 2> /dev/null) ; then
sed -e 's|http://|https://|g' -i /var/www/bigbluebutton/client/conf/config.xml > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
else
echo_skipped
fi
blank_line
# Adjust /usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml
#
if $terminal ; then
echo ""
echo -e " \033[1mAdjust file /usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml\033[m"
echo ""
fi
# file: /usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml
#
# Change:
#
# kurento:
# wsUrl: ws://bbb.example.com/bbb-webrtc-sfu
#
#to
#
# kurento:
# wsUrl: wss://bbb.example.com/bbb-webrtc-sfu
#
echononl "Change 'wsUrl: ws://' to 'wsUrl: wss://'.."
if $(grep -q -E "wsUrl:\s*ws:" /usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml 2> /dev/null) ; then
perl -i -n -p -e "s#wsUrl:\s*ws:#wsUrl: wss:#" \
/usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
else
echo_skipped
fi
# file: /usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml
#
# Change:
#
# note:
# enabled: true
# url: http://bbb.example.com/pad
# to
#
# note:
# enabled: true
# url: https://bbb.example.com/pad
#
echononl "Change 'url: http://' to 'url: https://'.."
if $(grep -q -E "^\s*url: http:" /usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml 2> /dev/null) ; then
perl -i -n -p -e "s#^(\s*url:\s*)http:#\1https:#" \
/usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
else
echo_skipped
fi
blank_line
# Modify the creation of recordings so they are served via HTTPS
#
if $terminal ; then
echo ""
echo -e " \033[1mModify the creation of recordings so they are served via HTTPS\033[m"
echo ""
fi
# file: /usr/local/bigbluebutton/core/scripts/bigbluebutton.yml
#
# Change:
#
# playback_protocol: http
#
# to:
#
# playback_protocol: https
#
echononl "Change 'playback_protocol' to use https.."
if $(grep -q -E "^\s*playback_protocol:\s*http\s*$" /usr/local/bigbluebutton/core/scripts/bigbluebutton.yml > "$log_file" 2>&1) ; then
perl -i -n -p -e "s#^(\s*playback_protocol:\s*http.*)#\#\#!\1\nplayback_protocol: https#" \
/usr/local/bigbluebutton/core/scripts/bigbluebutton.yml > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
else
echo_skipped
fi
if [[ -f "/var/lib/tomcat7/webapps/demo/bbb_api_conf.jsp" ]] ; then
blank_line
# Also at 'API demo' Installation use SSL Protocol
#
if $terminal ; then
echo ""
echo -e " \033[1mUse SSL Protocoll for API demos\033[m"
echo ""
fi
# file: /var/lib/tomcat7/webapps/demo/bbb_api_conf.jsp
#
# Change:
#
# String BigBlueButtonURL = "http://${FQDN_HOSTNAME}/bigbluebutton/";
#
# To:
#
# String BigBlueButtonURL = "https://${FQDN_HOSTNAME}/bigbluebutton/";
# ^
#
echononl "Change 'BigBlueButtonURL' to use SSL Protocil.."
if $(grep -q -E "^\s*String\s+BigBlueButtonURL\s*=\s*\"http:" /var/lib/tomcat7/webapps/demo/bbb_api_conf.jsp 2> /dev/null) ; then
perl -i -n -p -e "s#^(\s*String\s+BigBlueButtonURL\s*=\s*\"http:.*)#//!\1\nString BigBlueButtonURL = \"https://${FQDN_HOSTNAME}/bigbluebutton/\";#" /var/lib/tomcat7/webapps/demo/bbb_api_conf.jsp > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
else
echo_skipped
fi
fi
blank_line
# Restart BigBlueButton Service
#
if $terminal ; then
echo ""
echo -e " \033[1mRestart BigBlueButton Service\033[m"
echo ""
fi
echononl "Restart BigBlueButton Service - 'bbb-conf --restart'"
bbb-conf --restart > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
echo -e "
\033[32m----------\033[m
\033[1mOutput from restarting BigBlueButton Service was:\033[m
$(cat "$log_file")
\033[32m----------\033[m
"
fi
clean_up 0

569
archive/bbb-pre-install.sh Executable file
View File

@ -0,0 +1,569 @@
#!/usr/bin/env bash
script_name="$(basename $(realpath $0))"
working_dir="$(dirname $(realpath $0))"
#conf_file="${working_dir}/conf/${script_name%%.*}.conf"
conf_file="${working_dir}/conf/bbb.conf"
LOCK_DIR="/tmp/$(basename $0).$$.LOCK"
log_file="${LOCK_DIR}/${script_name%%.*}.log"
# ----------
# Base Function(s)
# ----------
clean_up() {
# Perform program exit housekeeping
rm -rf "$LOCK_DIR"
blank_line
exit $1
}
echononl(){
if $terminal ; then
echo X\\c > /tmp/shprompt$$
if [ `wc -c /tmp/shprompt$$ | awk '{print $1}'` -eq 1 ]; then
echo -e -n " $*\\c" 1>&2
else
echo -e -n " $*" 1>&2
fi
rm /tmp/shprompt$$
fi
}
fatal(){
echo ""
if $terminal ; then
echo -e " [ \033[31m\033[1mFatal\033[m ] $*"
else
echo -e " [ Fatal ] $*"
fi
echo ""
if $terminal ; then
echo -e " \033[1mScript terminated\033[m.."
else
echo -e " Script terminated.."
fi
echo ""
rm -rf $LOCK_DIR
exit 1
}
error (){
echo ""
if $terminal ; then
echo -e " [ \033[31m\033[1mError\033[m ] $*"
else
echo " [ Error ] $*"
fi
echo ""
}
echo_ok() {
if $terminal ; then
echo -e "\033[85G[ \033[32mok\033[m ]"
fi
}
echo_failed(){
if $terminal ; then
echo -e "\033[85G[ \033[1;31mfailed\033[m ]"
fi
}
echo_skipped() {
if $terminal ; then
echo -e "\033[85G[ \033[33m\033[1mskipped\033[m ]"
fi
}
echo_wait(){
if $terminal ; then
echo -en "\033[85G[ \033[5m\033[1m..\033[m ]"
fi
}
trim() {
local var="$*"
var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters
var="${var%"${var##*[![:space:]]}"}" # remove trailing whitespace characters
echo -n "$var"
}
blank_line() {
if $terminal ; then
echo ""
fi
}
detect_os () {
if $(which lsb_release > /dev/null 2>&1) ; then
DIST="$(lsb_release -i | awk '{print tolower($3)}')"
DIST_VERSION="$(lsb_release -r | awk '{print tolower($2)}')"
DIST_CODENAME="$(lsb_release -c | awk '{print tolower($2)}')"
if [[ "$DIST" = "debian" ]]; then
if $(echo "$DIST_VERSION" | grep -q '\.') ; then
DIST_VERSION=$(echo "$DIST_VERSION" | cut --delimiter='.' -f1)
fi
fi
elif [[ -e "/etc/os-release" ]]; then
. /etc/os-release
DIST=$ID
DIST_VERSION=${VERSION_ID}
fi
# remove whitespace from DIST and DIST_VERSION
DIST="${DIST// /}"
DIST_VERSION="${DIST_VERSION// /}"
}
# ----------
# - Jobhandling
# ----------
# - Run 'clean_up' for signals SIGHUP SIGINT SIGTERM
# -
trap clean_up SIGHUP SIGINT SIGTERM
# - Create lock directory '$LOCK_DIR"
#
mkdir "$LOCK_DIR"
# ----------
# - Some checks ..
# ----------
# - Running in a terminal?
# -
if [[ -t 1 ]] ; then
terminal=true
else
fatal "Script must run in a terminal."
fi
# ==========
# - Begin Main Script
# ==========
# ----------
# - Headline
# ----------
if $terminal ; then
echo ""
echo -e "\033[1m----------\033[m"
echo -e "\033[32m\033[1mRunning script \033[m\033[1m$script_name\033[32m .. \033[m"
echo -e "\033[1m----------\033[m"
fi
# ----------
# Read Configurations from $conf_file
# ----------
# - Give your default values here
# -
DEFAULT_FQDN_HOSTNAME="$(hostname -f)"
if [[ -f "$conf_file" ]]; then
source "$conf_file"
else
warn "No configuration file '$conf_file' present.\n
Loading default values.."
fi
[[ -n "$FQDN_HOSTNAME" ]] && DEFAULT_FQDN_HOSTNAME="$FQDN_HOSTNAME"
blank_line
echononl "Detect distribution/release of running OS.."
detect_os > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
FQDN_HOSTNAME=
echo ""
echo -e "\033[32m--\033[m"
echo ""
echo "Insert full qualified hostname for BigBlueButton Service"
echo ""
if [[ -n "$DEFAULT_FQDN_HOSTNAME" ]]; then
while [[ "X${FQDN_HOSTNAME}" = "X" ]]; do
echononl "Full qualified hostname [${DEFAULT_FQDN_HOSTNAME}]: "
read FQDN_HOSTNAME
if [[ "X${FQDN_HOSTNAME}" = "X" ]]; then
FQDN_HOSTNAME=$DEFAULT_FQDN_HOSTNAME
fi
if [[ ! $FQDN_HOSTNAME =~ \. ]]; then
echo -e "\n\tGiven Host \033[33m\033[1m$FQDN_HOSTNAME\033[m seems not to be a full qualified hostname.\n"
FQDN_HOSTNAME=""
fi
done
else
while [[ "X${FQDN_HOSTNAME}" = "X" ]]; do
echononl "Full qualified hostname: "
read FQDN_HOSTNAME
if [[ "X${FQDN_HOSTNAME}" = "X" ]]; then
echo -e "\n\t\033[33m\033[1mFull qualified hostname is reqired\033[m\n"
fi
if [[ ! $FQDN_HOSTNAME =~ \. ]]; then
echo -e "\n\tGiven Host \033[33m\033[1m$FQDN_HOSTNAME\033[m seems not to be a full qualified hostname.\n"
FQDN_HOSTNAME=""
fi
done
fi
HOSTNAME="${FQDN_HOSTNAME%%.*}"
echo ""
echo ""
echo -e "\t\033[32mStart pre-install script for BigBlueButton Service with the following parameters\033[m"
echo ""
echo -e "\tFull qualified Hostname..: $FQDN_HOSTNAME"
echo -e "\tHostname.................: $HOSTNAME"
echo ""
echo -e "\tOS Distribution..........: $DIST"
echo -e "\tDistribution's codename..: $DIST_CODENAME"
echo ""
echononl "einverstanden (yes/no): "
read OK
OK=${OK,,}
while [ "X$OK" != "Xyes" -a "X$OK" != "Xno" ]; do
echononl "Wrong entry! [yes/no]: "
read OK
OK=${OK,,}
done
[ $OK = "yes" ] || fatal Repeat with other settings..
echo ""
echo ""
# /etc/resolf.conf
#
#echononl "Remove symlink '/etc/resolv.conf'.."
#if [[ -h "/etc/resolv.conf" ]]; then
# rm /etc/resolv.conf > $log_file 2>&1
# if [[ $? -ne 0 ]]; then
# echo_failed
# error "$(cat "$log_file")"
# else
# echo_ok
# fi
#else
# echo_skipped
#fi
#
#echononl "Create new file '/etc/resolv.conf'.."
#cat <<EOF > /etc/resolv.conf 2> $log_file
#### Hetzner Online GmbH installimage
## nameserver config
#nameserver 213.133.100.100
#nameserver 213.133.98.98
#nameserver 213.133.99.99
#nameserver 2a01:4f8:0:1::add:9898
#nameserver 2a01:4f8:0:1::add:1010
#nameserver 2a01:4f8:0:1::add:9999
#EOF
#if [[ $? -ne 0 ]]; then
# echo_failed
# error "$(cat "$log_file")"
#else
# echo_ok
#fi
echononl "Set FQDN hostname (IPv4).."
perl -i -n -p -e "s/^127\.0\.1\.1.*/127.0.1.1 $FQDN_HOSTNAME $HOSTNAME/" /etc/hosts > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
blank_line
echononl "Create sources.list for '$DIST $DIST_CODENAME'.."
cat <<EOF > /etc/apt/sources.list 2> "$log_file"
deb http://archive.ubuntu.com/ubuntu ${DIST_CODENAME} main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu ${DIST_CODENAME}-updates main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu ${DIST_CODENAME}-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu ${DIST_CODENAME}-backports main restricted universe multiverse
EOF
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
echononl "Update repositories.."
apt-get update > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
echononl "Upgrade System.."
apt-get --yes dist-upgrade > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
blank_line
# Set the locale of the server to 'en_US.UTF-8'.
echononl "Install 'language-pack-en'.."
apt-get install --yes language-pack-en > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
echononl "Set the locale of the server to 'en_US.UTF-8'.."
update-locale LANG=en_US.UTF-8 > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
echononl "Set system environment to 'en_US.UTF-8'.."
systemctl set-environment LANG=en_US.UTF-8 > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
blank_line
# BigBlueButtons components, such as Tomcat, need a source of entropy when starting up.
#
echononl "Install 'haveged'.."
apt-get install --yes haveged > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
echononl "Install 'software-properties-common'.."
apt-get install --yes software-properties-common -y > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
blank_line
# Add reposototies for 'ffmpeg' (create recordings) and 'yq' (update YAML files)
#
# Note:
# The default version of ffmpeg in Ubuntu 16.04 is old and yq does not exist
# in the default repositories
#
echononl "Add repository for 'ffmpeg' .."
add-apt-repository ppa:bigbluebutton/support -y > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
echononl "Add repository for 'yq'.."
add-apt-repository ppa:rmescandon/yq -y > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
echononl "Update repositories.."
apt-get update > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
echononl "Upgrade System.."
apt-get --yes dist-upgrade > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
blank_line
# add repository for mongodb
#
echononl "Add apt key for 'mongodb' repository.."
wget -qO - https://www.mongodb.org/static/pgp/server-3.4.asc | sudo apt-key add - > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
echononl "Add repository for 'mongodb'.."
cat <<EOF > /etc/apt/sources.list.d/mongodb-org-3.4.list 2> "$log_file"
deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu ${DIST_CODENAME}/mongodb-org/3.4 multiverse
EOF
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
echononl "Update repositories.."
apt-get update > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
echononl "Install mongo-db and curl .."
apt-get install -y mongodb-org curl > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
blank_line
# install nodejs
#
echononl "Trigger script to install the NodeSource Node.js 8.x LTS Carbon repo.."
echo_wait
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
echononl "Install nodejs.."
apt-get install -y nodejs > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
# apt-get key for BigBlueButton repository
#
echononl "Add apt key for BigBlueButton repository.."
wget https://ubuntu.bigbluebutton.org/repo/bigbluebutton.asc -O- 2> "$log_file" | sudo apt-key add - > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
# add the repository for BigBlueButton 2.2 packages
#
echononl "Add repository for BigBlueButton 2.2 packages.."
cat <<EOF > /etc/apt/sources.list.d/bigbluebutton.list 2> "$log_file"
deb https://ubuntu.bigbluebutton.org/${DIST_CODENAME}-220/ bigbluebutton-${DIST_CODENAME} main
EOF
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
echononl "Update repositories.."
apt-get update > "$log_file" 2>&1
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
blank_line
# Create 'override'-directory for service 'redis-server'
#
echononl "Create 'override'-directory for service 'redis-server'.."
if [[ -d "/etc/systemd/system/redis-server.service.d" ]] ; then
echo_skipped
else
mkdir /etc/systemd/system/redis-server.service.d
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
fi
echononl "Create 'override'-file for service 'redis-server'.."
cat <<EOF > /etc/systemd/system/redis-server.service.d/override.conf 2> "$log_file"
[Service]
PrivateDevices=no
EOF
if [[ $? -ne 0 ]]; then
echo_failed
error "$(cat "$log_file")"
else
echo_ok
fi
clean_up 0