Lab - Nutanix Calm Workshop
Lab - Nutanix Calm Workshop
05
Calm Workshop v2
Nutanix Lab Guide
Contents
A. GLOSSARY .............................................................................................................. 68
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.
P a g e |3
Calm Workshop v2
Nutanix Lab Guide
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.
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.
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
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.
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.
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.
2. Select Blueprints in the left hand toolbar to view and manage Calm blueprints.
P a g e | 10
Calm Workshop v2
Nutanix Lab Guide
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.
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
P a g e | 12
Calm Workshop v2
Nutanix Lab Guide
Note:If you don’t see the Save and Back buttons, make sure your browser screen is maximized.
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
P a g e | 14
Calm Workshop v2
Nutanix Lab Guide
4.
5. Click Save.
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
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
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
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.
Note
This defines the name of the substrate within Calm. Names can only contain alphanumeric characters, spaces,
and underscores.
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.
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. 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.
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
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.
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
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
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.
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.
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.
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.
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
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).
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.
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.
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
P a g e | 38
Calm Workshop v2
Nutanix Lab Guide
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.
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
P a g e | 40
Calm Workshop v2
Nutanix Lab Guide
Note
If you don’t see the Save and Back buttons, make sure your browser screen is maximized.
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):
P a g e | 42
Calm Workshop v2
Nutanix Lab Guide
2.
3. Click Save.
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
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
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
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.
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.
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. 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.
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
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.
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
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
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.
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.
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.
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.
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
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).
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.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.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
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.
IPsec IP Security
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 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.
P a g e | 69
Calm Workshop v2