Dan Poltawski's Blog

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:

  1. Configure your webserver to server all hosts from a single codebase directory
  2. 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’);
    

  3. 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).

Comments