I wonder if it possible to run multiples moodle sites (different URL's) sharing one installation/one database. If it is possible, are there official docs about that and where ?
Thanks a lot.
You have to have multiple databases... well, you can have one database with multiple sites having different table prefixes. It's a maintenance nightmare unless you *really* only have access to one database.
There are some solutions for running multiple sites from a common code base but I really don't see the point. It's adding complexity for no great benefit. Just build separate sites.
The benefice is easier source code maintenance. We need 5 moodles, one for each of our departments and I don't plan to do 5 updates when new versions appear.
I'd like to share the source code. Is there a way ?
Why? I don't see the problem.
mv moodle1 moodle1_save
cp -R /my/new/moodle moodle1
cp moodle1_save/config.php moodle1
php moodle1/admin/cli/upgrade.php
OR... if you have done it using Git then
cp /path/to/moodle1
git pull
php admin/cli/upgrade.php
Repeat 5 times. The bad bit is taking the backups (not shown) and waiting for the upgrade script to complete. That's unavoidable. Why do you think having a common code base makes that simpler? Versus some weird setup that needs lots of testing and might break horribly (it'll probably also make the command line scripts not work at all).
If one installs the 5 sites using git, upgrades/updates are very easy with a script (assuming Linux here). Here's one that is used:
#!/bin/bash
#
for i in `cat /usr/local/bin/moodle2s.txt`
do
echo "Site in que: $i";
cd /var/www/html/$i;
pwd;
php admin/cli/cron.php;
git pull;
chown apache:apache * -R;
php admin/cli/upgrade.php --non-interactive;
echo '***** NEXT site. *****';
done
echo 'Done!';
The referenced 'moodle2s.txt' file is a simple listing of the Moodles (one line each) to upgrade.
Looks like:
moodle1
moodle2
moodle3
Done in a matter of minutes.
One could make it better by running a site backup ... code directory, data directory, and a mysqldump ... just before the upgrade process.
Have one site with 15 version 2 instances that can be updated in an hour including backups. Most of that time spent watching the screen! ;)
Makes no difference if one site wants to use an addon that other sites don't want.
'spirit of sharing', Ken
I hope you don't mind me asking why you think you need a separate moodle installation for each department. What are you really trying to achieve that you can't do with one moodle installation?
You might be able to minimize your own headaches with one install.
I work on something I've been requested to do so I don"t really have my own opinion about the project. I almost don't know moodle yet.I work for an administration entity, having 5 subentities. I've been requested to create a "multi-site" install, in order to have 5 different URL's and to not mix all the datas (user rights,...) in the same install. If it's possible to do that with a classical install, it's ok but I don't know how.
Sounds like 5 installs will be easier then. That guarantees it's all separate.
Yes but if one config is the same in the 5 and it has to be changed, it has to be changed 5 times, and so on. Everything 5 times.
I've nothing else to add to what has been said above. There have been 'solutions' that allow a single code-base but they involve hacks I am suggesting you don't want. If you don't believe me it is up to you
Remember, you HAVE to have 5 databases and 5 file-upload (moodledata) areas. If you do an upgrade you HAVE to run the upgrade script 5 times. Maintaing the code is the trivial bit.
If the goal (as stated in the original post) is to have one database, and if the definition of "database" is extended to include the one moodledata folder, then I have a hard time seeing the need for 5 installs of the core moodle, unless each install requires a dramatically different theme or frontpage. If what is needed is 5 different domains (for whatever reason), couldn't each domain simply redirect to the one install of moodle?
I am just providing some ideas for thought.
The goal is to have 5 distinct domains/Url's for 5 different independant structures, with an easy maintenance because I'll have the pleasure to do it. The 5 domains will certainly be similar concerning configuration, so if an extension is used by one, certainly others will require it also so I want to avoid 5 operations each time.
Could it be solved using workspaces ? One workspace by structure/URL ?
Okay, then I think you are back to following the advice of Howard and Ken.
An analogy of what I hear you saying is "I want to have 5 PC running MS Word and I want all versions of Word to be identical." Actually, with moodle, (via help from Ken's post), it should be easier with Moodle.
The core moodle is core. Pay special attention to any add-in's that you might choose to use. Also, you will need to manage settings for each moodle install. I am not sure how I would do this (except via careful notes), but maybe Howard and Ken know a technique for doing this. I have not mastered the GIT technique, but maybe it will work for you. Moodle offers many settings to make your moodle be just what you want. When you change one setting on one moodle, you will probably need to do this 4 more times.
Good luck.
Here's the official info:
http://docs.moodle.org/dev/Multitenant_support
Best of luck! ;)
'spirit of sharing', Ken
I'm almost certain that isn't what he's talking about...
I gave a look at the multi tenant feature, I don't understand well what it is and the doc doesn't seem clear to me.
Did you follow this link?
https://en.wikipedia.org/wiki/Multitenancy
"Multitenancy refers to a principle in software architecture where a single instance of the software runs on a server, serving multiple client organizations (tenants)."
Ok, maybe it's just me, but from what you originally described of the 'goal', it's pretty close. But, then again, I see you've posted yet another requirement ... that of Mahara ... and now stating your desires there as well.
So far all of this has been 'in a general sense'. Suggest mapping out *ALL that is required* first (specifically) [build a matrix - something like: http://www.cmsmatrix.org/], then looking at apps and their specific capabilities.
'spirit of sharing', Ken
I'm requested to install moodle+mahara for 5 entities.
I've read about multitenants but that's not explained enough for me.
Up to now I focus on moodle only, trying a solution given by Thomas van den Heuvel here:
https://moodle.org/mod/forum/discuss.php?d=13211
I also need to take into consideration that I'm requested to install mahara for each domain. So I'd like to not have 5 distinct maharas to maintain also. I don't know if I could have 5 moodle and a SSO with one mahara.
You might want to check out this post if you haven't already:
https://moodle.org/mod/forum/discuss.php?d=13211
Mahara has the concept of Institutions. You almost certainly only need one Mahara.
Hello Rect
It is possible integrate every moodle with mahara. In mahara create 1 institutions for every moodle. For more information on Moodle-mahara integration