0% found this document useful (0 votes)
144 views69 pages

Lab - Nutanix Calm Workshop

Uploaded by

ahmet.sepiol
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
144 views69 pages

Lab - Nutanix Calm Workshop

Uploaded by

ahmet.sepiol
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 69

LAST UPDATED: 2023.

05

NUTANIX LAB GUIDE

Calm Workshop v2
Nutanix Lab Guide

Contents

1 LAB DAY 1 ................................................................................................................. 3


1.1 CALM: PROJECTS ........................................................................................................................3

2 LAB DAY 2 ............................................................................................................... 66


2.1 Document Purpose ...................................................................................................................66
2.2 Audience...................................................................................................................................66

3 LAB DAY 3 ............................................................................................................... 67


3.1 Document Purpose ...................................................................................................................67
3.2 Audience...................................................................................................................................67

A. GLOSSARY .............................................................................................................. 68

© Copyright 2021 Nutanix, Inc.


Nutanix, Inc.,
1740 Technology Drive, Suite 150
San Jose, CA 95110
All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws.
Nutanix is a trademark of Nutanix, Inc. in the United States and other jurisdictions. All other marks and names
mentioned herein are trademarks of their respective companies.
Template version 2021.04

P a g e |2
Calm Workshop v2
Nutanix Lab Guide

1 Lab Day 1
1.1 CALM: PROJECTS
Projects are the logical construct that integrate Calm with Nutanix’s native Self-Service Portal (SSP) capabilities,
allowing an administrator to assign both infrastructure resources and the roles/permissions of Active Directory
users/groups to specific Blueprints and Applications. By using different projects assigned to different clusters and
users, administrators can ensure that workloads are deployed the right way each time. For example, a developer can
be a Project Admin for a dev/test project, so they have full control to deploy to their development clusters or to a
cloud, while having Read Only access to production projects, allowing them access to logs but no ability to alter
production workloads.

Configure users, cluster and network to use

1. Within the Calm UI, Select Projects from the sidebar.

2. Click + Create Project


3. Fill out the following fields:
o Project Name - initials-Calm
o Description - initials-Calm
o Click on Create
4. Under Users, Groups, and Roles, click Add/Edit Users & Groups.
5. Fill out the following fields and click Save:
o Name - SSP Admins
o Role - Project Admin
6. Click + User, fill out the following fields and click Save:

P a g e |3
Calm Workshop v2
Nutanix Lab Guide

o Name - SSP Developers


o Role - Developer
7. Click + User, fill out the following fields and click Save:
o Name - SSP Consumers
o Role - Consumer
8. Click + User, fill out the following fields and click Save:
o Name - SSP Operators
o Role - Operator

Note
Click here to view the complete matrix of default SSP roles and associated permissions.

9. Under Infrastructure, click the blue Add Infrastructure button, and then Nutanix.
10. In the box that appears, click the white Configure Reources button, and in the pop-up, select your AHV cluster.
Once your cluster is selected, choose the Primary network, and if available, the Secondary network, and click
Confirm.

P a g e |4
Calm Workshop v2
Nutanix Lab Guide

11. Within the Selected Subnets table, select for the Primary network to make it the default virtual network for VMs
in the Calm project.

12. Click Save & Configure Environment.

Configure Environment

Now that we have set the users, their roles, which cluster and networks to use, we need to tell the project about the
environment. In this part of the project we tell Calm the following per O/S.

1. VM Name using Calm macros


2. VM Resources (CPU, Cores per vCPU, Memory)
3. Guest customization (CloudInit or Sysprep)
4. Disks configuration
5. Boot configuration
6. vGPU use
7. Network adapters
8. Need of a serial port
9. Connection configuration including general credentials

Note:

These parameters are set as DEFAULT parameters. Meaning you can change them in the Blueprints you are
going to create and deploy.

As we are mostly using the Linux O/S in this workshop we are just configuring these parameters.

1. In the Environment part we’re assigning the parameters needed for Calm to be able to deploy VMs. Click on
Environment and then the Create Environment blue button.

P a g e |5
Calm Workshop v2
Nutanix Lab Guide

2. For the name, enter initials-Calm-Env and a description optionally.


3. Select your cluster on the Infrastructure
4. In the VM Configuration area, select the cluster and Linux and provide the vCPU, Cores per vCPU and the
Memory (GiB) fields with the value of 1.

5. Under DISKS (1) Select the CentOS7.qcow2 under the Image field. Leave the other options in this area of the
configuration.

P a g e |6
Calm Workshop v2
Nutanix Lab Guide

6. Under NETWORK ADAPTERS (NICS)(1) Select your Cluster name and Primary as the network. Make sure you
have the Private IP set as Dynamic.

P a g e |7
Calm Workshop v2
Nutanix Lab Guide

7. At the CONNECTION area, click on the Credential and select Add New Credential. As we are using in the
Blueprints new setting, we still need to provide them to the Project.

8. In the new screen use root as the user and nutanix/4u as the password.

9. Click Done, and Next. Click on Save Environment and Project blue button to save the project.

P a g e |8
Calm Workshop v2
Nutanix Lab Guide

10. After a few seconds, the system saves the project and configure itself so it can use the configuration, you should
see that the Exclamation mark behind Environment should not be shown as we had before (see step 1).

Proceed to the next module of this workshop. The environment preparations have been completed.

TAKEAWAYS
• Nutanix Calm is a fully integrated component of the Nutanix stack. Easily enabled, highly available out of the box
in a Scale Out Prism Central deployment and takes advantage of non-disruptive One Click upgrades for new
features and fixes.
• By using different projects assigned to different clusters and users, administrators can ensure that workloads are
deployed the right way each time. For example, a developer can be a Project Admin for a dev/test project, so
they have full control to deploy to their development clusters or to a cloud, while having Read Only access to
production projects, allowing them access to logs but no ability to alter production workloads.

he estimated time to complete this lab is 60 minutes.

1.2 OVERVIEW
Nutanix Calm allows you to seamlessly select, provision, and manage your business applications across your
infrastructure for both the private and public clouds. Nutanix Calm provides App lifecycle, monitoring and
remediation to manage your heterogeneous infrastructure, for example, VMs or bare-metal servers. Nutanix Calm
supports multiple platforms so that you can use a single self-service and automation interface to manage all your
infrastructure.

In this lab you will explore the basics of Nutanix Calm by building and deploying a blueprint that installs and
configures a multi-tier Task Manager web app using MySQL, nginix, and HAProxy.

1.3 CREATING A BLUEPRINT


A blueprint is the framework for every application that you model by using Nutanix Calm. Blueprints are templates
that describe all the steps that are required to provision, configure, and execute tasks on the services and
applications that are created. You can create a blueprint to represent the architecture of your application and then

P a g e |9
Calm Workshop v2
Nutanix Lab Guide

run the blueprint repeatedly to create an instance, provision, and launch your applications. A blueprint also defines
the lifecycle of an application and its underlying infrastructure starting from the creation of the application to the
actions that are carried out on a blueprint until the termination of the application.

You can use blueprints to model the applications of various complexities; from simply provisioning a single virtual
machine to provisioning and managing a multi-node, multi-tier application.

1. In Prism Central, select > Services > Calm.

2. Select Blueprints in the left hand toolbar to view and manage Calm blueprints.

Note: Mousing over an icon will display its title.

3. Click + Create Blueprint > Multi VM/Pod Blueprint.


4. Fill out the following fields:
o Name – Initials_CalmLinuxIntro
o Description – Task Manager
o Project - Initials-Calm

P a g e | 10
Calm Workshop v2
Nutanix Lab Guide

5. Click Proceed to launch the Blueprint Editor.

The Blueprint Editor provides a graphical representation of various components that enable you to visualize and
configure the components and their dependencies in your environment.

1.4 CREATING CREDENTIALS


First you will create a credential that will be used to authenticate Calm to the CentOS VMs you will eventually
deploy. Credentials are unique to each Blueprint, and are not exported as part of the Blueprint for security purposes.
Each Blueprint requires a minimum of 1 credential.

This exercise uses a “Generic Cloud” CentOS image. This is a common option for multiple popular Linux distributions
that is lightweight, supports Cloud-Init based configuration, and utilizes SSH keypair authentication instead of
passwords. Keypair based authentication is commonplace in all public cloud environments.

1. Click Credentials.

P a g e | 11
Calm Workshop v2
Nutanix Lab Guide

2. Click Credentials and fill out the following fields:


o Credential Name – CENTOS
o Type - Static
o Username - centos
o Secret Type - SSH Private Key
o Key - Paste in your own private key, or use:
3. -----BEGIN RSA PRIVATE KEY-----
4. MIIEowIBAAKCAQEAii7qFDhVadLx5lULAG/ooCUTA/ATSmXbArs+GdHxbUWd/bNG
5. ZCXnaQ2L1mSVVGDxfTbSaTJ3En3tVlMtD2RjZPdhqWESCaoj2kXLYSiNDS9qz3SK
6. 6h822je/f9O9CzCTrw2XGhnDVwmNraUvO5wmQObCDthTXc72PcBOd6oa4ENsnuY9
7. HtiETg29TZXgCYPFXipLBHSZYkBmGgccAeY9dq5ywiywBJLuoSovXkkRJk3cd7Gy
8. hCRIwYzqfdgSmiAMYgJLrz/UuLxatPqXts2D8v1xqR9EPNZNzgd4QHK4of1lqsNR
9. uz2SxkwqLcXSw0mGcAL8mIwVpzhPzwmENC5OrwIBJQKCAQB++q2WCkCmbtByyrAp
10. 6ktiukjTL6MGGGhjX/PgYA5IvINX1SvtU0NZnb7FAntiSz7GFrODQyFPQ0jL3bq0
11. MrwzRDA6x+cPzMb/7RvBEIGdadfFjbAVaMqfAsul5SpBokKFLxU6lDb2CMdhS67c
12. 1K2Hv0qKLpHL0vAdEZQ2nFAMWETvVMzl0o1dQmyGzA0GTY8VYdCRsUbwNgvFMvBj
13. 8T/svzjpASDifa7IXlGaLrXfCH584zt7y+qjJ05O1G0NFslQ9n2wi7F93N8rHxgl
14. JDE4OhfyaDyLL1UdBlBpjYPSUbX7D5NExLggWEVFEwx4JRaK6+aDdFDKbSBIidHf
15. h45NAoGBANjANRKLBtcxmW4foK5ILTuFkOaowqj+2AIgT1ezCVpErHDFg0bkuvDk
16. QVdsAJRX5//luSO30dI0OWWGjgmIUXD7iej0sjAPJjRAv8ai+MYyaLfkdqv1Oj5c
17. oDC3KjmSdXTuWSYNvarsW+Uf2v7zlZlWesTnpV6gkZH3tX86iuiZAoGBAKM0mKX0
18. EjFkJH65Ym7gIED2CUyuFqq4WsCUD2RakpYZyIBKZGr8MRni3I4z6Hqm+rxVW6Dj
19. uFGQe5GhgPvO23UG1Y6nm0VkYgZq81TraZc/oMzignSC95w7OsLaLn6qp32Fje1M
20. Ez2Yn0T3dDcu1twY8OoDuvWx5LFMJ3NoRJaHAoGBAJ4rZP+xj17DVElxBo0EPK7k
21. 7TKygDYhwDjnJSRSN0HfFg0agmQqXucjGuzEbyAkeN1Um9vLU+xrTHqEyIN/Jqxk
22. hztKxzfTtBhK7M84p7M5iq+0jfMau8ykdOVHZAB/odHeXLrnbrr/gVQsAKw1NdDC
23. kPCNXP/c9JrzB+c4juEVAoGBAJGPxmp/vTL4c5OebIxnCAKWP6VBUnyWliFhdYME
24. rECvNkjoZ2ZWjKhijVw8Il+OAjlFNgwJXzP9Z0qJIAMuHa2QeUfhmFKlo4ku9LOF
25. 2rdUbNJpKD5m+IRsLX1az4W6zLwPVRHp56WjzFJEfGiRjzMBfOxkMSBSjbLjDm3Z
26. iUf7AoGBALjvtjapDwlEa5/CFvzOVGFq4L/OJTBEBGx/SA4HUc3TFTtlY2hvTDPZ
27. dQr/JBzLBUjCOBVuUuH3uW7hGhW+DnlzrfbfJATaRR8Ht6VU651T+Gbrr8EqNpCP
28. gmznERCNf9Kaxl/hlyV5dZBe/2LIK+/jLGNu9EJLoraaCBFshJKF
29. -----END RSA PRIVATE KEY-----

P a g e | 12
Calm Workshop v2
Nutanix Lab Guide

30. Click Done, and then Back.


31. Click on Save in the blueprint editor main screen

Note:If you don’t see the Save and Back buttons, make sure your browser screen is maximized.

1.5 DEFINING VARIABLES


Variables allow extensibility of Blueprints, meaning a single Blueprint can be used for multiple purposes and
environments depending on the configuration of its variables. Variables can either be static values saved as part of
the Blueprint or they can be specified at Runtime (when the Blueprint is launched). Variables are specific to a given
Application Profile, which is the platform on which the blueprint will be deployed. For example, a blueprint capable
of being deployed to both AHV and AWS would have 2 Application Profiles. Each profile could have individual
variables and VM configurations.

By default, variables are stored as a String and are visible in the Configuration Pane. Setting a variable as Secret will
mask the value and is ideal for variables such as passwords. In addition to the String and Secret options, there are
Integer, Multi-line String, Date, Time, and Date Time Data Types, and more advanced Input Types, however these
are outside the scope of this lab.

Variables can be used in scripts executed against objects using the @@{variable_name}@@ construct. Calm will
expand and replace the variable with the appropriate value before sending to the VM.

1. On the panel at the left-botton, locate Application Profile and click on it.

P a g e | 13
Calm Workshop v2
Nutanix Lab Guide

2.
3. In the Configuration Pane on the right side of the Blueprint Editor, under Variables, add the following variables
by clicking on the + sign (Runtime is specified by toggling the Running Man icon to Blue):

Note: for the purposes of this Workshop, make sure to respect the case of the values below

Variable Name Data Type | Value Secret Runtime


User_initials String | xyz X
Mysql_user String | root
Mysql_password String | nutanix/4u X
Database_name String | homestead

P a g e | 14
Calm Workshop v2
Nutanix Lab Guide

4.
5. Click Save.

1.6 ADDING A DOWNLOADABLE IMAGE


VMs in AHV can be deployed based on a disk image. With Calm, you can select a Downloadable Image via a URI.
During the application deployment, Prism Central will automatically download and create the image specified. If an
image with the same URI already exists on the cluster, it will skip the download and use the local image instead.

1. From the top toolbar, click Configuration > Downloadable Image Configuration blue plus mark and fill out the
following fields:

P a g e | 15
Calm Workshop v2
Nutanix Lab Guide

o Package Name - CentOS_7_Cloud


o Description - CentOS 7 Cloud Image
o Image Name - CentOS_7_Cloud
o Image Type - Disk Image
o Architecture - X86_64
o Source URI - http://download.nutanix.com/calm/CentOS-7-x86_64-GenericCloud.qcow2
o Product Name - CentOS
o Product Version – 7

Note

This Generic Cloud image is the same that’s used for the majority of the Nutanix Pre-Seeded Application
Blueprints.

P a g e | 16
Calm Workshop v2
Nutanix Lab Guide

2. Click Save, and then Back.

1.7 CREATING SERVICES


Services are the virtual machine instances, existing machines or bare-metal machines, that you can provision and
configure by using Nutanix Calm.

In this exercise you will create the database, webserver, and load balancer services that comprise your application.

P a g e | 17
Calm Workshop v2
Nutanix Lab Guide

1.7.1 Creating the Database Service

1. In Application Overview > Service, click to add a new Service.

Note: The pane within the Blueprint Editor used to create and manage Blueprint Layers is called the
Application Overview. Blueprint Layers consist of Services, Actions, and Application Profiles.

By default, the Application Overview is located in the lower left-hand corner of the Blueprint Editor and is used
to create and manage Blueprint layers such as Services, Application Profiles, and Actions.

Note Service1 appears in the Workspace and the Configuration Pane reflects the configuration of the selected
Service.

2. Fill out the following fields:


o Service Name - MySQL
o Name - MySQLAHV

Note

This defines the name of the substrate within Calm. Names can only contain alphanumeric characters, spaces,
and underscores.

o Account – Nutanix Cluster


o Operating system – Linux
o Cluster – Select your Nutanix cluster
o VM Name - @@{User_initials}@@-MYSQL-@@{calm_array_index}@@-@@{calm_time}@@

Note

P a g e | 18
Calm Workshop v2
Nutanix Lab Guide

This will use the Runtime User_initials variable you previously provided to prepend the VM name with your
initials. It will also use built-in macros to provide the array index (for scale out services) and a time stamp.

o vCPUs - 2
o Cores per vCPU - 1
o Memory (GiB) - 4
o Select Guest Customization
▪ Type - Cloud-init
▪ Script -
▪ #cloud-config
▪ users:
▪ - name: centos
▪ ssh-authorized-keys:
▪ - @@{CENTOS.public_key}@@
▪ sudo: ['ALL=(ALL) NOPASSWD:ALL']

Note

When using an SSH Private Key Credential, Calm is able to decode that private key into the
matching public key, and makes the decoded value accessable via the
@@{Credential_Name.public_key}@@ macro. Cloud-Init is then leveraged to populate the SSH
public key value as an authorized key, allowing for the corresponding private key to be used to
authenticate to the host.

Under DISK section:

o Device Type - Disk


o Device Bus - SCSI
o Image - CentOS_7_Cloud
o Select Bootable

Under Network section:

o Select under Network Adapters (NICs)


o NIC 1 - Primary
o Private IP - Dynamic

Under Connection section:

o Credential - CENTOS
3. Click Save.

Note

If errors or warnings are presented after saving the blueprint, hover over the icon in the top toolbar to see a list
of issues. Resolve any issues and Save the blueprint again.

P a g e | 19
Calm Workshop v2
Nutanix Lab Guide

Now that you have completed the deployment details for the VM associated with the service, the next step is to
tell Calm how the application will be installed on the VM.

1.7.2 Creating the MySQL Server Service

1. With the MySQL service icon selected in the Workspace pane (the blue background area), scroll to the top of the
Configuration Panel, and select the Package tab.

The Package is the configuration and application(s) installed on the Service, and is typically accomplished by
executing a script on the Service VM.

2. Specify MySQL_PACKAGE as the Package Name and click Configure install.


o Package Name - MYSQL_PACKAGE

Note the Package install field that appears on the MySQL service in the Workspace pane.

3. Select + Task, and fill out the following fields in the Configuration Panel to define the script that Calm will
remotely execute on the MySQL Service VM:
o Task Name - Install_sql
o Type - Execute
o Script Type - Shell

P a g e | 20
Calm Workshop v2
Nutanix Lab Guide

o Endpoint (Optional) - Leave default


o Credential - CENTOS
o Script -
o #!/bin/bash
o set -ex
o
o sudo yum install -y "http://repo.mysql.com/mysql-community-release-el7-
5.noarch.rpm"
o sudo yum update -y
o sudo setenforce 0
o sudo sed -i 's/enforcing/disabled/g' /etc/selinux/config /etc/selinux/config
o sudo systemctl stop firewalld || true
o sudo systemctl disable firewalld || true
o sudo yum install -y mysql-community-server.x86_64
o
o sudo /bin/systemctl start mysqld
o sudo /bin/systemctl enable mysqld
o
o #Mysql secure installation
o mysql -u root<<-EOF
o
o UPDATE mysql.user SET Password=PASSWORD('@@{Mysql_password}@@') WHERE
User='@@{Mysql_user}@@';
o DELETE FROM mysql.user WHERE User='@@{Mysql_user}@@' AND Host NOT IN
('localhost', '127.0.0.1', '::1');
o DELETE FROM mysql.user WHERE User='';
o DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%';
o
o FLUSH PRIVILEGES;
o EOF
o
o mysql -u @@{Mysql_user}@@ -p@@{Mysql_password}@@ <<-EOF
o CREATE DATABASE @@{Database_name}@@;
o GRANT ALL PRIVILEGES ON homestead.* TO '@@{Database_name}@@'@'%' identified
by 'secret';
o
o FLUSH PRIVILEGES;
o EOF

P a g e | 21
Calm Workshop v2
Nutanix Lab Guide

Note

You can click the Pop Out icon on the script field for a larger window to view/edit scripts.

Reviewing the script you can see the package will install MySQL, configure the credentials and create a database
based on the variables specified earlier in the exercise.

4. Select the MySQL service icon in the Workspace pane again, select the Package tab in the Configuration Panel.
5. Click Configure uninstall.

P a g e | 22
Calm Workshop v2
Nutanix Lab Guide

6. Select + Task, and fill out the following fields in the Configuration Panel:
o Task Name - Uninstall_sql
o Type - Execute
o Script Type - Shell
o Endpoint (Optional) - Leave default
o Credential - CENTOS
o Script -
o #!/bin/bash
o echo "Goodbye!"

P a g e | 23
Calm Workshop v2
Nutanix Lab Guide

Note

The uninstall script can be used for removing packages, updating network services like DHCP and DNS, removing
entries from Active Directory, etc. It is not being used for this simple example.

7. Click Save. You will be prompted with specific errors if there are validation issues such as missing fields or
unacceptable characters.

1.7.3 Creating the Web Server Service

You will now follow similar steps to define a web server service.

1. In Application Overview > Services, add an additional service by clicking on the + sign.

2. Select the new service and fill out the following VM fields in the Configuration Panel:
o Service Name - WebServer
o Name - WebServerAHV
o Cloud - Nutanix
o OS - Linux
o VM Name - @@{User_initials}@@-WebServer-@@{calm_array_index}@@
o vCPUs - 2
o Cores per vCPU - 1
o Memory (GiB) - 4
o Select Guest Customization
▪ Type - Cloud-init
▪ Script -
▪ #cloud-config
▪ users:
▪ - name: centos
▪ ssh-authorized-keys:
▪ - @@{CENTOS.public_key}@@
▪ sudo: ['ALL=(ALL) NOPASSWD:ALL']

P a g e | 24
Calm Workshop v2
Nutanix Lab Guide

Under DISK section:

o Device Type - Disk


o Device Bus - SCSI
o Image - CentOS_7_Cloud
o Select Bootable

Under Network section:

o Select under Network Adapters (NICs)


o NIC 1 - Primary
o Private IP - Dynamic

Under Connection section:

o Credential - CENTOS
3. Select the Package tab.
4. Specify a Package Name and click Configure install.
o Package Name - WebServer_PACKAGE
5. Select + Task, and fill out the following fields in the Configuration Panel:
o Name Task - Install_WebServer
o Type - Execute
o Script Type - Shell
o Endpoint (Optional) - Leave default
o Credential - CENTOS
o Script -
o #!/bin/bash
o set -ex
o
o sudo yum update -y
o sudo yum -y install epel-release
o sudo setenforce 0
o sudo sed -i 's/enforcing/disabled/g' /etc/selinux/config /etc/selinux/config
o sudo systemctl stop firewalld || true
o sudo systemctl disable firewalld || true
o sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
o sudo yum update -y
o sudo yum install -y nginx php56w-fpm php56w-cli php56w-mcrypt php56w-mysql
php56w-mbstring php56w-dom git unzip
o
o sudo mkdir -p /var/www/laravel
o echo "server {
o listen 80 default_server;
o listen [::]:80 default_server ipv6only=on;
o root /var/www/laravel/public/;
o index index.php index.html index.htm;
o location / {
o try_files \$uri \$uri/ /index.php?\$query_string;
o }

P a g e | 25
Calm Workshop v2
Nutanix Lab Guide

o # pass the PHP scripts to FastCGI server listening on /var/run/php5-fpm.sock


o location ~ \.php$ {
o try_files \$uri /index.php =404;
o fastcgi_split_path_info ^(.+\.php)(/.+)\$;
o fastcgi_pass 127.0.0.1:9000;
o fastcgi_index index.php;
o fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
o include fastcgi_params;
o }
o }" | sudo tee /etc/nginx/conf.d/laravel.conf
o sudo sed -i 's/80 default_server/80/g' /etc/nginx/nginx.conf
o if `grep "cgi.fix_pathinfo" /etc/php.ini` ; then
o sudo sed -i 's/cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/' /etc/php.ini
o else
o sudo sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/' /etc/php.ini
o fi
o
o sudo systemctl enable php-fpm
o sudo systemctl enable nginx
o sudo systemctl restart php-fpm
o sudo systemctl restart nginx
o
o if [ ! -e /usr/local/bin/composer ]
o then
o curl -sS https://getcomposer.org/installer | php
o sudo mv composer.phar /usr/local/bin/composer
o sudo chmod +x /usr/local/bin/composer
o fi
o
o sudo git clone https://github.com/ideadevice/quickstart-basic.git
/var/www/laravel
o sudo sed -i 's/DB_HOST=.*/DB_HOST=@@{MySQL.address}@@/' /var/www/laravel/.env
o
o sudo su - -c "cd /var/www/laravel; composer install"
o if [ "@@{calm_array_index}@@" == "0" ]; then
o sudo su - -c "cd /var/www/laravel; php artisan migrate"
o fi
o
o sudo chown -R nginx:nginx /var/www/laravel
o sudo chmod -R 777 /var/www/laravel/
o sudo systemctl restart nginx

This script installs PHP and Nginx to create a web server, and then a Laravel based web application. It then
configures the web application settings, including updating the DB_HOST with the MySQL IP address, accessed
via the @@{MySQL.address}@@ macro.

6. Select the Package tab and click Configure uninstall.


7. Select + Task, and fill out the following fields in the Configuration Panel:
o Name Task - Uninstall_WebServer
o Type - Execute
o Script Type - Shell
o Endpoint (Optional) - Leave default

P a g e | 26
Calm Workshop v2
Nutanix Lab Guide

o Credential - CENTOS
o Script -
o #!/bin/bash
o set -ex
o
o sudo rm -rf /var/www/laravel
o sudo yum erase -y nginx

For many applications it is common to need to scale out a given service, such as the web tier in order to handle
more concurrent users. Calm makes it simple to turn deploy an array containing multiple copies of a given
service.

8. With the WebServer service icon selected in the Workspace pane, scroll to the top of the Configuration Panel,
and select the Service tab.
9. Under Deployment Config > Number of Replicas, increase the Default and Min value from 1 to 2 and the Max
value from 1 to 4.

This change will provision a minimum of 2 WebServer VMs for each deployment of the application, and allow
the array to grow up to a total of 4 WebServer VMs.

Note

P a g e | 27
Calm Workshop v2
Nutanix Lab Guide

Scaling an application in and out will require additional scripting so that the application understands how to
leverage the additional VMs.

10. Click Save.

1.7.4 Creating the Load Balancer Service

To take advantage of a scale out web tier, your application needs to be able to load balance connections across
multiple web server VMs. HAProxy is a free, open source TCP/HTTP load balancer used to distribute workloads
across multiple servers. It can be used anywhere from small, simple deployments to large web-scale environments
such as GitHub, Instagram, and Twitter.

1. In Application Overview > Services, add an additional service.


2. Select the new service and fill out the following VM fields in the Configuration Panel:
o Service Name - HAProxy
o Name - HAProxyAHV
o Cloud - Nutanix
o OS - Linux
o VM Name - @@{User_initials}@@-HAProxy-@@{calm_array_index}@@
o vCPUs - 2
o Cores per vCPU - 1
o Memory (GiB) - 4
o Select Guest Customization
▪ Type - Cloud-init
▪ Script -
▪ #cloud-config
▪ users:
▪ - name: centos
▪ ssh-authorized-keys:
▪ - @@{CENTOS.public_key}@@
▪ sudo: ['ALL=(ALL) NOPASSWD:ALL']

Under DISK section:

o Device Type - Disk


o Device Bus - SCSI
o Image - CentOS_7_Cloud
o Select Bootable

Under Network section:

o Select under Network Adapters (NICs)


o NIC 1 - Primary
o Private IP - Dynamic

Under Connection section:

P a g e | 28
Calm Workshop v2
Nutanix Lab Guide

o Credential - CENTOS
3. Select the Package tab.
4. Specify a Package Name and click Configure install.
o Package Name - HAProxy_PACKAGE
5. Select + Task, and fill out the following fields in the Configuration Panel:
o Name Task - Install_HAProxy
o Type - Execute
o Script Type - Shell
o Endpint (optional) - Leave default
o Credential - CENTOS
o Script -
o #!/bin/bash
o set -ex
o
o sudo yum update -y
o sudo yum install -y haproxy
o sudo setenforce 0
o sudo sed -i 's/enforcing/disabled/g' /etc/selinux/config /etc/selinux/config
o sudo systemctl stop firewalld || true
o sudo systemctl disable firewalld || true
o
o echo "global
o log 127.0.0.1 local0
o log 127.0.0.1 local1 notice
o maxconn 4096
o quiet
o user haproxy
o group haproxy
o defaults
o log global
o mode http
o retries 3
o timeout client 50s
o timeout connect 5s
o timeout server 50s
o option dontlognull
o option httplog
o option redispatch
o balance roundrobin
o # Set up application listeners here.
o listen admin
o bind 127.0.0.1:22002
o mode http
o stats uri /
o frontend http
o maxconn 2000
o bind 0.0.0.0:80
o default_backend servers-http
o backend servers-http" | sudo tee /etc/haproxy/haproxy.cfg
o
o hosts=$(echo "@@{WebServer.address}@@" | tr "," "\n")
o port=80

P a g e | 29
Calm Workshop v2
Nutanix Lab Guide

o
o for host in $hosts
o do echo " server host-${host} ${host}:${port} weight 1 maxconn 100 check" |
sudo tee -a /etc/haproxy/haproxy.cfg
o done
o
o sudo systemctl daemon-reload
o sudo systemctl enable haproxy
o sudo systemctl restart haproxy

Note

Note the use of the @@{WebServer.address}@@ macro in the script above. The macro returns a comma
delimited list of all IPs of the VMs within that service. The script then uses the tr command to replace commas
with carriage returns. The result is an array, $hosts, containing strings of all WebServer IP addresses. Those
addresses are then each added to the HAProxy configuration file.

6. Select the Package tab and click Configure uninstall.


7. Select + Task, and fill out the following fields in the Configuration Panel:
o Name Task - Uninstall_HAProxy
o Type - Execute
o Script Type - Shell
o Credential - CENTOS
o Script -
o #!/bin/bash
o set -ex
o
o sudo
o yum -y erase haproxy
8. Click Save.

1.8 ADDING DEPENDENCIES


As our application will require the database to be running before the web server starts, our Blueprint requires a
dependency to enforce this ordering. There are a couple of ways to do this, one of which you’ve already done
without likely realizing it.

1. In the Application Overview > Application Profile section, expand the Default Application Profile and click the
Create Action.

P a g e | 30
Calm Workshop v2
Nutanix Lab Guide

Take note of the Orange Orchestration Edge going from the MySQL Start task to the WebServer Package Install
task. This edge was automatically created by Calm due to the @@{MySQL.address}@@ macro reference in the
WebServer Package Install task. Since the system needs to know the IP Address of the MySQL service prior to
being able to proceed with the WebServer Install task, Calm intelligently creates the orchestration edge for you.
This requires the MySQL service to be started prior to moving on to the WebServer Install task.

2. Return to the HAProxy Package Install task, why are orchestration edges automatically created between the
WebServer and HAProxy services?
3. Next, select the Stop Profile Action.

Note that lack of orchestration edges between services when stopping an application. Why might issuing
shutdown commands to all services within the application simultaneously create an issue?

4. Click on each Profile Action to take note of the current presence (or lack thereof) of the orchestration edges.

P a g e | 31
Calm Workshop v2
Nutanix Lab Guide

To resolve this, you’ll manually define a dependencies between services.

5. Select the WebServer Service and click the Create Dependency icon that appears above the Service icon, and
then click on the MySQL service.

6. This represents that the WebServer service “depends” upon the MySQL service, meaning the MySQL service will
start before, and stop after, the WebServer service.
7. Now create a dependency for the HAProxy service to depend on the WebServer service.
8. Click Save.
9. Re-visit the Profile Actions and confirm the edges now properly reflect the dependencies between the services,
as shown below:

P a g e | 32
Calm Workshop v2
Nutanix Lab Guide

Drawing the white dependency arrows will cause Calm to create orchestration edges for all System Defined
Profile Actions (Create, Start, Restart, Stop, Delete, and Soft Delete).

1.9 LAUNCHING AND MANAGING THE APPLICATION


1. From the upper toolbar in the Blueprint Editor, click Launch.
2. Specify a unique Application Name (e.g. Initials-CalmLinuxIntro1) and your User_initials Runtime variable value
for VM naming.
3. Click Create.

The Audit tab can be used to monitor the deployment of the application.

P a g e | 33
Calm Workshop v2
Nutanix Lab Guide

P a g e | 34
Calm Workshop v2
Nutanix Lab Guide

Why don’t all of the CentOS based services deploy at the same time following the download of the disk image?
Look at the Adding Dependencies part of this module for the answer…

4. Once the application reaches a Running status (approx. 20 minutes after you have launched the Blueprint),

navigate to the Services tab and select the HAProxy service to determine the IP address of your load balancer.

5. In a new browser tab or window, navigate to http://<HAProxy-IP>, and verify your Task Manager application is
functioning.

Note

You can also click the link in the Description of the Application. Or click the icon and click on your
application you just created.

P a g e | 35
Calm Workshop v2
Nutanix Lab Guide

1.10 TAKEAWAYS
What are the key things you should know about Nutanix Calm?

• Nutanix Calm, as a native component of Prism, is built on and carries forward the benefits of the platform. The
simplicity provided by Acropolis lets Calm focus on applications, rather than trying to mask the complexity of the
underlying infrastructure management.
• Calm blueprints are easy to use. In 60 minutes you went from nothing to a full infrastructure stack deployment.
Because Calm uses standard tools for configuration - bash, PowerShell, Python, etc. - there’s no new language to
learn and you can immediately apply skills and code you already have.
• The Blueprint Editor provides a simple UI for modeling potentially complex applications.
• Blueprints are tied to Projects which can be used to enforce quotas and role based access control.
• Having a Blueprint install and configure binaries means no longer creating specific images for individual
applications. Instead the application can be modified through changes to the Blueprint or installation script,
both of which can be stored in source code repositories.
• Variables allow another dimension of customizing an application without having to edit the underlying Blueprint.

P a g e | 36
Calm Workshop v2
Nutanix Lab Guide

• There are multiple ways of authenticating to a VM (keys or passwords), which is dependent upon the source
image.
• Application status can be monitored in real time.
• Applications typically span across multiple VMs, each responsible for different services. Calm is capable of
automated and orchestrating full applications.
• Dependencies between services can be easily modeled in the Blueprint Editor.
• Users can quickly provision entire application stacks for production or testing for repeatable results without time
lost to manual configuration.
• Interested in using Calm for more app lifecycle operations? Check out the Calm: Day 2 Operations!

1.11 OVERVIEW
Nutanix Calm allows you to seamlessly select, provision, and manage your business applications across your
infrastructure for both the private and public clouds. Nutanix Calm provides App lifecycle, monitoring and
remediation to manage your heterogeneous infrastructure, for example, VMs or bare-metal servers. Nutanix Calm
supports multiple platforms so that you can use a single self-service and automation interface to manage all your
infrastructure.

In this lab you will explore the basics of Nutanix Calm by building and deploying a blueprint that installs and
configures a multi-tier Task Manager web app using MySQL, nginix, and HAProxy.

1.12 CREATING A BLUEPRINT


A blueprint is the framework for every application that you model by using Nutanix Calm. Blueprints are templates
that describe all the steps that are required to provision, configure, and execute tasks on the services and
applications that are created. You can create a blueprint to represent the architecture of your application and then
run the blueprint repeatedly to create an instance, provision, and launch your applications. A blueprint also defines
the lifecycle of an application and its underlying infrastructure starting from the creation of the application to the
actions that are carried out on a blueprint until the termination of the application.

You can use blueprints to model the applications of various complexities; from simply provisioning a single virtual
machine to provisioning and managing a multi-node, multi-tier application.

1. In Prism Central, select > Services > Calm.

P a g e | 37
Calm Workshop v2
Nutanix Lab Guide

2. Select Blueprints in the left hand toolbar to view and manage Calm blueprints.

Note

Mousing over an icon will display its title.

3. Click + Create Blueprint > Multi VM/Pod Blueprint.


4. Fill out the following fields:
o Name - Initials-CalmLinuxIntro
o Description - [Task Manager Application](http://@@{HAProxy.address}@@/)
o Project - Initials-Calm

P a g e | 38
Calm Workshop v2
Nutanix Lab Guide

5. Click Proceed to launch the Blueprint Editor.

The Blueprint Editor provides a graphical representation of various components that enable you to visualize and
configure the components and their dependencies in your environment.

1.13 CREATING CREDENTIALS


First you will create a credential that will be used to authenticate Calm to the CentOS VMs you will eventually
deploy. Credentials are unique to each Blueprint, and are not exported as part of the Blueprint for security purposes.
Each Blueprint requires a minimum of 1 credential.

This exercise uses a “Generic Cloud” CentOS image. This is a common option for multiple popular Linux distributions
that is lightweight, supports Cloud-Init based configuration, and utilizes SSH keypair authentication instead of
passwords. Keypair based authentication is commonplace in all public cloud environments.

1. Click Credentials.

P a g e | 39
Calm Workshop v2
Nutanix Lab Guide

2. Click Credentials and fill out the following fields:


o Credential Name - CENTOS
o Username - centos
o Secret Type - SSH Private Key
o Key - Paste in your own private key, or use:
3. -----BEGIN RSA PRIVATE KEY-----
4. MIIEowIBAAKCAQEAii7qFDhVadLx5lULAG/ooCUTA/ATSmXbArs+GdHxbUWd/bNG
5. ZCXnaQ2L1mSVVGDxfTbSaTJ3En3tVlMtD2RjZPdhqWESCaoj2kXLYSiNDS9qz3SK
6. 6h822je/f9O9CzCTrw2XGhnDVwmNraUvO5wmQObCDthTXc72PcBOd6oa4ENsnuY9
7. HtiETg29TZXgCYPFXipLBHSZYkBmGgccAeY9dq5ywiywBJLuoSovXkkRJk3cd7Gy
8. hCRIwYzqfdgSmiAMYgJLrz/UuLxatPqXts2D8v1xqR9EPNZNzgd4QHK4of1lqsNR
9. uz2SxkwqLcXSw0mGcAL8mIwVpzhPzwmENC5OrwIBJQKCAQB++q2WCkCmbtByyrAp
10. 6ktiukjTL6MGGGhjX/PgYA5IvINX1SvtU0NZnb7FAntiSz7GFrODQyFPQ0jL3bq0
11. MrwzRDA6x+cPzMb/7RvBEIGdadfFjbAVaMqfAsul5SpBokKFLxU6lDb2CMdhS67c
12. 1K2Hv0qKLpHL0vAdEZQ2nFAMWETvVMzl0o1dQmyGzA0GTY8VYdCRsUbwNgvFMvBj
13. 8T/svzjpASDifa7IXlGaLrXfCH584zt7y+qjJ05O1G0NFslQ9n2wi7F93N8rHxgl
14. JDE4OhfyaDyLL1UdBlBpjYPSUbX7D5NExLggWEVFEwx4JRaK6+aDdFDKbSBIidHf
15. h45NAoGBANjANRKLBtcxmW4foK5ILTuFkOaowqj+2AIgT1ezCVpErHDFg0bkuvDk
16. QVdsAJRX5//luSO30dI0OWWGjgmIUXD7iej0sjAPJjRAv8ai+MYyaLfkdqv1Oj5c
17. oDC3KjmSdXTuWSYNvarsW+Uf2v7zlZlWesTnpV6gkZH3tX86iuiZAoGBAKM0mKX0
18. EjFkJH65Ym7gIED2CUyuFqq4WsCUD2RakpYZyIBKZGr8MRni3I4z6Hqm+rxVW6Dj
19. uFGQe5GhgPvO23UG1Y6nm0VkYgZq81TraZc/oMzignSC95w7OsLaLn6qp32Fje1M
20. Ez2Yn0T3dDcu1twY8OoDuvWx5LFMJ3NoRJaHAoGBAJ4rZP+xj17DVElxBo0EPK7k
21. 7TKygDYhwDjnJSRSN0HfFg0agmQqXucjGuzEbyAkeN1Um9vLU+xrTHqEyIN/Jqxk
22. hztKxzfTtBhK7M84p7M5iq+0jfMau8ykdOVHZAB/odHeXLrnbrr/gVQsAKw1NdDC
23. kPCNXP/c9JrzB+c4juEVAoGBAJGPxmp/vTL4c5OebIxnCAKWP6VBUnyWliFhdYME
24. rECvNkjoZ2ZWjKhijVw8Il+OAjlFNgwJXzP9Z0qJIAMuHa2QeUfhmFKlo4ku9LOF
25. 2rdUbNJpKD5m+IRsLX1az4W6zLwPVRHp56WjzFJEfGiRjzMBfOxkMSBSjbLjDm3Z
26. iUf7AoGBALjvtjapDwlEa5/CFvzOVGFq4L/OJTBEBGx/SA4HUc3TFTtlY2hvTDPZ
27. dQr/JBzLBUjCOBVuUuH3uW7hGhW+DnlzrfbfJATaRR8Ht6VU651T+Gbrr8EqNpCP
28. gmznERCNf9Kaxl/hlyV5dZBe/2LIK+/jLGNu9EJLoraaCBFshJKF
29. -----END RSA PRIVATE KEY-----

P a g e | 40
Calm Workshop v2
Nutanix Lab Guide

30. Click Save, and then Back.

Note

If you don’t see the Save and Back buttons, make sure your browser screen is maximized.

1.14 DEFINING VARIABLES


Variables allow extensibility of Blueprints, meaning a single Blueprint can be used for multiple purposes and
environments depending on the configuration of its variables. Variables can either be static values saved as part of
the Blueprint or they can be specified at Runtime (when the Blueprint is launched). Variables are specific to a given
Application Profile, which is the platform on which the blueprint will be deployed. For example, a blueprint capable
of being deployed to both AHV and AWS would have 2 Application Profiles. Each profile could have individual
variables and VM configurations.

P a g e | 41
Calm Workshop v2
Nutanix Lab Guide

By default, variables are stored as a String and are visible in the Configuration Pane. Setting a variable as Secret will
mask the value and is ideal for variables such as passwords. In addition to the String and Secret options, there are
Integer, Multi-line String, Date, Time, and Date Time Data Types, and more advanced Input Types, however these
are outside the scope of this lab.

Variables can be used in scripts executed against objects using the @@{variable_name}@@ construct. Calm will
expand and replace the variable with the appropriate value before sending to the VM.

1. In the Configuration Pane on the right side of the Blueprint Editor, under Variables, add the following variables
by clicking on the + sign (Runtime is specified by toggling the Running Man icon to Blue):

Variable Name Data Type | Value Secret Runtime


User_initials String | xyz X
Mysql_user String | root
Mysql_password String | nutanix/4u X
Database_name String | homestead

P a g e | 42
Calm Workshop v2
Nutanix Lab Guide

2.
3. Click Save.

1.15 ADDING A DOWNLOADABLE IMAGE


VMs in AHV can be deployed based on a disk image. With Calm, you can select a Downloadable Image via a URI.
During the application deployment, Prism Central will automatically download and create the image specified. If an
image with the same URI already exists on the cluster, it will skip the download and use the local image instead.

1. From the top toolbar, click Configuration > Downloadable Image Configuration and fill out the following fields:
o Package Name - CentOS_7_Cloud

P a g e | 43
Calm Workshop v2
Nutanix Lab Guide

o Description - CentOS 7 Cloud Image


o Image Name - CentOS_7_Cloud
o Image Type - Disk Image
o Architecture - X86_64
o Source URI - http://download.nutanix.com/calm/CentOS-7-x86_64-GenericCloud.qcow2
o Product Name - CentOS
o Product Version - 7

Note

This Generic Cloud image is the same that’s used for the majority of the Nutanix Pre-Seeded Application
Blueprints.

P a g e | 44
Calm Workshop v2
Nutanix Lab Guide

2. Click Save, and then Back.

1.16 CREATING SERVICES


Services are the virtual machine instances, existing machines or bare-metal machines, that you can provision and
configure by using Nutanix Calm.

In this exercise you will create the database, webserver, and load balancer services that comprise your application.

P a g e | 45
Calm Workshop v2
Nutanix Lab Guide

1.16.1 Creating the Database Service

1. In Application Overview > Service, click to add a new Service.

Note

The pane within the Blueprint Editor used to create and manage Blueprint Layers is called the Application
Overview. Blueprint Layers consist of Services, Actions, and Application Profiles.

By default, the Application Overview is located in the lower left-hand corner of the Blueprint Editor and is used
to create and manage Blueprint layers such as Services, Application Profiles, and Actions.

Note Service1 appears in the Workspace and the Configuration Pane reflects the configuration of the selected
Service.

2. Fill out the following fields:


o Service Name - MySQL
o Name - MySQLAHV

Note

This defines the name of the substrate within Calm. Names can only contain alphanumeric characters, spaces,
and underscores.

o Cloud - Nutanix
o OS - Linux
o VM Name - @@{User_initials}@@-MYSQL-@@{calm_array_index}@@-@@{calm_time}@@

Note

P a g e | 46
Calm Workshop v2
Nutanix Lab Guide

This will use the Runtime User_initials variable you previously provided to prepend the VM name with your
initials. It will also use built-in macros to provide the array index (for scale out services) and a time stamp.

o vCPUs - 2
o Cores per vCPU - 1
o Memory (GiB) - 4
o Select Guest Customization
▪ Type - Cloud-init
▪ Script -
▪ #cloud-config
▪ users:
▪ - name: centos
▪ ssh-authorized-keys:
▪ - @@{CENTOS.public_key}@@
▪ sudo: ['ALL=(ALL) NOPASSWD:ALL']

Note

When using an SSH Private Key Credential, Calm is able to decode that private key into the
matching public key, and makes the decoded value accessable via the
@@{Credential_Name.public_key}@@ macro. Cloud-Init is then leveraged to populate the SSH
public key value as an authorized key, allowing for the corresponding private key to be used to
authenticate to the host.

Under DISK section:

o Device Type - Disk


o Device Bus - SCSI
o Image - CentOS_7_Cloud
o Select Bootable

Under Network section:

o Select under Network Adapters (NICs)


o NIC 1 - Primary
o Private IP - Dynamic

Under Connection section:

o Credential - CENTOS
3. Click Save.

Note

If errors or warnings are presented after saving the blueprint, hover over the icon in the top toolbar to see a list
of issues. Resolve any issues and Save the blueprint again.

P a g e | 47
Calm Workshop v2
Nutanix Lab Guide

Now that you have completed the deployment details for the VM associated with the service, the next step is to
tell Calm how the application will be installed on the VM.

1.16.2 Creating the MySQL Server Service

1. With the MySQL service icon selected in the Workspace pane (the blue background area), scroll to the top of the
Configuration Panel, and select the Package tab.

The Package is the configuration and application(s) installed on the Service, and is typically accomplished by
executing a script on the Service VM.

2. Specify MySQL_PACKAGE as the Package Name and click Configure install.


o Package Name - MYSQL_PACKAGE

Note the Package install field that appears on the MySQL service in the Workspace pane.

3. Select + Task, and fill out the following fields in the Configuration Panel to define the script that Calm will
remotely execute on the MySQL Service VM:
o Task Name - Install_sql
o Type - Execute
o Script Type - Shell

P a g e | 48
Calm Workshop v2
Nutanix Lab Guide

o Endpoint (Optional) - Leave default


o Credential - CENTOS
o Script -
o #!/bin/bash
o set -ex
o
o sudo yum install -y "http://repo.mysql.com/mysql-community-release-el7-
5.noarch.rpm"
o sudo yum update -y
o sudo setenforce 0
o sudo sed -i 's/enforcing/disabled/g' /etc/selinux/config /etc/selinux/config
o sudo systemctl stop firewalld || true
o sudo systemctl disable firewalld || true
o sudo yum install -y mysql-community-server.x86_64
o
o sudo /bin/systemctl start mysqld
o sudo /bin/systemctl enable mysqld
o
o #Mysql secure installation
o mysql -u root<<-EOF
o
o UPDATE mysql.user SET Password=PASSWORD('@@{Mysql_password}@@') WHERE
User='@@{Mysql_user}@@';
o DELETE FROM mysql.user WHERE User='@@{Mysql_user}@@' AND Host NOT IN
('localhost', '127.0.0.1', '::1');
o DELETE FROM mysql.user WHERE User='';
o DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%';
o
o FLUSH PRIVILEGES;
o EOF
o
o mysql -u @@{Mysql_user}@@ -p@@{Mysql_password}@@ <<-EOF
o CREATE DATABASE @@{Database_name}@@;
o GRANT ALL PRIVILEGES ON homestead.* TO '@@{Database_name}@@'@'%' identified
by 'secret';
o
o FLUSH PRIVILEGES;
o EOF

P a g e | 49
Calm Workshop v2
Nutanix Lab Guide

Note

You can click the Pop Out icon on the script field for a larger window to view/edit scripts.

Reviewing the script you can see the package will install MySQL, configure the credentials and create a database
based on the variables specified earlier in the exercise.

4. Select the MySQL service icon in the Workspace pane again, select the Package tab in the Configuration Panel.
5. Click Configure uninstall.

P a g e | 50
Calm Workshop v2
Nutanix Lab Guide

6. Select + Task, and fill out the following fields in the Configuration Panel:
o Task Name - Uninstall_sql
o Type - Execute
o Script Type - Shell
o Endpoint (Optional) - Leave default
o Credential - CENTOS
o Script -
o #!/bin/bash
o echo "Goodbye!"

P a g e | 51
Calm Workshop v2
Nutanix Lab Guide

Note

The uninstall script can be used for removing packages, updating network services like DHCP and DNS, removing
entries from Active Directory, etc. It is not being used for this simple example.

7. Click Save. You will be prompted with specific errors if there are validation issues such as missing fields or
unacceptable characters.

1.16.3 Creating the Web Server Service

You will now follow similar steps to define a web server service.

1. In Application Overview > Services, add an additional service by clicking on the + sign.

2. Select the new service and fill out the following VM fields in the Configuration Panel:
o Service Name - WebServer
o Name - WebServerAHV
o Cloud - Nutanix
o OS - Linux
o VM Name - @@{User_initials}@@-WebServer-@@{calm_array_index}@@
o vCPUs - 2
o Cores per vCPU - 1
o Memory (GiB) - 4
o Select Guest Customization
▪ Type - Cloud-init
▪ Script -
▪ #cloud-config
▪ users:
▪ - name: centos
▪ ssh-authorized-keys:
▪ - @@{CENTOS.public_key}@@
▪ sudo: ['ALL=(ALL) NOPASSWD:ALL']

P a g e | 52
Calm Workshop v2
Nutanix Lab Guide

Under DISK section:

o Device Type - Disk


o Device Bus - SCSI
o Image - CentOS_7_Cloud
o Select Bootable

Under Network section:

o Select under Network Adapters (NICs)


o NIC 1 - Primary
o Private IP - Dynamic

Under Connection section:

o Credential - CENTOS
3. Select the Package tab.
4. Specify a Package Name and click Configure install.
o Package Name - WebServer_PACKAGE
5. Select + Task, and fill out the following fields in the Configuration Panel:
o Name Task - Install_WebServer
o Type - Execute
o Script Type - Shell
o Endpoint (Optional) - Leave default
o Credential - CENTOS
o Script -
o #!/bin/bash
o set -ex
o
o sudo yum update -y
o sudo yum -y install epel-release
o sudo setenforce 0
o sudo sed -i 's/enforcing/disabled/g' /etc/selinux/config /etc/selinux/config
o sudo systemctl stop firewalld || true
o sudo systemctl disable firewalld || true
o sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
o sudo yum update -y
o sudo yum install -y nginx php56w-fpm php56w-cli php56w-mcrypt php56w-mysql
php56w-mbstring php56w-dom git unzip
o
o sudo mkdir -p /var/www/laravel
o echo "server {
o listen 80 default_server;
o listen [::]:80 default_server ipv6only=on;
o root /var/www/laravel/public/;
o index index.php index.html index.htm;
o location / {
o try_files \$uri \$uri/ /index.php?\$query_string;
o }

P a g e | 53
Calm Workshop v2
Nutanix Lab Guide

o # pass the PHP scripts to FastCGI server listening on /var/run/php5-fpm.sock


o location ~ \.php$ {
o try_files \$uri /index.php =404;
o fastcgi_split_path_info ^(.+\.php)(/.+)\$;
o fastcgi_pass 127.0.0.1:9000;
o fastcgi_index index.php;
o fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
o include fastcgi_params;
o }
o }" | sudo tee /etc/nginx/conf.d/laravel.conf
o sudo sed -i 's/80 default_server/80/g' /etc/nginx/nginx.conf
o if `grep "cgi.fix_pathinfo" /etc/php.ini` ; then
o sudo sed -i 's/cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/' /etc/php.ini
o else
o sudo sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/' /etc/php.ini
o fi
o
o sudo systemctl enable php-fpm
o sudo systemctl enable nginx
o sudo systemctl restart php-fpm
o sudo systemctl restart nginx
o
o if [ ! -e /usr/local/bin/composer ]
o then
o curl -sS https://getcomposer.org/installer | php
o sudo mv composer.phar /usr/local/bin/composer
o sudo chmod +x /usr/local/bin/composer
o fi
o
o sudo git clone https://github.com/ideadevice/quickstart-basic.git
/var/www/laravel
o sudo sed -i 's/DB_HOST=.*/DB_HOST=@@{MySQL.address}@@/' /var/www/laravel/.env
o
o sudo su - -c "cd /var/www/laravel; composer install"
o if [ "@@{calm_array_index}@@" == "0" ]; then
o sudo su - -c "cd /var/www/laravel; php artisan migrate"
o fi
o
o sudo chown -R nginx:nginx /var/www/laravel
o sudo chmod -R 777 /var/www/laravel/
o sudo systemctl restart nginx

This script installs PHP and Nginx to create a web server, and then a Laravel based web application. It then
configures the web application settings, including updating the DB_HOST with the MySQL IP address, accessed
via the @@{MySQL.address}@@ macro.

6. Select the Package tab and click Configure uninstall.


7. Select + Task, and fill out the following fields in the Configuration Panel:
o Name Task - Uninstall_WebServer
o Type - Execute
o Script Type - Shell
o Endpoint (Optional) - Leave default

P a g e | 54
Calm Workshop v2
Nutanix Lab Guide

o Credential - CENTOS
o Script -
o #!/bin/bash
o set -ex
o
o sudo rm -rf /var/www/laravel
o sudo yum erase -y nginx

For many applications it is common to need to scale out a given service, such as the web tier in order to handle
more concurrent users. Calm makes it simple to turn deploy an array containing multiple copies of a given
service.

8. With the WebServer service icon selected in the Workspace pane, scroll to the top of the Configuration Panel,
and select the Service tab.
9. Under Deployment Config > Number of Replicas, increase the Default and Min value from 1 to 2 and the Max
value from 1 to 4.

This change will provision a minimum of 2 WebServer VMs for each deployment of the application, and allow
the array to grow up to a total of 4 WebServer VMs.

Note

P a g e | 55
Calm Workshop v2
Nutanix Lab Guide

Scaling an application in and out will require additional scripting so that the application understands how to
leverage the additional VMs.

10. Click Save.

1.16.4 Creating the Load Balancer Service

To take advantage of a scale out web tier, your application needs to be able to load balance connections across
multiple web server VMs. HAProxy is a free, open source TCP/HTTP load balancer used to distribute workloads
across multiple servers. It can be used anywhere from small, simple deployments to large web-scale environments
such as GitHub, Instagram, and Twitter.

1. In Application Overview > Services, add an additional service.


2. Select the new service and fill out the following VM fields in the Configuration Panel:
o Service Name - HAProxy
o Name - HAProxyAHV
o Cloud - Nutanix
o OS - Linux
o VM Name - @@{User_initials}@@-HAProxy-@@{calm_array_index}@@
o vCPUs - 2
o Cores per vCPU - 1
o Memory (GiB) - 4
o Select Guest Customization
▪ Type - Cloud-init
▪ Script -
▪ #cloud-config
▪ users:
▪ - name: centos
▪ ssh-authorized-keys:
▪ - @@{CENTOS.public_key}@@
▪ sudo: ['ALL=(ALL) NOPASSWD:ALL']

Under DISK section:

o Device Type - Disk


o Device Bus - SCSI
o Image - CentOS_7_Cloud
o Select Bootable

Under Network section:

o Select under Network Adapters (NICs)


o NIC 1 - Primary
o Private IP - Dynamic

Under Connection section:

P a g e | 56
Calm Workshop v2
Nutanix Lab Guide

o Credential - CENTOS
3. Select the Package tab.
4. Specify a Package Name and click Configure install.
o Package Name - HAProxy_PACKAGE
5. Select + Task, and fill out the following fields in the Configuration Panel:
o Name Task - Install_HAProxy
o Type - Execute
o Script Type - Shell
o Endpint (optional) - Leave default
o Credential - CENTOS
o Script -
o #!/bin/bash
o set -ex
o
o sudo yum update -y
o sudo yum install -y haproxy
o sudo setenforce 0
o sudo sed -i 's/enforcing/disabled/g' /etc/selinux/config /etc/selinux/config
o sudo systemctl stop firewalld || true
o sudo systemctl disable firewalld || true
o
o echo "global
o log 127.0.0.1 local0
o log 127.0.0.1 local1 notice
o maxconn 4096
o quiet
o user haproxy
o group haproxy
o defaults
o log global
o mode http
o retries 3
o timeout client 50s
o timeout connect 5s
o timeout server 50s
o option dontlognull
o option httplog
o option redispatch
o balance roundrobin
o # Set up application listeners here.
o listen admin
o bind 127.0.0.1:22002
o mode http
o stats uri /
o frontend http
o maxconn 2000
o bind 0.0.0.0:80
o default_backend servers-http
o backend servers-http" | sudo tee /etc/haproxy/haproxy.cfg
o
o hosts=$(echo "@@{WebServer.address}@@" | tr "," "\n")
o port=80

P a g e | 57
Calm Workshop v2
Nutanix Lab Guide

o
o for host in $hosts
o do echo " server host-${host} ${host}:${port} weight 1 maxconn 100 check" |
sudo tee -a /etc/haproxy/haproxy.cfg
o done
o
o sudo systemctl daemon-reload
o sudo systemctl enable haproxy
o sudo systemctl restart haproxy

Note

Note the use of the @@{WebServer.address}@@ macro in the script above. The macro returns a comma
delimited list of all IPs of the VMs within that service. The script then uses the tr command to replace commas
with carriage returns. The result is an array, $hosts, containing strings of all WebServer IP addresses. Those
addresses are then each added to the HAProxy configuration file.

6. Select the Package tab and click Configure uninstall.


7. Select + Task, and fill out the following fields in the Configuration Panel:
o Name Task - Uninstall_HAProxy
o Type - Execute
o Script Type - Shell
o Credential - CENTOS
o Script -
o #!/bin/bash
o set -ex
o
o sudo
o yum -y erase haproxy
8. Click Save.

1.17 ADDING DEPENDENCIES


As our application will require the database to be running before the web server starts, our Blueprint requires a
dependency to enforce this ordering. There are a couple of ways to do this, one of which you’ve already done
without likely realizing it.

1. In the Application Overview > Application Profile section, expand the Default Application Profile and click the
Create Action.

P a g e | 58
Calm Workshop v2
Nutanix Lab Guide

Take note of the Orange Orchestration Edge going from the MySQL Start task to the WebServer Package Install
task. This edge was automatically created by Calm due to the @@{MySQL.address}@@ macro reference in the
WebServer Package Install task. Since the system needs to know the IP Address of the MySQL service prior to
being able to proceed with the WebServer Install task, Calm intelligently creates the orchestration edge for you.
This requires the MySQL service to be started prior to moving on to the WebServer Install task.

2. Return to the HAProxy Package Install task, why are orchestration edges automatically created between the
WebServer and HAProxy services?
3. Next, select the Stop Profile Action.

Note that lack of orchestration edges between services when stopping an application. Why might issuing
shutdown commands to all services within the application simultaneously create an issue?

4. Click on each Profile Action to take note of the current presence (or lack thereof) of the orchestration edges.

P a g e | 59
Calm Workshop v2
Nutanix Lab Guide

To resolve this, you’ll manually define a dependencies between services.

5. Select the WebServer Service and click the Create Dependency icon that appears above the Service icon, and
then click on the MySQL service.

6. This represents that the WebServer service “depends” upon the MySQL service, meaning the MySQL service will
start before, and stop after, the WebServer service.
7. Now create a dependency for the HAProxy service to depend on the WebServer service.
8. Click Save.
9. Re-visit the Profile Actions and confirm the edges now properly reflect the dependencies between the services,
as shown below:

P a g e | 60
Calm Workshop v2
Nutanix Lab Guide

Drawing the white dependency arrows will cause Calm to create orchestration edges for all System Defined
Profile Actions (Create, Start, Restart, Stop, Delete, and Soft Delete).

1.18 LAUNCHING AND MANAGING THE APPLICATION


1. From the upper toolbar in the Blueprint Editor, click Launch.
2. Specify a unique Application Name (e.g. Initials-CalmLinuxIntro1) and your User_initials Runtime variable value
for VM naming.
3. Click Create.

The Audit tab can be used to monitor the deployment of the application.

P a g e | 61
Calm Workshop v2
Nutanix Lab Guide

P a g e | 62
Calm Workshop v2
Nutanix Lab Guide

Why don’t all of the CentOS based services deploy at the same time following the download of the disk image?
Look at the Adding Dependencies part of this module for the answer…

4. Once the application reaches a Running status (approx. 20 minutes after you have launched the Blueprint),

navigate to the Services tab and select the HAProxy service to determine the IP address of your load balancer.

5. In a new browser tab or window, navigate to http://<HAProxy-IP>, and verify your Task Manager application is
functioning.

Note

You can also click the link in the Description of the Application. Or click the icon and click on your
application you just created.

P a g e | 63
Calm Workshop v2
Nutanix Lab Guide

1.19 TAKEAWAYS
What are the key things you should know about Nutanix Calm?

• Nutanix Calm, as a native component of Prism, is built on and carries forward the benefits of the platform. The
simplicity provided by Acropolis lets Calm focus on applications, rather than trying to mask the complexity of the
underlying infrastructure management.
• Calm blueprints are easy to use. In 60 minutes you went from nothing to a full infrastructure stack deployment.
Because Calm uses standard tools for configuration - bash, PowerShell, Python, etc. - there’s no new language to
learn and you can immediately apply skills and code you already have.
• The Blueprint Editor provides a simple UI for modeling potentially complex applications.
• Blueprints are tied to Projects which can be used to enforce quotas and role based access control.
• Having a Blueprint install and configure binaries means no longer creating specific images for individual
applications. Instead the application can be modified through changes to the Blueprint or installation script,
both of which can be stored in source code repositories.
• Variables allow another dimension of customizing an application without having to edit the underlying Blueprint.

P a g e | 64
Calm Workshop v2
Nutanix Lab Guide

• There are multiple ways of authenticating to a VM (keys or passwords), which is dependent upon the source
image.
• Application status can be monitored in real time.
• Applications typically span across multiple VMs, each responsible for different services. Calm is capable of
automated and orchestrating full applications.
• Dependencies between services can be easily modeled in the Blueprint Editor.
• Users can quickly provision entire application stacks for production or testing for repeatable results without time
lost to manual configuration.
• Interested in using Calm for more app lifecycle operations?

P a g e | 65
Calm Workshop v2
Nutanix Lab Guide

2 Lab Day 2
to gain the financial, business and operational benefits of Xi Leap DRaaS, and engaged Nutanix Services to design its
future-state DR solution to support both its existing and future workloads using Nutanix Leap and Xi Leap software.
The goal is to enable the establishment of a highly efficient next-generation DR solution on Nutanix recommended
practices.

2.1 DOCUMENT PURPOSE


The purpose of the Architecture Design document is to provide <<Enter Customer Name Here>> with a design
blueprint for its new DR solution based on Nutanix. The design addresses conceptual, logical and physical design
elements with design decisions throughout the document to justify each infrastructure design choice.

2.2 AUDIENCE
This document is intended for team members planning, designing and/or implementing the components of a Xi Leap
DRaaS solution. The audience includes but is not limited to the roles defined in the table below.

P a g e | 66
Calm Workshop v2
Nutanix Lab Guide

3 Lab Day 3
to gain the financial, business and operational benefits of Xi Leap DRaaS, and engaged Nutanix Services to design its
future-state DR solution to support both its existing and future workloads using Nutanix Leap and Xi Leap software.
The goal is to enable the establishment of a highly efficient next-generation DR solution on Nutanix recommended
practices.

3.1 DOCUMENT PURPOSE


The purpose of the Architecture Design document is to provide <<Enter Customer Name Here>> with a design
blueprint for its new DR solution based on Nutanix. The design addresses conceptual, logical and physical design
elements with design decisions throughout the document to justify each infrastructure design choice.

3.2 AUDIENCE
This document is intended for team members planning, designing and/or implementing the components of a Xi Leap
DRaaS solution. The audience includes but is not limited to the roles defined in the table below.

P a g e | 67
Calm Workshop v2
Nutanix Lab Guide

A. Glossary
Term Definition

AHV Acropolis Hypervisor

Availability Zone A physically isolated site where you can replicate the data that you
want to protect. An availability zone can either be in a physical
datacenter (on-prem) or the Xi Cloud Services. An instance of Prism
Central represents an availability zone.

Category A category is a key-value pair that groups similar VMs. Associating a


policy with a category ensures that the policy applies to all the VMs
in the group regardless of how the group scales with time.

EBGP External Border Gateway Protocol

ESXi vSphere ESXi

IPsec IP Security

PBR Policy based Routing

PC Prism Central

PE Prism Element

Protection Policy A configurable policy that schedules recovery points of VMs and
replicates those recovery points to a recovery site.

Recovery Plan A configurable policy that orchestrates the recovery of VMs at the
recovery site.

Recovery point A recovery point is a copy of the state of a system at a particular


point in time. A recovery point in Leap refers to a snapshot.

Recovery Point Objective The time period from failure event to the restored service. For
example, an RTO of 30 minutes enables you to back up and run VMs
in 30 minutes in the event failure.

P a g e | 68
Calm Workshop v2
Nutanix Lab Guide

Term Definition

Recovery Time Objective A time interval that refers to the acceptable data loss when there is
a failure. For example, if the RPO is 1 hour, the system creates a
recovery point every 1 hour. In the event of a recovery, you can
recover VMs with data as of up to 1 hour ago.

Subnet IP subnet in Xi Cloud

vCenter vSphere vCenter server

VPC Virtual Private Cloud

VPN Virtual Private Network

Xi Leap Nutanix Xi Leap

P a g e | 69
Calm Workshop v2

You might also like