A project to build a Moodle server and Wi-Fi router on Raspberry Pi.
Visit the MoodleBox web site for more information about the MoodleBox features or any question about the usage of a MoodleBox.
If you just want to use a MoodleBox, a prepared disk image of the latest released version is available for downloading and using out of the box on your Raspberry Pi 3A, 3B, 3B+ or 4B. Follow the instructions on the MoodleBox web site.
We have an active discussion forum where users and developers can ask questions. Please don't use the GitHub issue tracker to ask questions.
If you just want to use a MoodleBox, you don't need to build the MoodleBox disk image yourself. Just download the MoodleBox image and follow the instructions on the MoodleBox web site.
To build a MoodleBox from scratch with this script, you need a Raspberry Pi 3B, 3B+ or 4B.
- Clone Raspberry Pi OS (32-bit) Lite image on your microSD card.
- Create a
ssh.txt
file on theboot
partition, e.g. usingtouch ssh.txt
. - Insert the microSD card into your Raspberry Pi.
- Connect your Raspberry Pi to your Ethernet network and boot it.
- Install Ansible on your computer.
- Install
sshpass
to enable passing SSH password to the Raspberry Pi. On macOS, use e.g.brew tap esolitos/ipa; brew install sshpass
. - Clone this repository to your local drive.
- Create a
keys
directory in the repository folder and copy your public key into it, under the nameid_rsa.pub
. - Get the IP address of your Raspberry Pi and change it in the
hosts.yml
file. Do not change anything else, unless you know what you're doing. You're on your own. - Run
ansible-playbook moodlebox.yml
from the repository folder. - Wait 15–50 minutes, depending on your Raspberry Pi model, SD card speed and Internet bandwidth. You're done.
Restore the database
And now let's delete the database data and restore the backup:
systemctl stop mariadb.service
rm -rf /var/lib/mysql/* # you should always empty the datadir directory before restoring
mariabackup --prepare --target-dir=<mariaDB-backupdir>/YYYY-MM/DD_HHh_full/
mariabackup --prepare --target-dir=<mariaDB-backupdir>/YYYY-MM/DD_HHh_full/ --incremental-dir=<mariaDB-backupdir>/YYYY-MM/DD_HHh_MMm_inc/
mariabackup --copy-back --target-dir=<mariaDB-backupdir>/YYYY-MM/DD_HHh/
chown -R mysql:mysql /var/lib/mysql/
systemctl start mariadb.service
You can now try to connect to the test_restore database and query the recovered data.
You can override any of the defaults configured in default.config.yml
by creating a config.yml
file and setting the overrides in that file. For example, you can change the MoodleBox main credentials and the timezone with something like:
moodlebox_username: 'myusername'
moodlebox_password: 'secret'
moodlebox_timezone: 'Australia/Perth'
Any variable can be overridden in config.yml
; see the file default.config.yml
for a list of available variables.
The code is available at https://github.com/moodlebox/moodlebox.
See Release notes.
MoodleBox is sponsored by E-learning Touch' Moodle Partner.
- To Daniel Méthot, for the idea of a MoodleBox
- To Christian Westphal, for the first POC of a MoodleBox
- To the Raspberry Pi Foundation, for a splendid small computer
- To Martin Dougiamas, for giving us Moodle, and to the Moodle community
Copyright © 2016 onwards, Nicolas Martignoni nicolas@martignoni.net.
All contributions to this repository are licensed under AGPLv3 or any later version.
MoodleBox doesn't require a CLA (Contributor License Agreement). The copyright belongs to all the individual contributors. Therefore we recommend that every contributor adds following line to the header of a file, if they changed it substantially:
@copyright Copyright © <year>, <your name> (<your email address>)