One Moodle tree and several Moodle database?

One Moodle tree and several Moodle database?

by Hélène Bouley -
Number of replies: 5
Who did it with 1.6?
The Moodle success is so big than the idea of using several Moodle Instances to meet different needs was a good idea at the beginning but it can't be a solution for ever. (update , memory usage etc ..)
So we are looking to install one Moodle tree that can speak to several Moodle instance using apache rewrite to rewrite the url and accessing the good parameters.

Thanks in advance,

Hélène
Average of ratings: -
In reply to Hélène Bouley

Re: One Moodle tree and several Moodle database?

by Maik Riecken -

Hi Helene,

That's no problem and you won't even need mod_rewrite. I've realised this using lighty (apache needs to much memory...). But you'll need some knowledge about server config and the setup is not so easy to be explained within this forum with few words.

I'm looking forward to present some screenshots during the next two weeks. It could be a nice little project. Fellows are welcome to improve the script(s) and to documentate them. There also is a need for a gui.

At the moment my solution is able to:

  • create new instances under a subdomain
  • delete these instances (but backuping them before)
  • lock instances (shut down)
  • unlock instances
  • backup instances web accessible to /backupdir of main course
  • doing a fulltext search in moodledata dir (under development)

But a little patience is needed (three weeks) ...

Regards,

Maik

In reply to Maik Riecken

Re: One Moodle tree and several Moodle database?

by Hélène Bouley -
good could you just give us some ideas. Right now, we are thinking about how to do it ; we are speaking mysql, php, moodle fluently so with little I think we should be able to understand.
In reply to Hélène Bouley

Re: One Moodle tree and several Moodle database?

by Maik Riecken -
Hi,

Several instances you con realize by symlinks instead of real files/directories. You will need a dynamic config.php which grabs it's settings from the HTTP-request. Then you'll have to deactivate moodle's realpath-checks.

This is for the PHP/apache side. Quite a few things to do:

* write an include file for httpd.conf (update, write, delete entries)
* generate a cronjob-file (update, write, delete entries)
* manage MySQL/your database (create, delete, setting permissions)
* manage /moodledata-dirs (create, delete, update, setting permissions)

PHP is inadequate for this in my opinion... Shellscripts or perl could do better... Think about using sudo for the administrative tasks which require extended permissions.

regards,

Maik
In reply to Maik Riecken

Re: One Moodle tree and several Moodle database?

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Several instances you con realize by symlinks instead of real files/directories. You will need a dynamic config.php which grabs it's settings from the HTTP-request. Then you'll have to deactivate moodle's realpath-checks.

If you are using Linux with a kernel equal to or greater than 2.4.0 (most probably) you can use 'bind mounts' instead of symlinks, and moodle's realpatch-checks won't fail (so you won't need to deactive them).

Say you have you moodle master copy at /var/www/mymoodle and want a second installation under /var/www/myothermoodle (but using the same original files). You can:
 mkdir /var/www/myothermoodle
 mount --bind /var/www/mymoodle /var/www/myothermoodle
and you are done. Just to check realpath doesn't notice, execute:
 cd /var/www/myothermoodle
 realpath config.php
and it'll show /var/www/myothermoodle/config.php. If you had used symlinks for the new installation, it would have shown /var/www/mymoodle/config.php

(footnote: if you are using other mount points inside /var/www/mymoodle then you'll need to using --rbind insted of --bind; see the mount(8) manual page for additional details).

Saludos. Iñaki.

In reply to Iñaki Arenaza

Re: One Moodle tree and several Moodle database?

by Maik Riecken -

Hi Inaki!

Life is frequent learning und linux makes everything possible you couldn't even think of.

Thanks, Inaki. The "mount" idea is interesting (no code changes necessary in /admin/index.php - big hand...) - though it interferes with some of my other intended features, but this will take only one or two nights further thinking...

regards,

Maik