Moodle + MariaDB + Redis
Moodle is the most widely used online learning platform in educational institutions: courses, enrollments, assessments, grades and student tracking.
This Stack installs it with MariaDB and Redis. In-memory caching matters especially here, because Moodle’s load is concentrated in peaks: all students log in at the same time.
Services included
In addition to the application, the Stack brings up MariaDB, Moodle, Redis, an nginx that receives traffic on port 80, an automatic backups service and the web file manager.
Project structure
.
├── backup
│ └── backup-runner.sh
├── health
│ └── status.py
├── nginx
│ └── default.conf
├── .env.example
└── compose.yaml
Getting started
Install the Stack and bring it up:
docker-deploy-stack --stack php/moodle-mariadb-redis
cd /root/stack/php/moodle-mariadb-redis
docker compose up -d
This is a ready-to-use application: you don’t need to upload code. Themes, plugins, extensions and files you upload from its administration panel are stored in the Stack and are included in the automatic backups.
Configuration
Editable values are in the Stack’s .env file:
| Variable | Default | What it’s for |
|---|---|---|
APP_PORT |
80 |
Public port of the Stack. |
APP_ENV |
development |
Application environment. |
DB_NAME |
moodle |
Database name. |
DB_USER |
moodle |
Database user. |
BACKUP_ENABLED |
1 |
Automatic backups: 1 enabled, 0 disabled. |
BACKUP_INTERVAL_SECONDS |
86400 |
How many seconds between backups. |
BACKUP_RETENTION_DAYS |
7 |
How many days backups are retained. |
MARIADB_VERSION |
11.4 |
Corresponding image version. |
MOODLE_VERSION |
latest |
Corresponding image version. |
NGINX_VERSION |
stable-alpine |
Corresponding image version. |
REDIS_VERSION |
7-alpine |
Corresponding image version. |
After changing it, apply the changes with docker compose up -d.
Useful commands
docker compose ps # view the containers that are running
docker compose logs -f # view live logs
docker compose restart # restart the services
docker compose down # stop and remove the containers