Recipe to Deploy Tutor from Scratch on a Small VM

While Tutor deployment instructions are well documented, I figured it would be worth documenting the process I went through to do it with a third-party plugin (the Library Authoring MFE) on a smallish AWS VM.

Prerequisites

This howto was tested on a VM in AWS with the following characteristics:

  • CPU: 2 cores

  • RAM: 8GB

  • Local storage: 100GB

This is essentially a t3a.large type, which seems to be the more economical one. As for instance configuration:

  • OS: Ubuntu 22.04

  • Firewall: Ports 22, 80, and 443 open

  • IP: A public address (here, 1.2.3.4)

  • DNS: a domain (here, example.org) that points to the above IP

  • SSH: an SSH key deployed to it

And if you want activation emails (or any kind of email) to be properly sent out, it is a good idea for your VM to be configured with IPv6 in dual-stack mode. Here’s the AWS VPC guide on how to do it.

Initial update

Connect to the VM via SSH, using the ubuntu user.

ssh ubuntu@example.org

Then proceed to update all packages, reboot, and remove extraneous ones:

sudo apt update && sudo apt full-upgrade -y sudo reboot sudo apt autoremove --purge

Add other SSH keys

If you have other team members, add their SSH keys from, for instance, Github:

user=exampleuser wget -O - https://github.com/${user}.keys >> ~/.ssh/authorized_keys

Install docker

Because Tutor 16 now supports Docker’s new BuildKit, which does more intelligent caching and more efficient builds (which will come in handy when rebuilding the tutor-mfe image), we'll be installing it directly from upstream (as opposed to just apt installing it.) This process is documented elsewhere, but here are the actual steps that were used.

First, remove any pre-existing Docker packages:

Next, add the upstream GPG keys and the repository, then update the package list.

Install the required packages:

Add the ubuntu user to the docker group so it can manage containers without being root, then exit the SSH session and reconnect:

Install Tutor

After reconnecting, install Tutor as follows:

If this is the first time running pip, exit the SSH session and reconnect. This is so the PATH environment variable is updated to include pip-installed binaries:

Configure

At this point, create the base Tutor environment via:

Answer the questions as follows, replacing values with your own:

Plugins

Install the tutor plugins you need. In this case, we’ll install tutor-mfe, tutor-forum, and the (at time of writing) experimental tutor-contrib-library-authoring-mfe.

Start with the official ones:

Then proceed with the plugin for the Library Authoring MFE:

If you need to alter LMS configuration - a common practice - create a local site-config plugin (the name is arbitrary) to contain it.

(In the example above we’re simply specifying which email domains are allowed to self-register.)

Finally, enable the installed plugins and regenerate the environment:

Rebuild MFE image

Because we installed a custom MFE plugin, we won’t be able to use the pre-built MFE image provided by the Tutor team. Here we’ll build a new one.

However, while the new Docker BuildKit is great for several reasons, it tries to build all MFEs in parallel. Given the number of MFEs that Tutor currently supports together with the relatively small size of this VM, this would grind the build process to a halt. To avoid it, we create a new build container limited to one thread:

We can then finally rebuild the image.

On an instance of this type, the process takes around 40 minutes.

Launch!

Finally, it’s time to launch! Run the following command. Feel free to take the default values, as you already filled them in earlier:

This will take a little while, as the Docker images need to be fetched and the MySQL migrations to be r un.

Further configuration

You’ll likely want to create an administrator user for yourself. Do so as follows:

And if you want to import the demonstration course, there’s a command for that, too:

Finally, if you’re going to try out Libraries v2 you should also create a default organization in the admin dashboard. Log in as your admin user, then head on to https://openedx.example.org/admin/organizations/organization/ and add at least one. It will be needed when creating a library.