A guide on how to clone moole Moodle into another instance. We take into account that all backups for RDS, EFS and AMI’s for EC2 instances are already set up.
...
We either take a new snapshot or we go into already created snapsots snapshots and restore the latest.
Steps in order to take a new snapshot.
...
Select the EFS we want to restore
Actions → Restore
We can select Full restore if we want the whole EFS or item-level restore if we want a specific directory from the efsEFS.
Restore to a new file system.
Restore role → Default role
Restore backup
...
We assume that our instances already have the nescessary phpnecessary PHP, apache, packages installed.
...
In EFS dashboard we select the efs EFS that we have restored and we navigate into anoter another page
we select Attach we chose the option Mount via DNS
Using the NFS client we select the appropriate command on which we paste into our EC2 console.
example of command
...
Code Block |
---|
sudo vi /etc/fstab fs-......:/ /efs nfs defaults,_netdev 0 0 |
3. Check efs EFS mounted successfully
Code Block |
---|
sudo mount -fav |
...
We need to log into our ec2 instance. and then navigate into our httpd configuration for moodleMoodle
Code Block |
---|
cd /etc/httpd/conf.d sudo vim 002-dev.courses.unic.ac.cy.conf |
...
Go through the file and make sure we didn’t forget to use the path anywhere else.
Make appropriate changes in
...
Moodle config
We navigate to /efstemp/..../moodle
...
we need to make sure the dbtype is the correct one in our case we have 'mariadb'
dbhost,dbname,dbuser,dbpass need to be of the newly restored DB instance.
wwwroot needs to change into the new URL eg https://dev.courses…
dataroot need to point to newly restored EFS with a path to moodledata
session_redis_host need to have the name of the redis for our application
Make sure Redis cache is correct in
...
Moodle application
Right after we finish cloning we need to log in into the website.
...