MoodleBox

From MoodleDocs
Revision as of 16:30, 23 April 2022 by Nicolas Martignoni (talk | contribs) (→‎Features)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Note: You can find the most up-to-date documentation for this plugin in the MoodleBox webpage at https://moodlebox.net. This page is intended for users that click on the 'Moodle Docs for this page' link.

The MoodleBox plugin for Moodle is an administration tool providing a GUI to some settings and management of a MoodleBox, a Moodle server installed on a Raspberry Pi.

It enables a Moodle administrator to monitor some hardware settings, to set the date of the MoodleBox, to allow restart and shutdown of the MoodleBox and changing Raspberry Pi passwords using a GUI. After the installation in Moodle, some steps are required to complete on the Raspberry Pi (see below).

The plugin is compatible with Moodle 3.6 or later. A Raspberry Pi model 3A+, 3B, 3B+ or 4B is recommended.

Requirements

  • A Raspberry Pi (Model 3A+, 3B, 3B+ or 4B recommended)
  • Raspbian installed (or another Linux based distribution)
  • Package Incron installed
  • Moodle installed (obviously)

Installation

The MoodleBox plugin must be installed in the Moodle tree of the MoodleBox, in the tool folder. Once installed, an new option MoodleBox will be available in Moodle, under Site administration > Server in the Administration block.

To complete the installation, you have to configure some `direvent` jobs on the MoodleBox.

1. Install `direvent` package:

   ```bash
   sudo apt-get install direvent
   ```

1. Add following lines to file `/etc/direvent.conf`:

   ```bash
   # This is the configuration file for direvent. Read
   # direvent.conf(5) for more information about how to
   # fill this file.
   debug 0;
   watcher {
     path /var/www/moodle/admin/tool/moodlebox/;
     file .reboot-server;
     event CLOSE_WRITE;
     command "/sbin/shutdown -r now";
   }
   watcher {
     path /var/www/moodle/admin/tool/moodlebox/;
     file .shutdown-server;
     event CLOSE_WRITE;
     command "/sbin/shutdown -h now";
   }
   watcher {
     path /var/www/moodle/admin/tool/moodlebox/;
     file .set-server-datetime;
     event CLOSE_WRITE;
     command "/bin/bash /var/www/moodle/admin/tool/moodlebox/.set-server-datetime";
   }
   watcher {
     path /var/www/moodle/admin/tool/moodlebox/;
     file .newpassword;
     event CLOSE_WRITE;
     command "/bin/bash /var/www/moodle/admin/tool/moodlebox/bin/changepassword.sh";
   }
   watcher {
     path /var/www/moodle/admin/tool/moodlebox/;
     file .wifisettings;
     event CLOSE_WRITE;
     command "/usr/bin/python3 /var/www/moodle/admin/tool/moodlebox/bin/changewifisettings.py";
   }
   watcher {
     path /var/www/moodle/admin/tool/moodlebox/;
     file .resize-partition;
     event CLOSE_WRITE;
     command "/bin/bash /var/www/moodle/admin/tool/moodlebox/bin/resizepartition.sh";
   }
   ```

Copy the following line at the end of file /etc/sudoers

   www-data ALL=(ALL) NOPASSWD:/sbin/parted /dev/mmcblk0 unit MB print free
   www-data ALL=(ALL) NOPASSWD:/usr/bin/vcgencmd

If you use PiJuice, install the related packages

   sudo apt-get install pijuice-base
   sudo adduser www-data i2c

and reboot

Secure your Moodlebox

This is not needed in normal MoodleBox use, i.e. if you don't expose your MoodleBox on the Internet.

Features

  • Info about the MoodleBox (kernel version, Raspberry Pi OS version, free space on SD card, CPU load, CPU temperature, CPU frequency, uptime, DHCP clients and more).
  • Warning when under voltage detected.
  • GUI to set the MoodleBox date and time.
  • GUI to set the MoodleBox password.
  • GUI to set the MoodleBox Wi-Fi settings: SSID and its visibility, regulatory country, channel, password (or remove password) and fixed IP address.
  • GUI to resize the partition of the SD card of the MoodleBox, when needed.
  • GUI to restart and shutdown the MoodleBox.

Availability

The code is available at https://github.com/moodlebox/moodle-tool_moodlebox.

See also