Scalelite lazy deployment

All-in-one manual deployment on AWS using docker-compose

Scalelite is an open-source load balancer, designed specifically for BigBlueButton [1], that evenly spreads the meeting load over a pool of BigBlueButton servers. It makes the pool of BigBlueButton servers appear to a front-end application such as Moodle [2], as a single and yet very scalable BigBlueButton server.

It was released by Blindside Networks [3] under the AGPL license on March 13, 2020, in response to the high demand of Universities looking into scaling BigBlueButton as a result of the COVID-19 pandemic [4].

The full source code is available on GitHub and pre-built docker images can be found on DockerHub.

Architecture

At a high level, the general idea is that Scalelite is placed in front of a pool of BigBlueButton servers, acting as a Proxy for all of them.

Scalelite has four main components:

The proxy:

A custom build of nginx that includes configuration files for handling the requests in the same way BigBlueButton does.

The frontend API

The RoR application that implements the BigBlueButton API and handles the demand and distributes to the actual BigBlueButton servers.

The meeting poller

A Ruby script that is run as a scheduled task for polling the status of the BigBlueButton servers registered.

The recording importer (scalelite-recording-importer)

A Ruby script that is run as a scheduled task for importing the recording feed by the BigBlueButton servers into the database.

In a nutshell, Scalelite components interact as in this diagram:

And each component is bundled in its own Docker image.

In a deployment that involves multiple machines and perhaps even a distributed load through multiple nodes, scalelite-nginx and scalelite-api should coexist and still be deployed together in the same host. The other two, scalelite-poller and scalelite-recording-importer, can alternatively be deployed on the same or separate boxes. One thing to notice though is that there should be one and only one instance of the scalelite-recording-importer.

Single node deployment

The simplest way to deploy Scalelite is on a single node that runs all its components and services required. And although this may certainly not be our preferred choice for a production environment, it may be appealing for those getting started with this kind of deployments or those who have budgetary restrictions.

A big warning here is that you must keep in mind that this deployment won’t give you HA by any means. The more load you put on a single node, the more risk you are in of going down when you less would like.

That being said, let’s dive into the details of deployment.

What you need?

This deployment makes use of Amazon Web Services, which is a Cloud infrastructure that is assumed that you are familiar with already.

  • 1 VPC
  • 1 EC2 instance, (recommended no less than a t3.small), which for the effects of this tutorial will hold Ubuntu 18.04.
  • Route 53 Hosted Zone (example.com)

Prepare the environment

Updating the VM

sudo -iapt-get updateapt-get dist-upgrade

Adding swap memory

fallocate -l 1G /swapfiledd if=/dev/zero of=/swapfile bs=1024 count=1048576chmod 600 /swapfilemkswap /swapfileswapon /swapfile

To make the change permanent add the line

/swapfile swap swap defaults 0 0

To the file

/etc/fstab

Installing Docker

apt install apt-transport-https ca-certificates curl software-properties-commonapt install apt-transport-https ca-certificates curl software-properties-commoncurl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"apt updateapt install docker-ce

Installing Docker Compose

curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-composechmod +x /usr/local/bin/docker-compose

Installation

Fetching the scripts

git clone https://github.com/jfederico/scalelite-runcd scalelite-run

Initializing environment variables

Create a new .env file based on the dotenv file included.

cp dotenv .env

Most required variables are pre-set by default, the ones that must be set before starting are:

SECRET_KEY_BASE=
LOADBALANCER_SECRET=
URL_HOST=
NGINX_SSL=

Obtain the value for SECRET_KEY_BASE with:

openssl rand -hex 64

You should see something like this:

a7441a3548b9890a8f12b385854743f3101fd7fac9353f689fc4fa4f2df6cdcd1f58bdf6a02ca0d35a611b9063151d70986bad8123a73244abb2a11763847a45

Obtain the value for LOADBALANCER_SECRET with

openssl rand -hex 24

You should see something like this:

c2d3a8e27844d56060436f3129acd945d7531fe77e661716

Set the hostname on URL_HOST (E.g. scalelite.example.com)

When using a SSL certificate set NGINX_SSL to true

Your final .env file should look like this:

SECRET_KEY_BASE=a7441a3548b9890a8f12b385854743f3101fd7fac9353f689fc4fa4f2df6cdcd1f58bdf6a02ca0d35a611b9063151d70986bad8123a73244abb2a11763847a45
LOADBALANCER_SECRET=c2d3a8e27844d56060436f3129acd945d7531fe77e661716
URL_HOST=scalelite.example.com
NGINX_SSL=true

For using a SSL certificate signed by Let’s Encrypt, generate the certificates.

./init-letsencrypt.sh

Start the services.

docker-compose up -d

Now, the scalelite server is running, but it is not quite yet ready. The database must be initialized.

docker exec -i scalelite-api bundle exec rake db:setup

Configuration

It is important to mention that Scalelite doesn’t have a UI for administration. Instead it comes with a set of back-end scripts (rake tasks) that must be run using the Command Line for configuring and managing the BigBlueButton servers that will be used.

You can check the server status.

docker exec -i scalelite-api bundle exec rake status

You should notice that there are no servers configured. That can also be verified with pulling the list of servers.

docker exec -i scalelite-api bundle exec rake servers

But you can add some BigBlueButton servers.

docker exec -i scalelite-api bundle exec rake servers:add[https://bbb1.example.com/bigbluebutton/api/,bbb-secret]

That should give you an ID for each server added.

OKid: 27243e91–35a3–42ee-80a7-bd5980b0728f

Use the server ID for enabling the server.

docker exec -i scalelite-api bundle exec rake servers:enable[27243e91–35a3–42ee-80a7-bd5980b0728f]

And lastly, although the poller will update the servers. It can also be run manually.

docker exec -i scalelite-api bundle exec rake poll:all

Additionally, the servers can be also be disabled.

docker exec -i scalelite-api bundle exec rake servers:disable[27243e91–35a3–42ee-80a7-bd5980b0728f]

Taken out of the pool.

docker exec -i scalelite-api bundle exec rake servers:panic[27243e91–35a3–42ee-80a7-bd5980b0728f]

Or removed.

docker exec -i scalelite-api bundle exec rake servers:remove[27243e91–35a3–42ee-80a7-bd5980b0728f]

For more detailed information regarding server management, read the README file in the official git repository. https://github.com/blindsidenetworks/scalelite.

Using BigBlueButton servers through Scalelite

Your BigBlueButton servers are now ready to be used. You can use Scalelite with any external application (such as Moodle or Wordpress) by setting its hostname as the BigBlueButton URL and the secret generated (LOADBALANCER_SECRET) during the installation as the BigBlueButton Secret.

URL: https://scalelite.example.com/bigbluebutton/api/
Secret: c2d3a8e27844d56060436f3129acd945d7531fe77e661716

Handling recordings

This setup does not include the settings for enabling Scalelite to handle recordings. For a more details in reference on that particular topic see the article Scalelite lazy deployment (Part II)

That’s it!, enjoy.

References

[1] BigBlueButton. In Wikipedia. Retrieved Apr 27, 2020 from https://en.wikipedia.org/wiki/BigBlueButton

[2] Moodle. In Wikipedia. Retrieved Apr 27, 2020 from https://en.wikipedia.org/wiki/Moodle

[3] Blindside Networks. In Blindside Networks website. Retrieved Apr 27, 2020 from https://blindsidenetworks.com/about-us/

[4] Schaffhauser, Dian (Mar 03, 2020). Coronavirus Pushes Online Learning Forward. Retrieved Apr 27, 2020 from https://campustechnology.com/articles/2020/03/03/coronavirus-pushes-online-learning-forward.aspx

Common Issues

  1. Server is still offline. This commonly happens because when adding the BigBlueButton server, the format shown in this tutorial MUST be used. Notice the /api/ that is included as part of the URL. When running bbb-conf - -secret in the BigBlueButton server, the URL presented does not include that part.
docker exec -i scalelite-api bundle exec rake servers:add[https://bbb1.example.com/bigbluebutton/api/,bbb-secret]

Senior Software Engineer & active polyglot coder. Passionate for making the applications that shape our world. Work @BlindsideNetwks @BigBlueButton