How Can I share the Data Root Folder amongst the multiple web instance of Moodle

How Can I share the Data Root Folder amongst the multiple web instance of Moodle

Kaushal Akoliya發表於
Number of replies: 14

HI,

I deployed the moodle on the Azure web app and the data root folder is in its home directory. 

Everything is working fine as of now.

Now I want to create another Azure web  app for moodle, But I want to share a common data root folder between two app, How Can I do that ? 

I tried with Azure file share, But it's not working. Is there any possible way to achieve this?




評比平均分數: -
In reply to Kaushal Akoliya

Re: How Can I share the Data Root Folder amongst the multiple web instance of Moodle

Howard Miller發表於
Core developers的相片 Documentation writers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片
I don't use Azure, but both instances "just" need to 'see' the same moodledata folder. It doesn't really matter how you do it as long as they both have read/write access to the folder.

Note that you are adding complication that you might not need. For example, if you get that to work you're probably also going to have to add a cache (e.g. Redis) to get acceptable performance.
In reply to Howard Miller

Re: How Can I share the Data Root Folder amongst the multiple web instance of Moodle

Kaushal Akoliya發表於
Is there any way to eliminate the dependent on moodledata director and we can store the data inside cache?
In reply to Kaushal Akoliya

Re: How Can I share the Data Root Folder amongst the multiple web instance of Moodle

Ken Task發表於
Particularly helpful Moodlers的相片

Don't use Azure either ... but ... isn't Azure a virtualization platform on Windows?   This first instance you have of moodle code ... you say the moodledata directory there is inside the moodle code?

Question .. could someone/anyone browse the moodledata directory with a browser ... no login required?  LIke the unfortunate sites found by google:

https://www.google.com/search?client=firefox-b-1-d&q=moodledata+filedir

and by 'sharing' do you mean 2 moodle applications using same moodledata directory?

Don't think I've ever seen recommendations for that.

Always thought/read/heard that for each moodle code instance, a separate moodledata directory needed to be used.

'SoS', Ken


In reply to Ken Task

Re: How Can I share the Data Root Folder amongst the multiple web instance of Moodle

Kaushal Akoliya發表於
My Answers are inline


1. could someone/anyone browse the moodledata directory with a browser ... no login required? - NO, Users with login details should be able to browse the moodledata directory via browser.
2. by 'sharing' do you mean 2 moodle applications using the same moodledata directory? - Yes, 2 moodle applications should be able to use the same moodledata directory.
In reply to Kaushal Akoliya

Re: How Can I share the Data Root Folder amongst the multiple web instance of Moodle

Ken Task發表於
Particularly helpful Moodlers的相片

Maybe it's my mis-understanding, but ...

IF anyone (including an authenticated user in a Moodle who is not admin level in the moodle), can browse moodledata/filedir/ that's potential for a hacked site.  Takes a lot of 'work', but that authenticated student user who doesn't particularly have to have 'hacking skills', could acquire the admin users credentials and login as the admin level user.   Bad news!

For #2 ... one of the duties of a server admin (OS/Azure) would be to make site backups.   If moodle A is where the shared moodledata directory resides and moodle B needs to be backed up, better include the 'shared moodledata/filedir/ in moodle A.   If one had to restore from a site backup for moodle B and that instance had included the shared moodledata/filedir/ there is a chance that will mess up moodle A - depending upon usage of moodle A vs moodle B.   That too is not good!

All in all ... me thinks it's best to have separate moodledata per site.

You can, of course, try it ... best of luck to ya! 微笑

'SoS', Ken


In reply to Kaushal Akoliya

Re: How Can I share the Data Root Folder amongst the multiple web instance of Moodle

Steve MacLeod發表於
That's interesting, so Moodle can be installed on a machine, we can call it MoodleWeb1, the install process would force the DataDir to be on that computer, the database however could be on another computer though, for example, we can call this MoodleDB, and it should go no problem if the rights are set correctly I assume.

Then, to consider load balancing, let's assume we want to add a second webserver computer, and we can just call it MoodleWeb2, and this computer was also to be provisioned with Moodle and also use the share the same database computer on the MoodleDB and as the MoodleWeb1 computer, example, then the new webserver machine MoodleWeb2 when it is installing Moodle would need to create a moodle data (DataDir) folder on it's own hard drive and so we would have to manually edit the config.php file to reference the moodle data folder over on the MoodleWeb1 computer, through an NFS share or some other means?

This sounds like it could be a good way to add additional webservers for doing load balancing and yet using one shared moodledata (DataDir) folder and one shared database for all the webservers, is this correct and been shown to be workable?

Many Thanks
In reply to Steve MacLeod

Re: How Can I share the Data Root Folder amongst the multiple web instance of Moodle

Howard Miller發表於
Core developers的相片 Documentation writers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片
You can have as many web servers as you like but they all need to share the SAME database, file directory ("moodledata") and cache. Note that you ARE adding more complication that you may not need. Lots of large sites do exactly this. The site I manage has (slightly oversimplifying)...
- F5 load balancer
- 7 web servers (one dedicated to Cron)
- One Enterprise MySQL database (with backup)
- One NFS Server
- Several Redis servers for caches and sessions

It's something we've worked up to having acquired a lot of experience over the years.
評比平均分數:Useful (3)
In reply to Howard Miller

Re: How Can I share the Data Root Folder amongst the multiple web instance of Moodle

Steve MacLeod發表於
That sounds very useful, I tried to share a Moodledata folder by moving it off to another computer, using Windows Server 2019 machines, and the install script gave permissions errors trying to install using the Windows share for moodledata even though there were full rights granted. I also tried to manually edit the config.php to point to this share, then launching moodle, but it also gave similar permissions errors.

I was wondering if I had tried this using unix with NFS shares if it would have worked better, I realize the PHP is using permission checks more geared to the unix style 0777 type of rights, perhaps that does not translate as well with windows shares, and would work better with NFS shares, does that sound reasonable to you?
In reply to Steve MacLeod

Re: How Can I share the Data Root Folder amongst the multiple web instance of Moodle

Howard Miller發表於
Core developers的相片 Documentation writers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片
I know nothing whatever about Windows.

Bottom line, however you share the moodledata folder whatever php / the web server is running as needs read and write permissions. That's not really a Moodle issue. Also, I very much doubt if PHP knows or cares where the data actually lives.
In reply to Steve MacLeod

Re: How Can I share the Data Root Folder amongst the multiple web instance of Moodle

Visvanath Ratnaweera發表於
Particularly helpful Moodlers的相片 Translators的相片
There is a doc page in the Moodle Docs called https://docs.moodle.org/en/Server_cluster, but in my opinion gives false hopes: It does not teach you how to build a server cluster, rather how to install/run Moodle on an existing web cluster. In other words, you have to know some kind of web cluster technology. Basically what Howard hinted here. Without that, we see people here who double their server resources to halve its capacity.
眨眼

In theory, the topic belongs to the Hardware and performance forum. I don't see many cluster related support in that forum, may be the cluster experts have migrated to the A new "Large scale Moodle deployment" support group.
評比平均分數:Useful (2)
In reply to Visvanath Ratnaweera

Re: How Can I share the Data Root Folder amongst the multiple web instance of Moodle

Howard Miller發表於
Core developers的相片 Documentation writers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片
On one level our "cluster" is just a bunch of Oracle Linux VMs. On the other hand, if weird stuff happens (and it will) then you *really* have to know your stuff because there's all sorts of factors that you simply don't have if you just stick Moodle on one box.

Plus, we have some extremely comprehensive monitoring - both off the shelf and very custom - to keep an eye on it all.
評比平均分數:Useful (1)
In reply to Ken Task

Re: How Can I share the Data Root Folder amongst the multiple web instance of Moodle

Howard Miller發表於
Core developers的相片 Documentation writers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片
I assumed he meant that he wanted to "load balance" Moodle rather than have two entirely separate instances. However, I could be wrong.

Azure isn't just windows - you can have Linux instances and all sorts of strange things.
In reply to Howard Miller

Re: How Can I share the Data Root Folder amongst the multiple web instance of Moodle

Visvanath Ratnaweera發表於
Particularly helpful Moodlers的相片 Translators的相片
_Azure_ is a branded name by Microsoft (provided you pronounce it properly). Their official page suggests it to be just another virtualization technology: https://azure.microsoft.com/en-us/services/virtual-machines/. For the enterprise it is the "cloud", apparently on equal footing with the Amazon AWS: https://slashdot.org/story/22/03/10/0124244/azure-pulls-in-front-of-aws-in-public-cloud-adoption.