Multi-tenant Moodle without the 2.2 feature
At LUNS, we designed, built and supported what I still believe to be one of the largest multi-moodle installations in the world. The installation ran from a single codebase and comes with many tough challenges, scaling supporting and upgrading 1000 Moodle installations and 270,000 users can be quite difficult! (I think I have guestimated doing about 8000 Moodle upgrades in my time so far ;-)).
But the question I most frequently get asked is how we achieved a 1000 Moodle install on a single codebase without modifying core Moodle code. This is the simplest part of the operation really and very straight forward to setup. I’ve promised a few people i’d blog about it so:
- Configure your webserver to server all hosts from a single codebase directory
- Create a config.php file which includes the individual site config depending on the host which is being served. e.g.
<?php
$moodle_host = $_SERVER['HTTP_HOST'];
require_once('/etc/moodles/'.$moodle_host.'_config.php');
- Populate individual Moodle config files with site specific config as you would any other Moodle site
Thats it!
Moodle HQ are currently working on a new core Multitenancy feature, which might provide a different approach for some institutions (although i’m still not entirely clear on its use case over an approach like this).