Multiple moodles on one server

Multiple moodles on one server

by walter waldner -
Number of replies: 31

We started to use moodle at our school (technical colleg) successfully and are very happy. The server is operating Windows 2003 server.

I would like to install several moodles one one server to give some teachers admin privileges on these different moodle installations (to enable them to control user activation).

Is it possible and save to proceed like that ?

(1) copy the moodle directory (with the php scripts) to moodle1, moodle2 and so on
(2) edit the config file appropriately
(3) different moodle-databases in mysql for each of these installed versions

My major question now is: what to do with cron ? Is there a special function with support for such multi-moodle-installations ?

Thank you in advance for your help

Walter Waldner, Austria

Average of ratings: -
In reply to walter waldner

Re: Multiple moodles on one server

by Lev Abramov -

Walter,

from the top of the peak of my ignorance smile it looks like there is no problem with multiple installations as regards cron:

your installations will have different names/locations (moodle/moodle1/moodle2 etc), so for each one you will have to configure a separate cron job according to the location of the cron.php file of each one.

What I cannot figure out, though, is how to make sure the databases don't get entangled. And honestly, I would really like to know the answer to this one...

Anyone?

Lev

In reply to walter waldner

Re: Multiple moodles on one server

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I have four different Moodle's on the same server. Simply set up a different database for each one and keep each Moodle in its own directory tree.

The cron will simply have a line for each Moodle instance. they will all be different because it just uses wget so the url will have a different path.

If you're still not sure let me know, and I will do what I can to help.
In reply to Howard Miller

Re: Multiple moodles on one server

by John Gone -
Or change your table prefix in each config.php file.
example: mda ; mdb ; mdc and so on. I've run 3 Moodles in one MySQL database with no problems at all.
In reply to walter waldner

Re: Multiple moodles on one server

by Thomas Robb -
While it might not be of immediate help, if the sole reason for setting up multiple moodles to allow differentiation of user activation privleges, then perhaps in the long run what is needed is a new user type below the super-user admin who has full control of only those courses specified by the admin.
In reply to Thomas Robb

Re: Multiple moodles on one server

by walter waldner -

Thomas, you point at a very import issue. I think that the user administration should be changed in moodle (I read there will be changes in version 1.2) .

I teach several classes in my school. Each of these classes is one course in moodle. And so do some other teachers. A teacher should me able to add, edit and administrate user accounts of the students in their classes (courses). With moodle 1.1 this can only be done by the administrator (that's me).

So I agree with your idea to have a new user type. This "course-admin" should be able to controll all user accounts enroled in their courses.

In reply to walter waldner

Re: Multiple moodles on one server

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Not true. Teachers CAN have full control over their own classes (and always have). In 1.1 they can also add/remove students manually, and if they are assigned as course creators they can even create new courses for themselves. 1.1 also added a distinction for editing and non-editing teachers - so check you have asigned editing rights to your teachers (it's a column that shows when you assign teachers).

As for editing actual user accounts, why would a teacher want to do that? Either hook it up to an external system (eg mailserver) or let the users themselves look after it.

I don't think you have any need for multiple Moodles. One college I know is running 3700 courses on a SINGLE copy of Moodle.

Once you start splitting things up you'll increase the load on teachers and confuse students with multiple accounts.
In reply to Martin Dougiamas

Re: Multiple moodles on one server

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
As we drift off topic a bit..

An interesting point. We have multiple moodles because they serve different faculties in a University. They want different look and feels and even want custom language packs to fit in with their nomenclature. This is what happens when course leaders find out that we can customise the code!

I don't think Moodle is far away from being able to do this as you say, but we would need a "simple" logon screen and then some concept of user groupings each with its own custom look and feel.

I probably haven't thought this through that well!
In reply to Howard Miller

Re: Multiple moodles on one server

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Ah, OK, that makes sense, I guess. Of course the license fees are multiplied by four. wink wink

In some distant future it would be nice to have one copy of the code powering an arbitrary number of virtual sites.

Drifting ever away off topic ... Moodle 2.0 themes will allow the possibility of users and teachers choosing/modifying their own style sheets for the course or for everything.
In reply to Martin Dougiamas

Re: Multiple moodles (was: on one server)

by Lev Abramov -

Martin,

I can point at at least one instance of having to keep two installations: if I need to deploy multiple courses, some of which are in a "normal' LTR (left-to-right) language, while others are in RTL languages like Arabic or Hebrew. In its current reincarnation, Moodle handles LTR/RTL globally.

Ideally, it should be defined at course level - then I could still remain with one installation.

Any plans to change language direction settings so as to make them course-specific instead of global? Can you put it at the very bottom of the "to-do" list so that one day in the future...etc.?

Lev

In reply to Lev Abramov

Re: Multiple moodles (was: on one server)

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Actually, this should really be in the language pack. I did have some reason for making it a site setting back in antiquity ... I think it was so people flipping through the menu wouldn't be disoriented, but ...

It's a trivial fix - I've just made it.
In reply to Martin Dougiamas

Re: Multiple moodles on one server

by Terri Teacher -

Ger: One reason to have two Moodles:

  • one stable release for running classes
  • one cvs version for testing and preparing the use of the next stable release
In reply to Terri Teacher

Re: Multiple moodles on one server

by Timothy Takemoto -

The same, as what you said, Bill is what is going on at my server. We have an educational moodle for students and teachers and another for developers. It would not be feasable to have the developers moodle as a course on the education one since changes that are made in the course of development would impact on the learning environment (now in use).

Joji Kariya has cured the mutiple moodle cookie clash problem using the fix he suggests here (putting some extra variables in the config.php. I have asked him to send relevant sections of the config.phps). 
http://moodle.org/mod/forum/discuss.php?d=2901
Tim

In reply to walter waldner

Re: Multiple moodles on one server with soft links?

by Thomas Robb -
I'm wondering if it is really necessary to set up multiple complete moodle directories if one wants to have multiple Moodles on one server. Surely, a separate data directory and configuration file is needed, but if all the rest is the same, could one create a new Moodle folder with only a config.php file and have soft links pointing to all of the other files and directories in the folder than contains the whole shooting match?
In reply to Thomas Robb

Re: Multiple moodles on one server with soft links?

by Lev Abramov -

This actually sounds like a very good question - Martin, could you plz give it a thought and answer it when you have a minute? The more economical the solution is, the better, of course.

Could it just be one file - config1.php - sitting right next to the original config.php ?

Lev

In reply to Lev Abramov

Re: Multiple moodles on one server with soft links?

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
No, there is no way to do this currently with the current code, because all files call config.php.

Some changes to make Moodle multi-site aware would involve:

- separating the configuration variables from config.php (something I want to do anyway for a more automated installation sequence).

- adding some kind of environment variable that config.php uses to choose from various sets of actual configurations.

- modifying the upgrade procedures so that each database is updated when the code is updated.
In reply to Martin Dougiamas

Re: Multiple moodles on one server with soft links?

by Thomas Robb -
But, if there were multiple directories, each of which had a separate config.db file, even though the rest of the files in the directory were only softlinks, Moodle would still "see" the path as whatever path was used to initially access it, and would therefore look in the correct directory for the config file, wouldn't it?
In reply to Martin Dougiamas

Re: Multiple moodles on one server with soft links?

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Actually, just re-read Thomas' message and yes, I think it WOULD work if you had soft links to each individual item in the Moodle directory from the shadow directory. ie

admin
auth
backup
course
doc
error
file.php
files
help.php
index.php
lang
lib
login
mod
pix
theme
user
userpix
version.php

Of course, these are subject to change, so you'd need to check things carefully every time you upgraded.
In reply to Martin Dougiamas

Re: Multiple moodles on one server with soft links?

by Thomas Robb -
Sorry to say, it doesn't work. I had to put a real index.php file in the shadow directory, as well, in order to get it to start working, but when I click on "courses" it says something like "Sorry, I can't find this course." It then reverts to the Moodle site based on config.db in the real directory.

It seems that the PHP scripts are sensing the *real* physical directory rather than the one initially accessed, counter to my expectations.

I guess we need to wait for Martin to get around to developing a real programmic means of switching configs.
In reply to Thomas Robb

Re: Multiple moodles on one server with soft links?

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Wierd ... how about hard links?

Wow, Moodle is only 35 megs unpacked (half of that is language files). wink
In reply to Martin Dougiamas

Re: Multiple moodles on one server with soft links?

by Thomas Robb -
Apparently hard links only work with actual files, not directories, so that makes this strategy unfeasible.

Yes, once Moodle is installed, if the unnecessary language files (for my particular implementation) are removed, then the foot print is rather small,. However, when I tried to create an additional directory on my rental server, the CVS upload aborted half-way through because I had run out of space. This is why I'm trying to find a way to reduce the size for additional instances on the same server.
In reply to Martin Dougiamas

Language files size (was: Multiple moodles on one server with soft links)

by Lev Abramov -

Talking of the language files.

Suppose I do not need to provide the interface language choice. Disabling it in the site settings has been easy, but the language files still take up a lot of HD space.

1. Can I physically remove all or most part of the language folder(s) to save some space?

2. what other changes would I have to make?

3. has anyone actually done this, and what was the overall behavior?

Thx -

Lev

 

In reply to Lev Abramov

Re: Language files size (was: Multiple moodles on one server with soft links)

by John Gone -
I always remove un-necessary languages and themes before uploading, no problems.
In reply to John Gone

Re: Language files size (was: Multiple moodles on one server with soft links)

by Thomas Robb -
No problems? You make it sound like magic! As a mere mortal, the only thing that I have been able to do is to follow the download instructions in moodle.org to dowload the entire shooting match via CVS. blush

How does one go about removing unneeded languages before uploading? Could this info perhaps be added to the download help file?

I'd really appreciate it if you could share this information.
In reply to Thomas Robb

Re: Language files size (was: Multiple moodles on one server with soft links)

by John Gone -
Ummm, this answer assumes I understand the question.

I download the entire shooting match via CVS and I simply delete the un-necessary language and themes before uploading via FTP.
In reply to Thomas Robb

Re: Language files size (was: Multiple moodles on one server with soft links)

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Any directory under moodle/lang or moodle/theme can simply be deleted if you don't need them (EXCEPT moodle/lang/en!)
In reply to Martin Dougiamas

Re: Multiple moodles on one server with soft links?

by Greg Barnett -
It is fairly easy to add conditional logic to config.php. I'm currently having it look at $_SERVER['SERVER_NAME'] and setting $CFG->dbname and a few other variables. This allows the entire moodle directory to be symlinked in. You get a few errors and have to tweak a few moodle files to get it all to work.
In reply to Greg Barnett

Re: Multiple moodles on one server with soft links?

by Peter Bazira -
what you said just caught my attention (only 1 month lateshy.gif...) how would i go about adding the conditional logic to config.php..... i have no problem tweaking files but always treated config.php as sacred ... would you mail me a sample config.php ... i really need to create a second instance of moodle or at the very least work some conditional logic to allow moodle to switch automatically between http and https protocols
In reply to Peter Bazira

Re: Multiple moodles on one server with soft links?

by Williams Castillo -
Well... If it didn't caught your attention... it didn't caught mine either...

It's a great, great idea... I remember Martin started a topic some weeks ago about making moodle multi-site aware... And this is the answer, I think...

With it, the main config.php and setup.php files could be modular also... And based in the server name environment varible, we could have tons of config.php and setup and a subdirectory of, let's say, /domains/[domainname]/

And that's it...

Is it?

Will
In reply to Williams Castillo

Re: Multiple moodles on one server with soft links?

by Greg Barnett -
What might be a good idea is to include two more config-dist files with moodle.  One example config that shows how to setup moodle for multiple virtual hosts all symlinked in, and one example showing how to do the same, but with the various moodles being subdirectories on one host.
In reply to Peter Bazira

Re: Multiple moodles on one server with soft links?

by Greg Barnett -
It would be hard to come up with a general purpose config.php that would work for all situations, but here is a snippet with a bit more detail.  Which variables you will need to change will depend on your setup.  In your case, you may want to base the conditional logic based on whether they are connecting with HTTPS or HTTP.  Depending on which variables you change, you may also have to tweak setup.php

switch($_SERVER['SERVER_NAME']}:
    case 'moodle.com':
        $CFG->foo = 'bar';
        break;
    case 'moodle.org':
        $CFG->foo = 'baz';
        break;
     default:
        $CFG->foo = 'foo';
endswitch;