Moodle
On this page:
Moodle is the largest and most popular open-source eLearning platform.
Prerequisites
Before installing Moodle, make sure all the components specified in the Moodle Server Configuration page are installed and properly configured.
Installation Steps
To execute Docker commands, a user with sudo privileges is required. If the root user is accessible, there is no need to add the ‘sudo’ instruction.
To deploy a containerized Moodle using Docker, follow these steps:
Create a Docker Compose file in the /opt directory.
cd /opt mkdir moodle cd /moodle nano docker-compose.yml
Copy the following text inside the file. The Docker images belong to a company named bitnami.
# Copyright Broadcom, Inc. All Rights Reserved. # SPDX-License-Identifier: APACHE-2.0 services: postgresql: image: docker.io/bitnami/postgresql:15 environment: # ALLOW_EMPTY_PASSWORD is recommended only for development. #- ALLOW_EMPTY_PASSWORD=yes - POSTGRESQL_USERNAME=moodleuser - POSTGRESQL_PASSWORD=<db_password> - POSTGRESQL_DATABASE=moodle #- MARIADB_CHARACTER_SET=utf8mb4 #- MARIADB_COLLATE=utf8mb4_unicode_ci volumes: - 'postgresql_data:/bitnami/postgresql' moodle: image: docker.io/bitnami/moodle:4.1 ports: - '8080:8080' - '8443:8443' environment: - MOODLE_DATABASE_TYPE=pgsql - MOODLE_DATABASE_HOST=172.18.0.2 - MOODLE_DATABASE_PORT_NUMBER=5432 - MOODLE_DATABASE_USER=moodleuser - MOODLE_DATABASE_NAME=moodle - MOODLE_DATABASE_PASSWORD=<db_password> - MOODLE_HOST=<server_hostname> - MOODLE_REVERSEPROXY=true - MOODLE_SSLPROXY=true # ALLOW_EMPTY_PASSWORD is recommended only for development. #- ALLOW_EMPTY_PASSWORD=yes volumes: - 'moodle_data:/bitnami/moodle' - '/home/ubuntu/moodledata:/bitnami/moodledata' depends_on: - postgresql volumes: postgresql_data: driver: local moodle_data: driver: local
Make sure to replace values where needed. E.g. Replace <db_password> with the actual password for the moodle database user.
Note one of the moodle volumes is pointing to a folder named moodledata located in /home/ubuntu/moodledata
Some of Moodle’s settings and files are not saved on the database, instead there is a folder named moodledata which contains many of these things. It is necessary to download a copy of this folder and upload it to the new server.
Access https://fundo.impilo.app/ server, create a .zip of the moodledata folder and download it using a tool like FileZilla. The moodledata folder is located in /opt/moodledata
sudo zip -r moodledata.zip moodledata
Upload the .zip to the new server, and unzip it.
Change the docker-compose.yml file, type the correct path to the moodledata folder
Create the container using Docker Compose
Install Moodle plugins.
Impilo Moodle instance has a total of 6 plugins used to accomplish different functionalities. Start by downloading each of them. Download the file to your PC and then upload to the server using a tool like FileZilla or use the wget command and copy the URL from the plugin’s download button:
To install the plugins, just copy the downloaded folder into their respective paths in the Moodle folder.
Unzip the file
Copy custom certificate to the mod/ folder
Enter into the container, navigate to the plugin folder and change its owner and permissions
Copy event trigger to the tool/ folder, and repeat step iii. for this plugin.
Copy autocomplete input to the field/ folder, and repeat step iii. for this plugin.
Copy academi to the theme/ folder, and repeat step iii. for this plugin.
Copy static pages to local/ folder, and repeat step iii. for this plugin.
Copy moodle analytics to the local/ folder, and repeat step iii. for this plugin.
Stop Moodle container
Enter to the database container
Access the PostgreSQL database
Delete Moodle’s database and create it again
Download a backup of https://fundo.impilo.app/ Moodle’s database. Daily backups can be found at the S3 bucket named ‘backups-psh-s3’, located in the PSI Bahmni AWS account.
Upload the database backup to the server using FileZilla or a similar tool.
Copy the backup to the database container
Enter the container again, and go to the bitnami folder where the backup file was copied. Decompress the file:
Proceed to restore the backup:
Start the Moodle container again
Moodle homepage should display when entering the domain. See Moodle Server Configuration for information on how to configure nginx.