Completed script for initialising bigbluiebutton (#5)

* scalelite host can be set up with paramaters

* updated script for bbb

* updated script for bbb

* completed script for initializing bigbluebutton
This commit is contained in:
Jesus Federico
2020-11-28 14:29:28 -05:00
committed by GitHub
parent 9d1edbb39b
commit fb3d5f871c

View File

@@ -12,11 +12,12 @@ EXAMPLES:
Sample options for setup a BigBlueButton server Sample options for setup a BigBlueButton server
-s scalelite.example.com -s scalelite.example.com
HERE HERE
exit 0
} }
main() { main() {
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
while builtin getopts "s" opt "${@}"; do while builtin getopts "s:" opt "${@}"; do
case $opt in case $opt in
s) s)
@@ -26,16 +27,40 @@ main() {
fi fi
;; ;;
esac esac
done done
if [ ! -z "$HOST" ]; then if [ ! -z "$HOST" ]; then
check_host $HOST check_host $HOST
else
usage
fi fi
}
check_host() {
if [ ! -z "$HOST" ]; then
need_pkg dnsutils apt-transport-https net-tools
DIG_IP=$(dig +short $1 | grep '^[.0-9]*$' | tail -n1)
if [ -z "$DIG_IP" ]; then err "Unable to resolve $1 to an IP address using DNS lookup."; fi
fi
}
err() {
echo "$1" >&2
exit 1
}
main "$@" || exit 1
# We can proceed with the setup # We can proceed with the setup
echo 'Create a new group with GID 2000...' if grep -q scalelite-spool /etc/group
then
echo "Group <scalelite-spool> exists"
else
echo "Group <scalelite-spool> does not exist. Create it with GID 2000..."
groupadd -g 2000 scalelite-spool groupadd -g 2000 scalelite-spool
fi
echo 'Add the bigbluebutton user to the group...' echo 'Add the bigbluebutton user to the group...'
usermod -a -G scalelite-spool bigbluebutton usermod -a -G scalelite-spool bigbluebutton
@@ -46,24 +71,22 @@ wget -O post_publish_scalelite.rb https://raw.githubusercontent.com/blindsidenet
echo 'Add recording transfer settings...' echo 'Add recording transfer settings...'
cd /usr/local/bigbluebutton/core/scripts cd /usr/local/bigbluebutton/core/scripts
wget https://raw.githubusercontent.com/blindsidenetworks/scalelite/master/bigbluebutton/scalelite.yml wget https://raw.githubusercontent.com/blindsidenetworks/scalelite/master/bigbluebutton/scalelite.yml
echo "spool_dir: bigbluebutton@$URL_HOST:/var/bigbluebutton/spool" | tee -a /usr/local/bigbluebutton/core/scripts echo "spool_dir: bigbluebutton@$HOST:/var/bigbluebutton/spool" | tee -a /usr/local/bigbluebutton/core/scripts/scalelite.yml
echo 'Generate ssh key pair...' echo 'Generate ssh key pair...'
if [ -z "/home/bigbluebutton" ]; then
mkdir /home/bigbluebutton mkdir /home/bigbluebutton
chown bigbluebutton.bigbluebutton /home/bigbluebutton/ chown bigbluebutton.bigbluebutton /home/bigbluebutton/
fi
su - bigbluebutton -s /bin/bash -c "ssh-keygen -t ed25519 -N '' -f ~/.ssh/id_rsa" su - bigbluebutton -s /bin/bash -c "ssh-keygen -t ed25519 -N '' -f ~/.ssh/id_rsa"
echo 'Add this key to /home/bigbluebutton/.ssh/authorized_keys in scalelite:' public_key=$(cat my_file)
cat /home/bigbluebutton/.ssh/scalelite.pub set +x
echo
echo 'done' echo
echo "Add this key to /home/bigbluebutton/.ssh/authorized_keys in scalelite:"
check_host() { echo
if [ [ -z "$HOST" ] then echo "$public_key"
need_pkg dnsutils apt-transport-https net-tools echo
DIG_IP=$(dig +short $1 | grep '^[.0-9]*$' | tail -n1) echo
if [ -z "$DIG_IP" ]; then err "Unable to resolve $1 to an IP address using DNS lookup."; fi exit 0
get_IP $1
if [ "$DIG_IP" != "$IP" ]; then err "DNS lookup for $1 resolved to $DIG_IP but didn't match local $IP."; fi
fi
}