Versions Compared

Key

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

...

The steps to mount the EFS are:

  1. create a directory also called as mount point on which we will mount the efs

    1. Code Block
      sudo mkdir efstemp
  2. create a mount target in order to allow ec2 instance to mount the efs. In EFS we select the file system we want to mount and then we go into Network tab. We then select the Manage button in order to create a mount target. After we finish this step we should be able to see a DNS name set to our EFS we want to use.

  3. In EFS dashboard we select the EFS that we have restored and we navigate into another page

  4. we select Attach we chose the option Mount via DNS

  5. Using the NFS client we select the appropriate command on which we paste into our EC2 console.

  6. example of command

...

After using the command the EFS should be attached into our instance and ready to be used right away.

In case the EFS does not mount probably we need to change the subnet ID of the instance.

Some additional commands:

...

Code Block
sudo mount -fav

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 appropriate changes in HTTPD

...

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

First Sign in

Inside config.php we need to include alternate url so that it won’t navigate into the previous website.

Code Block
$CFG->alternateloginurl="https://dev.courses.unic.ac.cy/pages/login.php";

After signing in we comment out the $CFG->alternateurl and we go into the Manage authentication page in moodle. We search for Alternate login URL and we set there the URL we want the website to have. This is so the alternate url to be saved into the database.

Make sure Redis cache is correct in Moodle application

...

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

...

specific ones

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

...

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

Configure AWS EC2 services

All these changes will be implemented only to the instance that we will be working on until the clone is finished. After we finish we need to take an AMI of the instance we worked with. In load Balancers we need to update the target group and also in Auto Scaling we need to set a new version for Launch template in order to use the latest AMI.

Extra Steps (SMTP, CRONS, Alternate login URL)

...