Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Creating the backup will take approximately ……….. minutes.2 hours for 1.4TB

Restore EFS from Backup vaults

...

Make appropriate changes in HTTPD

...

We need to log into our ec2 instance. and then navigate into our httpd configuration for moodle

Code Block
cd /etc/httpd/conf.d
sudo vim 002-dev.courses.unic.ac.cy.conf

We have to make 2 changes. the Document Root and the Directory path. It needs to point into our new EFS that we mount.

Code Block
DocumentRoot /efstemp/[ actual path ]/moodle
<Directory "/efstemp/[ actual path ]/moodle">

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 backup config.php into configbackup.php just for safety measures.

We edit config.php and we make the relevant changes:

  1. we need to make sure the dbtype is the correct one in our case we have 'mariadb'

  2. dbhost,dbname,dbuser,dbpass need to be of the newly restored DB instance.

  3. wwwroot needs to change into the new URL eg https://dev.courses…

  4. dataroot need to point to newly restored EFS with a path to moodledata

  5. 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.

We then must go directly into Site administration → plugins → caching → configuration

Alternatively we can go directly with /cache/admin.php

in Configured store instances table we edit redis_all and on the server input we put the one we have for our cloned website. eg dev-courses[…]amazonaws.com

This is an important step as if it’s not configured then changes that are suppose to happen in cloned website will be done into the previous website because of redis caching.

Forbid Access to all users except selected ones

We want to avoid random users to log into the cloned website that’s why we edit moodle/login/index.php

In allowedUsers array we put the user id’s we want to have access. This code is entered right after the authenticate_user_login function

Code Block
languagephp
    $allowedUsers = [];
    if (FALSE == (in_array( $user->id, $allowedUsers ))){   
        die('Access Denied');
    }

Extra Steps (disable smtp and crons)

...