Utah Tech Logo

IT3300

DevOps virtualization

Template VM

Instructions

We need to create a template vm that has our “application” files on it.

First, I would create a template of your basic install of your Ubuntu vm so you have it for later in case we need it.

On separate ubuntu virtual machines(clones of the above template), we will now install our application. After creating my clone, the first things I do are to change the hostname by editing /etc/hostname and change the ip address to make sure it is unique from my other clones in /etc/netplan/??? file. Then reboot. Once you have verified that your vm has come back up, you should be able to ssh to it (after connecting to the ssh server) and complete the remainder of the assignment.

Our application consist of a simple PHP application that has a MySQL database that supports it. The PHP application will be hosted by an Apache2 webserver. The database and web application will be installed on separate servers. The idea being that we may have to scale our web tier to meet demand. So, in the end we may have multiple instances of our web application accessing our database.

The installation files for the lab are here. I have recorded a quick video walkthrough here

Essentially you will need to do the following on an ubuntu vm:

Now you will need to install the database on a separate vm (that you have cloned from your template):

You must also configure mysql to accept external connections. Like this:

On your web vm:

Your config file will look something like this when done:

    $db_host = '144.38.204.88';
    $db_user = 'sally';
    $db_pass = 'foo123';
    $db_name = 'pokemondb';

Visit the webpage (i.e. http://ip/water/install.php) from a browser. See the README file in the application directory. You have to visit install.php. Make sure everything loads correctly!!

Hint: You can check if apache is running with sudo service apache2 status. You can restart it with sudo service apache2 restart.

After you have verified that things are loading correctly, you can now shutdown the web machine and create a template. Verify that when you clone the template, the website works.

You should leave your database vm running and NOT create a template of it.

Note Assuming your web template has been assigned a static ip address, if you clone multiple instances, they will all have the same IP. We would need to run a DHCP server to fix this.

So, create 3 clones of your web template and connect to each and manually change the ip to a unique address. Make sure all 3 will load. (Make sure that none are using the IP that the template originally had, this will make it easier when you pass off your assignment.)

To manually change your ip, you will edit /etc/netplan/00-installer-config.yaml, or some similar file.

To Pass off

In class: