This post outlines how you can run Moodle on Heroku. This route is a potential solution for anyone looking to get started with Moodle, a feature rich, open source learning management system (LMS), using a hosting solution that provides greater control and does not display ads to students.
The post begins with an introduction to Moodle and Heroku for those that are unfamiliar with either of the two. In introducing each, the post also covers motivations that set each apart from alternatives. It then goes on to provide details for getting started with this approach. It ends with some caveats to be aware of when going this route.
Moodle allows teachers to quickly share resources, create quizzes, and monitor student progress. It also allows teachers to build up materials over time and reuse these material quickly for a repeat course.
Moodle is open source! Why build something of your own when there is a team dedicated to this solution? There is also a community contributing to plugin development expanding Moodle. I pursued this route for a high school computer science class. There were plenty of aspects that made it a good fit for me:
- Large community behind plugins
- Markdown support
- Ability to incorporate code snippets into questions - great for a computer science course to differentiate code snippets within questions/material
- Support for batch import of questions to its question bank
- Can be managed by a non-programmer
What is Heroku?
Heroku is a PaaS (platform as a service) offering that is popular among developers to quickly deploy and host applications. For the purpose of this blog post, it allows users to specify a code repository (ex: Moodle) and have it running with a few button clicks. Of course, Moodle requires a database and that is also a few clicks away.
- Create an account with Heroku.
- Create a new PHP app that will host Moodle and direct the app to eemp/moodle or a fork that you create off this.
- Create a postgres database to support the app.
- Configure the Moodle app with the database details. You can find all the environment variables that you need to define in config.php:
- Take Moodle for a test drive.
For my purposes, I am seeing if Heroku’s free tier will work out in the classroom. Although, the free tier is only meant to be a playground (not meant for production apps), it seems like it would be sufficient for my purposes. The downsides to this approach are listed below:
- no SSL (for free tier)
- app sleeps after 30 minutes of inactivity (in the free tier) - what this means is that the first request to the sleeping app will take time to get served (it’s not that bad)
- you are now responsible for creating backups and looking into any issues that might crop up - if you were using vendors, you may have some of these safety nets and guarantees
- code repository is not the official moodle repository - it is a fork that I created with some tweaks specifically meant for hosting on Heroku
EDIT: 2018-07-08 - Lessons Learned
It is the end of the school year. I thought I should add some lessons learned - some that contradict what I note above.
- Given its widespread usage and time available to address concerns and issues, Moodle works well for what’s supported
- As a software engineer, I found the software stack dated
- It’s not a simple thing to find hosted SQL solutions to back Moodle. You will find that you are quickly running into the free 10k row limit for heroku database services.
In short, see if you can find a better hosting solution than Heroku if reliability and uptime are crucial.