Blog Posts Business Management

Moodle HA setup using docker over AWS

Blog: NASSCOM Official Blog


In traditional way most of the organizations host their moodle app in the single server, which includes Application/DB even though maintaining the server to be a backup (application/db) still it can not be false into failover/high availability setup. This blog illustrates how we can host a moodle app with High availability over AWS.

The following are the topics which we will discuss in detail in this Tutorial

Introduction to the Moodle Hosting:

Moodle is the most widely used one of open-source LMS application (Learning Management System). It is used for various forms of learning; to mention a few,blended learning, distance education, flipped classroom are some of its uses. It is especially used for e-learning projects in schools, universities, workplaces, etc. The best part about Moodle is that it’s highly customisable as per requirement. we can get more info about from official site,

Goal of HA & Auto Scaling:

HA availability: To achieve system HA we analyze failure of moodle components and decoupled it with redundant(Multi Zone Availability)service availability by using Amazon Web Services with the help of AutoScaling. Autoscaling scales up or scaled down the computing resources automatically according to the current needs of the application by adjusting utilization threshold limits.

Components we used for HA:

AWS Stack:

Moodledata:  Moodle application stores the uploaded data in the  moodledata directory which needs to be setupKey considerations for moodle cluster design: in a shared file system which can be accessible to the autoscaling group.

session cache: user session data to maintain application state as they work. We are using Amazon Elasticache service to maintain users active sessions in multiple availability zones if the container gets stopped.

Database:  Used Amazon Aurora Relational Database Service with high availability setup.

Source code management: git and jenkins services are used to manage the source code keep update on all servers.

Proposed Solution & Architecture:

Let’s have a look at each area and we briefed how we make the system high available. (What and why

Finally we achieved a HA solution for the AWS Hosted moodle application, with our approach by cutting down the costs of the standard method and increasing system availability.

In our further post we describe resources configurations and deployment source using github and CFT.

 Creating Docker image for Moodle App

Make a moodle application docker image where the moodledata configuration points to EFS storage  like below.

Docker file:  “ GitHub Link which pointed to EFS”

Moodle Container Contains:

EFS file System for MoodleData: Amazon Elastic File System provides a simple and scalable NFS file system which is maintained by Amazon Web Services. Which is built to scale on at most petabytes without disturbing running apps.Growing and shrinking automatically as you add and remove files, eliminating the need to provision and manage capacity to accommodate growth.

Setup efs file system by following the below reference guide and move moodledata inside.

Reference link:

Efs endpoint ex: “”

Elastic Container Services for Managing Docker Containers: (Amazon ECS) is a highly scalable, fast, container management service that makes it easy to run, stop, and manage Docker containers on a cluster. We used this cluster  to maintain all the time application containers to be up based on requests.

Creation of cluster and more info you can find from below link:


Auto Scaling Launch Configuration for ScalingUp Instances Access to Moodledata:

Update  EC2 Launch configuration template userdata which keep mounting EFS file system to the scaling ecs nodes.

Amazon Application Load Balancer:  Amazon Elastic LoadBalancer serves as the single point of contact for clients . The load balancer termites https requests and distributes incoming application traffic across multiple docker containers according to the optimal routing mechanism.

This article was originally created at

The post Moodle HA setup using docker over AWS appeared first on NASSCOM Community |The Official Community of Indian IT Industry.

Leave a Comment

Get the BPI Web Feed

Using the HTML code below, you can display this Business Process Incubator page content with the current filter and sorting inside your web site for FREE.

Copy/Paste this code in your website html code:

<iframe src="" frameborder="0" scrolling="auto" width="100%" height="700">

Customizing your BPI Web Feed

You can click on the Get the BPI Web Feed link on any of our page to create the best possible feed for your site. Here are a few tips to customize your BPI Web Feed.

Customizing the Content Filter
On any page, you can add filter criteria using the MORE FILTERS interface:

Customizing the Content Filter

Customizing the Content Sorting
Clicking on the sorting options will also change the way your BPI Web Feed will be ordered on your site:

Get the BPI Web Feed

Some integration examples