Run Canvas LMS in Ubuntu 20.04 with Docker

Photo by Ian Taylor on Unsplash

Run Canvas LMS in Ubuntu 20.04 with Docker

Introduction

Canvas LMS is one of the famous Learning Management Systems (LMS) in the modern EdTech ecosystem. With the support for LTI 1.3, it enables seamless integrations with many other tools in the EdTech ecosystem.

Although there is some documentation on how to run Canvas LMS in local environments with docker, I found that a well-documented end-to-end configuration setup is nowhere to be found. Especially when it comes to Ubuntu (Linux) environments, running a Canvas LMS docker container is not straightforward.

So, this article discusses the steps to follow in running Canvas LMS in Ubuntu with Docker.

Download Canvas LMS

As the initial step, you have to download the Canvas LMS from its GitHub repository.

Canvas LMS

Configure Mutagen

Mutagen IO provides a set of utility tools that let developers use local tools to work in remote environments like cloud servers and containers. So, it enables developers to see the application runs locally which are actually running or separate hardware or containers.

Canvas LMS utilizes these tools to run the application locally. Thus, it is essential to have them installed in your environment.

Download Tools

Download and extract the suitable archive for the environment.

Create Path

These tools need to be accessed system wide. So, it is essential to have them in /usr/bin or in /usr/local/bin. The easiest way to do that is to create symbolic links of the tools.

To do that, go to the root folder of each extracted tool folder and run these commands.

sudo ln -s mutagen /usr/local/bin
sudo ln -s mutagen-compose /usr/local/bin

Install Dory

Dory is a reverse proxy tool where you can configure custom domain names instead of IP addresses in local development environments.

Dory is a Ruby Gem tool that you might need to install rubygems tool to your environment if not installed already.

sudo apt-get install rubygems

Next, install dory as a gem.

Note: dory 1.1.1 version is having an installation issue and most recommendations are to downgrade it to 1.1.0 version.

sudo gem install dory -v 1.1.0

Run Canvas Installation Script

Thanks to its creators, Canvas LMS is shipped with well-defined installation scripts for many different scenarios. So, that simplifies most of the hard parts in installation just by executing the installation script.

/canvas-lms$ ./script/docker_dev_setup.sh

docker_dev_setup.png

Finally after all you will see the instructions on what to do next

on_setup_success.png

Well, we have completed the installation. Let's try to run the containers as per the instructions. Navigate or open a terminal in your Canvas LMS root folder and run the following command to spin up the docker containers.

Here mutagen-compose mutagen version of docker-compose command.

mutagen-compose up -d

After a successful run, you'll see below logs in your terminal.

[+] Running 2/2
⠿ Container canvas-lms-mutagen-1  Stopped                                                                                                                                                            0.3s
⠿ Mutagen                         Paused                                                                                                                                                             0.0s
[+] Running 2/2
 ⠿ Container canvas-lms-mutagen-1  Started                                                                                                                                                            0.6s
 ⠿ Mutagen                         Started                                                                                                                                                            0.3s
[+] Running 6/6
 ⠿ Container canvas-lms-webpack-1            Started                                                                                                                                                  0.6s
 ⠿ Container canvas-lms-githook_installer-1  Started                                                                                                                                                  0.6s
 ⠿ Container canvas-lms-postgres-1           Running                                                                                                                                                  0.0s
 ⠿ Container canvas-lms-redis-1              Running                                                                                                                                                  0.0s
 ⠿ Container canvas-lms-jobs-1               Started                                                                                                                                                  0.5s
 ⠿ Container canvas-lms-web-1                Running

Load Canvas LMS in Browser

To load the Canvas LMS open a browser and navigate to the following URL http://canvas.docker. Everything is in good condition, you'll see the login page of Canvas LMS.

Common Caveat

Sometimes, even if the docker containers started properly and running, you won't be able to access canvas via browser even docker image is up and running. The reason for this is related to the Dory proxy.

The reason is Linux has some systemd services running that will race against Dory to bind to port 53 (and usually they win).

To resolve this issue we can re-run Dory. In that case, Dory will manage to carefully stop and restore the systemd services while starting its proxy and DNS masking processes.

dory up

To check whether the Dory is running in good condition we can use dory status command and it will list the current state of the tool. If it is in a good state, you'll see the following in the terminal.

dory status

[*] Nginx proxy:  Running as docker container dory_dinghy_http_proxy
[*] Dnsmasq:  Running as docker container dory_dnsmasq
[*] Resolv:  configured with nameserver 127.0.0.1