Moodle Offline
This article describes the process of providing an offline moodle server as used by Lagan College.
Moodle is an excellent virtual learning environment but I have found it is often not possible to deliver large class lessons using moodle as schools often suffer from underpowered internet connections, leaving students waiting too long for content to download or webpage timeouts. The following describes how to fallback unto a local intranet server copy of moodle, synchronised with your online version, when the online version is not playing ball.
Moodle Offline
To follow this document it you will need to have some experience of Linux, Apache and MySql or have technical support in these areas. The end result will be nothing more than another link for a teacher to click on if the school’s online moodle is causing problems but the approach is built on the know-how I have picked up over the last ten years of playing with web servers, database servers and Linux.
The two step approach
1. I run a nightly cron script on the online moodle server that backs up the moodle database and any files in the moodle data directory that have been added/changed during the last 24 hours. The two tarred and gzipped files are encrypted using gpg and placed somewhere in the web server’s html directory. A simple log is kept of the transaction.
#!/bin/bash
strStart=$(date +%r)
strDate=$(date +%G%m%d)
script_path=’/path/to/folder’
dropbox=’/path/to/public_html/some/folder’
mdldata=’/path/to/moodledata’
find ${dropbox} -type f -print | xargs /bin/rm -f
###Backup database###
mysqldump moodle_database -pPASSWORD > ${script-path}/${strDate}-moodle.sql
gzip ${script_path}/${strDate}-moodle.sql
###Backup userdata###
find ${mdldata} -type f -mtime -1 | xargs tar -czf ${script_path}/${strDate}-moodledata.tar.gz
###Encrypt and copy###
gpg -e -r ‘Frodo Baggins’ -o ${dropbox}/${strDate}-moodle.gpg ${c_scripts}/${strDate}-moodle.sql.gz
gpg -e -r ‘Frodo Baggins’ -o ${dropbox}/${strDate}-moodledata.gpg ${script_path}/${strDate}-moodledata.tar.gz
# Do some logging
filesize=`du -sh ${dropbox} | awk ‘{print $1}’`
strEnd=$(date +%r)
message=”${strDate}The script started at ${strStart} and finished at ${strEnd} and moved ${filesize} of data.\n”
echo -ne ${message} >> /path/to/public_html/log/folder/moodle.html
2. I run a nightly cron script on the offline intranet server to download the encrypted onlines files, decrypt them, and then update the local moodle database and data directory with the contents of the two files. A simple log is kept of the transaction.
script to follow…
Technical details
These are not requirements just a description of our current setup.
Moodle Online
- Host: hostgator.com (shell access requested from hostgator support)
- Moodle 1.94
Moodle Offline
- Hardware: Dual 533Mhz CPU, 1Gb RAM, 2 Network cards(legacy SIMS server)
- OS: VMware Esxi running Ubuntu JEOS virtual machine
- Moodle 1.94
A short rant…
On the topic of poor internet connectivity I think it is a shame that schools are falling behind in the race for faster broadband. In the past when home users were using dial-up networking schools were using ISDN lines. In the school I work 1200 pupils are sharing the same internet connection, one quarter of the speed of my home broadband!