Skip to content

Step 17: DevOps tooling website solution

monotiller edited this page Jul 1, 2022 · 1 revision

Prepare NFS server

Firstly I spun up an EC2 instance running Red Hat Enterprise Linux 8 and created 3 volumes that I attached to that instance. I ssh'd into the instance and ran gdisk on each of the new volumes as I did in project 6. Following the instructions as before I created three logical volumes and assigned them to the relevant mount points:

NFS server was then installed and checked that it us running

I then checked the IP of my subnet

I then set up the permissions needed to allow the web servers to read, write and execute on NFS:

sudo chown -R nobody: /mnt/apps
sudo chown -R nobody: /mnt/logs
sudo chown -R nobody: /mnt/opt

sudo chmod -R 777 /mnt/apps
sudo chmod -R 777 /mnt/logs
sudo chmod -R 777 /mnt/opt

sudo systemctl restart nfs-server.service

And then mapped the subnet CIDR:

/mnt/apps 172.31.16.0/20(rw,sync,no_all_squash,no_root_squash)
/mnt/logs 172.31.16.0/20(rw,sync,no_all_squash,no_root_squash)
/mnt/opt 172.31.16.0/20(rw,sync,no_all_squash,no_root_squash)

sudo exportfs -arv

I then ran rpcinfo -p | grep nfs to get the ports I needed:

Along with TCP 111, UDP 111, UDP 2049 that I will add to the inbound rules of the security group

Configure the database server

Then I set up a DB server with the databases tooling and webaccess:

And I then also modified the inbound rules to accept connections from the subnet cidr:

A new instance was then setup ready for setting up the stateless part of our project and nfs was installed, I then mounted the NFS server's export for apps:

sudo mount -t nfs -o rw,nosuid 172.31.20.77:/mnt/apps /var/www

Which then appeared when df -h was run:

So this was added to fstab. Remi was then installed

This was then repeated with 2 more servers

I then verified that the folders appeared in all 4 locations:

I repeated the same for the logs folder too:

sudo mount -t nfs -o rw,nosuid 172.31.20.77:/mnt/logs /var/log

I then installed git and cloned the tooling repo from the darey-io github account to the

mysql -h 172.31.25.132 -u nfs -p pass < tooling-db.sql

There does seem to be a problem however, it keeps saying that there is no database selected. The schema has changed recently so the command I needed was:

mysql -u nfs -p --database=tooling -h 172.31.25.132 < tooling-db.sql

After a bit more tinkering I was able to get the home page to display: