Skip to content

Commit

Permalink
Make some messages more clear and fix some typos.
Browse files Browse the repository at this point in the history
  • Loading branch information
GhaziTriki committed Nov 29, 2023
1 parent f11f57f commit f6de171
Showing 1 changed file with 35 additions and 36 deletions.
71 changes: 35 additions & 36 deletions bbb-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ check_root() {

check_mem() {
if awk '$1~/MemTotal/ {exit !($2<3940000)}' /proc/meminfo; then
echo "Your server needs to have (at least) 4G of memory."
echo "Your server should have (at least) 4 GB of memory."
if [ "$SKIP_MIN_SERVER_REQUIREMENTS_CHECK" != true ]; then
exit 1
fi
Expand All @@ -441,7 +441,7 @@ check_mem() {

check_ipv6() {
if [ ! -f /proc/net/if_inet6 ]; then
echo "Your server does not support IPV6"
echo "Your server does not support IPv6"
if [ "$SKIP_MIN_SERVER_REQUIREMENTS_CHECK" != true ]; then
exit 1
fi
Expand All @@ -450,7 +450,7 @@ check_ipv6() {

check_cpus() {
if [ "$(nproc --all)" -lt 4 ]; then
echo "Your server needs to have (at least) 4 CPUs (8 recommended for production)."
echo "Your server needs to have (at least) 4 CPU cores (8 CPU cores recommended for production)."
if [ "$SKIP_MIN_SERVER_REQUIREMENTS_CHECK" != true ]; then
exit 1
fi
Expand Down Expand Up @@ -843,20 +843,20 @@ HERE
/etc/letsencrypt/renewal-hooks/deploy/haproxy
}

# This function will install the latest official version of greenlight-v3 and set it as the hosting Bigbluebutton default frontend or update greenlight-v3 if installed.
# Greenlight is a simple to use Bigbluebutton room manager that offers a set of features useful to online workloads especially virtual schooling.
# This function will install the latest official version of greenlight-v3 and set it as the hosting BigBlueButton default frontend or update greenlight-v3 if installed.
# Greenlight is a simple to use BigBlueButton room manager that offers a set of features useful to online workloads especially virtual schooling.
# https://docs.bigbluebutton.org/greenlight/gl-overview.html
install_greenlight_v3(){
# This function depends on the following files existing on their expected location so an eager check is done asserting that.
if [[ -z $SERVLET_DIR || ! -f $SERVLET_DIR/WEB-INF/classes/bigbluebutton.properties || ! -f $CR_TMPFILE || ! -f $BBB_WEB_ETC_CONFIG ]]; then
err "greenlight-v3 failed to install/update due to unmet requirements, have you followed the recommended steps to install Bigbluebutton?"
err "greenlight-v3 failed to install/update due to unmet requirements, have you followed the recommended steps to install BigBlueButton?"
fi

check_root
install_docker

# Preparing and checking the enviroment.
say "preparing and checking the enviroment to install/update greelight-v3..."
# Preparing and checking the environment.
say "preparing and checking the environment to install/update greelight-v3..."

if [ ! -d $GL3_DIR ]; then
mkdir -p $GL3_DIR && say "created $GL3_DIR"
Expand Down Expand Up @@ -919,10 +919,10 @@ install_greenlight_v3(){
say "greenlight-v3 .env file was created"
fi

# A note for future maintainers:
# The following configuration operations were made idempotent, meaning that playing these actions will have an outcome on the system (configure it) only once.
# Replaying these steps are a safe and an expected operation, this gurantees the seemless simple installation and upgrade of Greenlight v3.
# A simple change can impact that property and therefore render the upgrading functionnality unoperationnal or impact the running system.
# Note for Future Maintainers:
# - The configuration steps below are idempotent. They affect the system (configuration) only on the first run.
# - Repeating these steps is safe and expected, ensuring a smooth installation and upgrade process for Greenlight v3.
# - Caution: Even minor changes might disrupt the idempotent nature, potentially affecting upgrade functionality or system stability.

# Configuring Greenlight v3 .env file (if already configured this will only update the BBB endpoint and secret).
cp -v $GL3_DIR/.env $GL3_DIR/.env.old && say "old .env file can be retrieved at $GL3_DIR/.env.old" #Backup
Expand All @@ -933,7 +933,7 @@ install_greenlight_v3(){
sed -i "s|^[# \t]*DATABASE_URL=[ \t]*$|DATABASE_URL=$DATABASE_URL_ROOT/$PGDBNAME|" $GL3_DIR/.env # Do not overwrite the value if not empty.
sed -i "s|^[# \t]*REDIS_URL=[ \t]*$|REDIS_URL=$REDIS_URL_ROOT/|" $GL3_DIR/.env # Do not overwrite the value if not empty.

# Placing greenlight-v3 nginx file, this will enable greenlight-v3 as your Bigbluebutton frontend (bbb-fe).
# Placing greenlight-v3 nginx file, this will enable greenlight-v3 as your BigBlueButton frontend (bbb-fe).
cp -v $NGINX_FILES_DEST/greenlight-v3.nginx $NGINX_FILES_DEST/greenlight-v3.nginx.old && say "old greenlight-v3 nginx config can be retrieved at $NGINX_FILES_DEST/greenlight-v3.nginx.old" #Backup
docker run --rm --entrypoint sh $GL_IMG_REPO -c 'cat greenlight-v3.nginx' > $NGINX_FILES_DEST/greenlight-v3.nginx && say "added greenlight-v3 nginx file"

Expand Down Expand Up @@ -963,18 +963,18 @@ install_greenlight_v3(){
fi
fi

# For backward compatibility, any already installed greenlight-v2 application will remain but it will not be the default frontend for BigBluebutton.
# For backward compatibility, any already installed greenlight-v2 application will remain but it will not be the default frontend for BigBlueButton.
# To access greelight-v2 an explicit /b relative root needs to be indicated, otherwise greelight-v3 will be served by default.

# Disabling the greenlight-v2 redirection rule.
disable_nginx_site greenlight-redirect.nginx && say "found greelight-v2 redirection rule and disabled it!"

# Disabling the Bigbluebutton default Welcome page frontend.
# Disabling the BigBlueButton default Welcome page frontend.
disable_nginx_site default-fe.nginx && say "found default bbb-fe 'Welcome' and disabled it!"

# Adding Keycloak
if [ -n "$INSTALL_KC" ]; then
# When attepmting to install/update Keycloak let us attempt to create the database to resolve any issues caused by postgres false negatives.
# When attempting to install/update Keycloak let us attempt to create the database to resolve any issues caused by postgres false negatives.
docker-compose -f $GL3_DIR/docker-compose.yml up -d postgres && say "started postgres"
wait_postgres_start
docker-compose -f $GL3_DIR/docker-compose.yml exec -T postgres psql -U postgres -c 'CREATE DATABASE keycloakdb;'
Expand Down Expand Up @@ -1074,18 +1074,18 @@ HERE
}

# This function will install and update to the latest official version of BigBlueButton LTI framework.
# BigBlueButton LTI tools framewrok provides a simple interface to integrate Bigbluebutton features into any LTI certified LMS.
# BigBlueButton LTI tools framework provides a simple interface to integrate BigBlueButton features into any LTI certified LMS.
install_lti(){
# This function depends on the following files existing on their expected location so an eager check is done asserting that.
if [[ -z $SERVLET_DIR || ! -f $SERVLET_DIR/WEB-INF/classes/bigbluebutton.properties || ! -f $CR_TMPFILE || ! -f $BBB_WEB_ETC_CONFIG ]]; then
err "BBB LTI framework failed to install/update due to unmet requirements, have you followed the recommended steps to install Bigbluebutton?"
err "BBB LTI framework failed to install/update due to unmet requirements, have you followed the recommended steps to install BigBlueButton?"
fi

check_root
install_docker

# Preparing and checking the enviroment.
say "preparing and checking the enviroment to install/update BBB LTI framework..."
# Preparing and checking the environment.
say "preparing and checking the environment to install/update BBB LTI framework..."

if [ ! -d $LTI_DIR ]; then
mkdir -p $LTI_DIR && say "created $LTI_DIR"
Expand Down Expand Up @@ -1169,7 +1169,7 @@ install_lti(){

say "BBB LTI framework is installed, up to date and accessible on: https://$HOST/$BROKER_RELATIVE_URL_ROOT"
say "You can refer to your LMS documentation on how to add a LTI application."
say " The LTI launch links for all of the installed BBB LTI framework applications can be found in https://$HOST/$BROKER_RELATIVE_URL_ROOT."
say "The LTI launch links for all of the installed BBB LTI framework applications can be found in https://$HOST/$BROKER_RELATIVE_URL_ROOT."

return 0;
}
Expand Down Expand Up @@ -1201,12 +1201,12 @@ install_lti_tools() {
}

install_lti_tool() {
# Preparing and checking the enviroment.
# Preparing and checking the environment.
if [[ -z $LTI_APP_DIR || -z $APP_IMG_REPO || -z $LOG_NAME || -z $RELATIVE_URL_ROOT || -z $NGINX_NAME || -z $PGDBNAME ]]; then
err "$LOG_NAME installation/update failed due to unmet requirements!"
fi

say "preparing and checking the enviroment to install/update $LOG_NAME..."
say "preparing and checking the environment to install/update $LOG_NAME..."

if [ ! -d "$LTI_APP_DIR" ]; then
mkdir -p "$LTI_APP_DIR" && say "created $LTI_APP_DIR"
Expand Down Expand Up @@ -1236,10 +1236,10 @@ install_lti_tool() {
say "$LOG_NAME .env file was created"
fi

# A note for future maintainers:
# The following configuration operations were made idempotent, meaning that playing these actions will have an outcome on the system (configure it) only once.
# Replaying these steps are a safe and an expected operation, this gurantees the seemless simple installation and upgrade of BBB LTI framework.
# A simple change can impact that property and therefore render the upgrading functionnality unoperationnal or impact the running system.
# Note for Future Maintainers:
# - The configuration steps below are designed to be idempotent. This means executing these actions will only configure the system once, regardless of how many times they are run.
# - Repeating these steps is both safe and expected, ensuring a smooth installation and upgrade process for the BBB LTI framework.
# - Caution: Minor changes might alter this idempotent behavior, potentially affecting the upgrade functionality or the stability of the running system.

# Configuring BBB LTI .env file (if already configured this will only update some expected or safe to change variables).
cp -v "$LTI_APP_DIR"/.env "$LTI_APP_DIR"/.env.old && say "old $LOG_NAME .env file can be retrieved at $LTI_APP_DIR/.env.old" #Backup
Expand Down Expand Up @@ -1331,7 +1331,7 @@ wait_postgres_start() {
}

register_lti_tool() {
# Preparing and checking the enviroment.
# Preparing and checking the environment.
if [[ -z $LTI_APP_DIR || -z $APP_NAME || -z $LOG_NAME ]]; then
err "$LOG_NAME registration failed due to unmet requirements!"
fi
Expand All @@ -1341,7 +1341,7 @@ register_lti_tool() {
local OAUTH_KEY OAUTH_SECRET RELATIVE_URL_ROOT
OAUTH_KEY=$(sed -ne "s/^\([ \t]*OMNIAUTH_BBBLTIBROKER_KEY=\)\(.*\)$/\2/p" "$LTI_APP_DIR"/.env) # Extract the LTI app OAUTH key.
OAUTH_SECRET=$(sed -ne "s/^\([ \t]*OMNIAUTH_BBBLTIBROKER_SECRET=\)\(.*\)$/\2/p" "$LTI_APP_DIR"/.env) # Extract LTI app OAUTH secret.
RELATIVE_URL_ROOT=$(sed -ne "s/^\([ \t]*RELATIVE_URL_ROOT=\)\(.*\)$/\2/p" "$LTI_APP_DIR"/.env) # Extract LTI app realtive URL root path.
RELATIVE_URL_ROOT=$(sed -ne "s/^\([ \t]*RELATIVE_URL_ROOT=\)\(.*\)$/\2/p" "$LTI_APP_DIR"/.env) # Extract LTI app relative URL root path.

if [ -z "$OAUTH_KEY" ] || [ -z "$OAUTH_SECRET" ] ; then
err "failed to retrieve the $LOG_NAME OAUTH credentials - retry to resolve."
Expand All @@ -1367,15 +1367,15 @@ register_lti_tool() {
}

# Given a container name as $1, this function will check if there's a match for that name in the list of running docker containers on the system.
# The result will be binded to $?.
# The result will be bound to $?.
check_container_running() {
docker ps | grep -q "$1" || return 1;

return 0;
}

# Given a filename as $1, if file exists under $sites_dir then the file will be suffixed with '.disabled'.
# sites_dir points to Bigbluebutton nginx sites, when suffixed with '.disabled' nginx will not include the site on reload/restart thus disabling it.
# sites_dir points to BigBlueButton nginx sites, when suffixed with '.disabled' nginx will not include the site on reload/restart thus disabling it.
disable_nginx_site() {
local site_path="$1"

Expand Down Expand Up @@ -1524,7 +1524,7 @@ set_real_ip_from 127.0.0.1;
real_ip_header proxy_protocol;
real_ip_recursive on;
server {
# this double listenting is intended. We terminate SSL on haproxy. HTTP2 is a
# this double listening is intended. We terminate SSL on haproxy. HTTP2 is a
# binary protocol. haproxy has to decide which protocol is spoken. This is
# negotiated by ALPN.
#
Expand Down Expand Up @@ -1633,10 +1633,10 @@ HERE
rm /etc/nginx/ssl/dhp-4096.pem
fi
fi
# Create the default Welcome page Bigbluebutton Frontend unless it exists.
# Create the default Welcome page BigBlueButton Frontend unless it exists.
if [[ ! -f /usr/share/bigbluebutton/nginx/default-fe.nginx && ! -f /usr/share/bigbluebutton/nginx/default-fe.nginx.disabled ]]; then
cat <<HERE > /usr/share/bigbluebutton/nginx/default-fe.nginx
# Default Bigbluebutton Landing page.
# Default BigBlueButton Landing page.
location @bbb-fe {
index index.html index.htm;
Expand Down Expand Up @@ -1742,7 +1742,7 @@ configure_coturn() {
<!--
We need turn0 for FireFox to workaround its limited ICE implementation.
This is UDP connection. Note that port 3478 must be open on this BigBlueButton
and reachble by the client.
and reachable by the client.
Also, in 2.5, we previously defined turn:\$HOST:443?transport=tcp (not 'turns')
to workaround a bug in Safari's handling of Let's Encrypt. This bug is now fixed
Expand Down Expand Up @@ -1886,4 +1886,3 @@ HERE
}

main "$@" || exit 1

0 comments on commit f6de171

Please sign in to comment.