Nutanix .Next Hands On Lab Guide

Download as pdf or txt
Download as pdf or txt
You are on page 1of 20

NUTANIX .

NEXT HANDS ON LAB GUIDE

NUTANIX CALM

Linux Apache MySQL PHP (LAMP)


Linux Apache MySQL PHP (LAMP) Application Provisioning
1. Login into Prism Central portal http://192.168.1.5:9440

2. Login as user [email protected] (for example [email protected]) where xx is your


table ID.
3. Use password nutanix/4u .
4. Upon successful login, you will be presented with a landing page as follow.
5. Click on the upper-left icon from the current page and then click “Services >
Calm” . The Nutanix Calm main page will be opened.

6. Click on the icon to open Calm Blueprint page. Click the button to
upload a Blueprint template. Select “LAMP-HOL.json” file from local workstation
folder. Click Open to continue.
7. Upload Blueprint dialog displayed. Put a name for your new blueprint, for example
“LAMP-HOLxx” where xx is your table id. A project has been assigned to your user id.
Click “Upload” to continue.

8. New blueprint page will be displayed. We can see there are three services that will
be delivered such as MySQL database, Apache webserver with PHP, and HAPROXY
upon the successful deployment of the blueprint.

Follow the subsequent steps to modify current blueprint.

9. Click on the button to modify MySQL service. Click on the VM tab and scroll
down to the “Images” section.
10. Select “centos-image-hol” as the image and put 2 vCPU, 2 Cores per vCPU and 4 GiB
Memory as follow. Leave “Guest Customization” option unchecked.

11. Scroll down until you find “Network Adapters” section. Click on the “+” sign on
upper right corner. Select “Default” for the Subnets and leave “Static IP” blank.

12. Scroll up and click on the “Package” tab. Click on “Configure Install” button. Click on
the “PackageInstallTask” button under MySQL service. A new side panel on the right
will be displayed.
13. Click on the icon at the “Script” section to enlarge the script window. A larger
script window will be displayed.

14. Copy and paste the following script below the current two lines. It will be similar
with the image below.
sudo systemctl stop firewalld

sudo systemctl start mysqld

sudo systemctl enable mysqld

# -*- Mysql customization

password=$(grep -oP 'temporary password(.*): \K(\S+)' /var/log/mysqld.log)

mysqladmin --user=root --password="$password" password Nutanix/4u

mysql -u root --password="Nutanix/4u"<<-EOF

FLUSH PRIVILEGES;
EOF

Click on icon to return to main page.

15. Click on “Save” button to save changes. Ignore the error message for now.
16. Click on the button to modify Apache PHP service. Click on the VM tab and
scroll down to the “Images” section.

17. Select “centos-image-hol” as the image and put 2 vCPU, 2 Cores per vCPU and 4 GiB
Memory as follow. Leave “Guest Customization” option unchecked.

18. Scroll down until you find “Network Adapters” section. Click on the “+” sign on
upper right corner. Select “Default” for the Subnets and leave “Static IP” blank.
19. Scroll up and click on the “Package” tab. Click on “Configure Install” button. Click on
the “PackageInstallTask” button under Apache_PHP service. A new side panel on
the right will be displayed.

20. Click on the icon at the “Script” section to enlarge the script window. A larger
script window will be displayed.

21. Copy and paste the following script below the current two lines. It will be similar
with the image below.

echo "<IfModule mod_dir.c>


DirectoryIndex index.php index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>" | sudo tee /etc/httpd/conf.modules.d/dir.conf

echo "<?php
phpinfo();
?>" | sudo tee /var/www/html/info.php

sudo systemctl stop firewalld

sudo systemctl restart httpd

sudo systemctl enable httpd

Click on icon to return to main page.


22. Click on “Save” button to save changes. Ignore the error message for now.

23. Click on the button to modify HAPROXY service. Click on the VM tab and
scroll down to the “Images” section.

24. Select “centos-image-hol” as the image and put 2 vCPU, 2 Cores per vCPU and 4 GiB
Memory as follow. Leave “Guest Customization” option unchecked.
25. Scroll down until you find “Network Adapters” section. Click on the “+” sign on
upper right corner. Select “Default” for the Subnets and leave “Static IP” blank.

26. Scroll up and click on the “Package” tab. Click on “Configure Install” button. Click on
the “PackageInstallTask” button under HAPROXY service. A new side panel on the
right will be displayed.

27. Click on the icon at the “Script” section to enlarge the script window. A larger
script window will be displayed.
28. Copy and paste the following script below the current two lines. It will be similar
with the image below.
sudo systemctl stop firewalld
sudo setenforce 0
sudo sed -i 's/permissive/disabled/' /etc/sysconfig/selinux

port=80
#sudo yum update -y
#sudo yum install -y haproxy

echo "global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
maxconn 4096
quiet
user haproxy
group haproxy
defaults
log global
mode http
retries 3
timeout client 50s
timeout connect 5s
timeout server 50s
option dontlognull
option httplog
option redispatch
balance roundrobin
# Set up application listeners here.
listen stats 0.0.0.0:8080
mode http
log global
stats enable
stats hide-version
stats refresh 30s
stats show-node
stats uri /stats
listen admin
bind 127.0.0.1:22002
mode http
stats uri /
frontend http
maxconn 2000
bind 0.0.0.0:80
default_backend servers-http
backend servers-http" | sudo tee /etc/haproxy/haproxy.cfg

sudo sed -i 's/server host-/#server host-/g' /etc/haproxy/haproxy.cfg

hosts=$(echo "@@{APACHE_PHP.address}@@" | sed 's/^,//' | sed 's/,$//' | tr "," "\n")

for host in $hosts


do
echo " server host-${host} ${host}:${port} weight 1 maxconn 100 check" | sudo tee -a
/etc/haproxy/haproxy.cfg

done

sudo systemctl daemon-reload

sudo systemctl enable haproxy

sudo systemctl restart haproxy


Click on icon to return to main page.

29. Click on “Save” button to save changes. Ignore the error message for now.

30. Click on “Credentials” button on top of page.

31. Click on the “>” sign, and type nutanix/4u as the password.

32. Click on “Save” button to save changes, then click “Back” button to return to main
page.
33. Click on “Launch” button to start application deployment according to the blueprint.

34. Put a name for the application, for example demo-calm-holxx where xx is your table
id. Type Nutanix/4u on “MYSQL_PASSWORD” text box.

35. Click on “Credentials” tab, type nutanix/4u on “Password” text box. Click “Create”
button to start the application deployment.

36. Application deployment is started. You will be redirected to a new page.


37. Application provisioning is in progress. Further detailed provisioning progress can be
found on “Audit” tab. Upon a successful application provisioning, you will find
“SUCCESS” status on “Audit” tab and “RUNNING” status on “Overview” tab.
HAPROXY Configuration Testing
After the installation is done, you can test HAPROXY by opening a new tab on the web
browser and type http://haproxyIPAddress/info.php .

In summary, HAPROXY that we have configured and provisioned will provide load-balanced
access connectivity to Apache HTTP server.

To obtain HAPROXY service IP address, click on the “Services” tab, click HAPROXY box and
record the IP address on the right side panel.

To obtain APACHE_PHP services IP address, click on the “Services” tab, click APACHE_PHP
box and record the IP address on the right side panel.

Please note that there are two VMs associated with APACHE_PHP services. Hence there are
two IP addresses for this services.
Click on Virtual Infrastructure > VMs menu to view the virtual machines deployed on your
infrastructure.

Following is the result of HAPROXY access from web browser by accessing


http://192.168.1.54/info.php .
Scrolling down to “Apache Environment” information, we can find the IP address of Apache
Web Server as follow. By refreshing the web browser once, we got another IP address of
Apache Web Server.

This proves that HAPROXY load-balances the access to two Apache Web Servers.
Return to application page and click on “Services” tab. Click on MySQL services and click
“Open Terminal” on the right side panel. A new tab will be opened.

Login into MySQL by typing command “mysql -u root -p” and press enter. Enter Nutanix/4u
when prompted to enter the password. A successful login into MySQL using the above
password proves that the scripts entered during Calm Blueprint setup was working.

Additionally, access into the console was recorded by Calm for audit purposes when
needed.
Linux Apache MySQL PHP (LAMP) Application Deprovisioning
When the application is no longer accessed by the user, the application can be
deprovisioned or deleted from Calm. Follow the instructions below to delete the
application.

1. Click on “Manage” tab, then click “Delete”.

Click “Run” button to start deleting the application.

A confirmation dialog is displayed. Click “Delete” to continue. A progress status will be


displayed on right side panel.
Upon successful deletion of the application, the status shows a “SUCCESS” task and there is
no more VMs running on the infrastructure.

You might also like