moodle architecture esp with multitier installation - Moodle Folder

moodle architecture esp with multitier installation - Moodle Folder

by Tawfik Daim -
Number of replies: 7
Hello
I have been struggling with multiple installations over last couple of weeks, I started with all on one box running on my ubuntu VM up to AWS load balanced Web Servers pointing to a mySQL RDS...now I'm trying to move to a more modular architecture but I need help to strengthen my understanding and correct me where I might have got things wrong.


My plan now is to:
- install 2 Web Server with load-balancer on Azure  (ideally be able to add more if I need)
- Shared storage on Azure to host moodledata directory for all Web Serves
- One relatively bigger VM to host mySQL database (I read somewhere that its very difficult to have a cluster of databases so I'm sticking with a singly point of failure here)

I plan to have the deployment done by using CLI...so for example teh statement to create the web servers would be similar to below :

======

for i in `seq 1 2`; do

az vm create

     --resource-group Madrasa \     --name WebApp$i \

    --availability-set myAvailabilitySet \     --size Standard_DS1_v2  \

     --image Canonical:UbuntuServer:16.04-LTS:latest\

     --admin-username azureuser\     --generate-ssh-keys \
     --no-wait

done

=====


My biggest challenge now is to confirm what do I need to do with moodle folder (not moodledata),

what does moodle folder really have, is it dynamic data or static data? in other words will the files in moodle folder change with user interactions with the site liek adding courses, taking quizez....etc or its only changed with customization and adding plugins........the answer to this question will help me figure out one of the below options:

1. have a copy of moodle folder o local disk in every VM acting as a web server (but in this case if I did further customization will I need to recopy the changes to all VMs local disks?)

2. have a shared copy of moodle folder on same shared disk as moodeldata 



Can some one please explain what is moodle folder is really about - thanks

Average of ratings: -
In reply to Tawfik Daim

Re: moodle architecture esp with multitier installation - Moodle Folder

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Moving to Hardware and performance forum...

In reply to Tawfik Daim

Re: moodle architecture esp with multitier installation - Moodle Folder

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

The files in the moodle program folder do NOT change. I would have separate copies on each server as shared folders can have some performance issues. 

In reply to Howard Miller

Re: moodle architecture esp with multitier installation - Moodle Folder

by Tawfik Daim -

Hello guys

As I'm moving forward with my objective to build a scalable moodle architecture on cloud (now AWS),

I'm sharing my status as well as my recent challenge which would appreciate if anyone can give any tips here.


1. I have now an RDS instance with mysql on Amazon 

2. common shared EFS

3. I have 3 instances for apache web servers organized into Elastic load balancer, started with identical 2 and then added a third one with a create similar procedure followed by few simple lines to install apache and other important services.

Each of the instances is mounted to same EFS (which is designed to host moodledata folder), and each instance has its own Moodle folder

4. when testing the load balancer (before installing moodle) with a simple html, I verified each instance is accesible alone and also the load balancer is accesible and is sharing load on the 3 instances


So far all good, but not exactly everything I wanted to do, so next step I followed moodle (3.3.2 version) installation on one of the instances by point to http:IP.of.Server/moodle and followed the moodle installation (despite having some issues connecting to mysql on RDS related to setting parameter like barracuda and innodb but eventually it worked fine) and now I had one of the instances serving a new moodle setup


Here comes my challenge ......

how can I replicate the same moodle instance to the other 2 instances without going through the full setup again?

1. I copied the full moodle folder to all thre isntances (including config.php)

2. I changed the $CFG->wwwroot   = 'http://18.194.124.125/moodle'; at each server to point at its own puplic IP (my full config.php is shared below for reference.


Still the other two instances only show white screen when I point to Server.IP/moodle at any of each but they are still able to serve the simple html file host in html folder,


What I can't figure out is what does moodle setup actually do to each server other than modifying moodle folder and config.php.......the answer to this question is vital for me to understand how to have a laod balancer with flexibility to add more instances to moodle when needed.



Many thanks for any help.

Tawfik





=======Copy of my config.php========

<?php  // Moodle configuration file

unset($CFG);
global $CFG;
$CFG = new stdClass();

$CFG->dbtype    = 'mysqli';
$CFG->dblibrary = 'native';
#$CFG->dbhost    = 'moodledb2.chsey8irolqy.eu-central-1.rds.amazonaws.com';
$CFG->dbhost    = 'moodle.chsey8irolqy.eu-central-1.rds.amazonaws.com';
$CFG->dbname    = 'moodle';
$CFG->dbuser    = 'tawfik';
$CFG->dbpass    = 'Newipad1!';
$CFG->prefix    = 'mdl_';
$CFG->dboptions = array (
  'dbpersist' => 0,
  'dbport' => 3306,
  'dbsocket' => '',
  'dbcollation' => 'utf8mb4_general_ci',
);

$CFG->wwwroot   = 'http://18.194.124.125/moodle';
#$CFG->wwwroot   = 'https://madrasalb-1338112885.eu-central-1.elb.amazonaws.com/moodle';
$CFG->dataroot  = '/home/ubuntu/moodledata';
$CFG->admin     = 'admin';

$CFG->directorypermissions = 0777;

require_once(__DIR__ . '/lib/setup.php');

// There is no php closing tag in this file,
// it is intentional because it prevents trailing whitespace problems!




In reply to Tawfik Daim

Re: moodle architecture esp with multitier installation - Moodle Folder

by Mathew Gancarz -
Picture of Core developers

Check the httpd/apache error logs from your web server. They will give you a clue as to what is wrong.

Moodle doesn't do anything server specific in installation. All the database stored information can be just copied between different web servers with different IPs without changing anything (as long as that server can access the database.. are you sure it can?). So as long as things are configured correctly, you can copy moodle files between servers, just changing the configuration files in the way you have.

Also, you just posted your database password publicly! wide eyes I'd change that immediately if I were you, since anyone can now log into your database and pull/change data, unless you have some other security setup to limit that. Either way, I'd change it ASAP smile 



In reply to Mathew Gancarz

Re: moodle architecture esp with multitier installation - Moodle Folder

by Tawfik Daim -
Thanks for pointing the password thing, its embarrassing how I shared the password under pressure smile
anyhow its just a test environment with Amazon that I actually rebuild every day so I will not use this password again of course.

For the load-balance I was able to find the issue with the added instance to be a missing one package (so a comand sudo apt-get install -y php-mysql) fixed it. Now I will do another instance to make sure the process is all through then will close for the day and destroy the whole setup and rebuild tomorrow.

Next step is to configure SSL and them memcached with performance tuning.
In reply to Tawfik Daim

Re: moodle architecture esp with multitier installation - Moodle Folder

by Michael Penney -

What I do is:

1. Start with one server (one ec2), get it working with the ELB/EFS/Memcache, RDS, etc. 

2. Make an image of that server (which clones the settings of the first server)

3. Spin up the resulting AMI, make it live, and then bring it into the ELB

In reply to Tawfik Daim

Re: moodle architecture esp with multitier installation - Moodle Folder

by Chris Fryer -
  1. I changed the $CFG->wwwroot = 'http://18.194.124.125/moodle'; at each server to point at its own puplic IP

You don't want to do this. You want $CFG->wwwroot to be the DNS name of the Load Balancer. All user traffic will come in to the load balancer and be distributed to one of the three application servers.

You'll want to set up some kind of shared session storage mechanism. AWS Elasticache will work.