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
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, https://moodle.org/
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.
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.
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.
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.
Efs endpoint ex: “XXXXXXX.amazonaws.com”
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:
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.