edX on the Raspberry Pi – A Portable Classroom

The devops team at edX has been busy with working with the community to make Open edX available to everyone in the world. Almost all of the code behind edx.org is made available to the public under an aGPL license. In addition to the edx-platform source code, the configuration scripts that install and update the platform are available in our configuration repo. The tool we use for configuration is called Ansible, a Python-based configuration management tool that has the right balance of flexibility and simplicity for our operations team.

Periodically edX releases vagrant images if you would like to install edX on your PC. See our documentation for setting the platform locally in a virtual machine.

While we usually focus on deploying edX to large cloud-based production servers, this post covers a very different challenge: a proof of concept for running the edX course and authoring software on the Raspberry Pi.

RaspberryPi

The Raspberry Pi is ARM/Linux low-cost computer which can be purchased for around $35.  Running the edX website on a low-cost device such as the Pi could potentially enable portable classrooms in areas that have limited access to the Internet. This can be done with the Pi for less money than a laptop or desktop computer.

A minimal site configuration is functional on the Raspberry Pi but it does not yet perform well enough to be used in real courses serving multiple students. The platform however is functional for a single student with room for potential improvement.

Download and Install

  • Step 1: Download the pre-made Raspberry Pi image – edx-raspberrypi-20131228.img.gz
  • Step 2: Flash the SD Card
    You can use the default username and password for ssh – user: pi passwd: raspberry

  • Step 3: Ensure that supervisor is running and that both the LMS and CMS are running
    sudo service supervisor start
    sudo /edx/bin/supervisorctl -c /edx/etc/supervisord.conf
  • Step 4: With your browser connect to the LMS/Studio
    LMS on port 18000 - `http://[ip address]:18000 `
    Studio on port 18010 - `http://[ip address]:18010`
    username: staff@example.com password: edx

What Works and What Doesn’t

  • Create a new course using studio

Screenshot from 2013-12-30 10:53:09

  • Access courses as a student

Screenshot from 2013-12-30 10:56:15

Measuring page render time using Chrome devtools:

  • LMS demo courseware page ~ 5 seconds
  • Student dashboard page ~ 5 seconds

The following features are not yet supported:

  • Forums are not enabled and are probably not compatible with the current version of mongo.
  • Custom code graders are not enabled.
  • Ora / Discern for machine learning are not enabled.

edX Configuration on the Raspberry Pi

Raspberry Pi Hardware

  • 700MHz Raspberry Pi / 500MB
  • 8 GB SD card

Service Configuration

The following services will be running on the Raspberry Pi after installation:

  • nginx/gunicorn
  • python/django and all python libraries that depend on it
  • mysql
  • mongo
  • memcached

Everything that edX requires is located under /edx, completely self contained in multiple python virtualenvs. Mongo is installed in /edx/mongo which is the non x86 port compiled for ARM. Since compiling everything for the Raspberry Pi from scratch takes days, there is a public image available that will serve as a good starting point.

Some caveats and improvements are needed before it can be used seriously:

  • Extraneous logging needs to be squelched: loglevel is set to CRITICAL but tracking logs are currently written to the SD Card.
  • Overall performance is not ideal and it will be difficult to improve without setting up more aggressive caching or making additional code changes.
  • Updating the edx-platform repo takes about 1 hour.

Configuration with Ansible

We use Ansible as the edX configuration management tool for production systems. The same scripts with some small modifications will work for the Raspberry Pi.

Ansible is set up on the Raspberry Pi making it easy to update it for new versions of edx-platform and make configuration changes. Updates take about an hour due to asset compilation (Coffeescript and Sass), though that step could be done offline since it’s not architecture specific.

How to update the Raspberry Pi to the latest edx-platform commit

The following commands can be run directly on the Raspberry Pi to update its configuration or edx-platform repo version:

# Ensure that the configuration repo is on the Raspberry Pi branch
sudo /edx/bin/update configuration jarv/raspberrypi
# Run the Raspberry Pi Ansible playbook
cd /edx/app/edx_ansible/edx_ansible/playbooks/edx-east
/edx/app/edx_ansible/venvs/edx_ansible/bin/ansible-playbook -i localhost, -c local --tags deploy raspberrypi.yml -e "edx_platform_version=master" 

Help and Troubleshooting

If you need help with edX please join our community mailing list.  If you have specific questions about running edX on the Raspberry Pi please keep in mind that this is just a prototype and not officially maintained and supported. If you do get it working on the Raspberry Pi or another platform please let me know, I would love to hear from you!