IP | Cluster IP |
Username | Cluster User |
Password | Cluster Pass |
Welcome to the Calm Hands-On-Lab - Simple Blueprint. What we’re going to do here is make a basic blueprint:
This is a basic MySQL Deployment. In this lab we’ll start with a very basic, single service.
Service: One tier of a multiple tier application. This can be made up of 1 more VMs (or existing machines) that all have the same config and do the same thing
Application (App): A whole application with multiple parts that are all working towards the same thing (for example, a Web Application might be made up of an Apache Server, a MySQL database and a HAProxy Load balancer. Alone each service doesn’t do much, but as a whole they do what they’re supposed to).
Macro: A Calm construct that is evaluated and expanded before being ran on the target machine. Macros and Variables are denoted in the @@{[name]}@@ format in the scripts.
Subtrate: A Calm object used to encapsulate the VM(s) within a Blueprint
This section provides the steps to create a simple service.
Note
In general, the Blueprint creation flow goes:
Let’s get started by setting up the basics
Update the Blueprint Name to Calm_Workshop
Click on the Credentials button along the top of the Blueprint workspace. Update credentials as follows:
Name | CENTOS |
Username | root |
Secret | Password |
Password | nutanix/4u |
Use as Default | Checked |
Note
Credentials are unique per Blueprint.
In this subsection we’ll create some variables. It’s not necessary to do it at this point, however it will make things easier for the rest of the lab.
Setup the variables as specified in the table below:
Variable Name | Value |
Mysql_user | root |
Mysql_password | nutanix/4u |
Database_name | homestead |
App_git_link | https://github.com/ideadevice/quickstart-basic.git |
We’ll now create the basic service.
VM Name . : MYSQL
Image . : CentOS
Disk Type .: DISK
Device Bus : SCSI
vCPU . : 2
Core/vCPU .: 1
Memory : 4 GB
#!/bin/bash
set -ex
yum install -y "http://repo.mysql.com/mysql-community-release-el7.rpm"
yum update -y
yum install -y mysql-community-server.x86_64
/bin/systemctl start mysqld
#Mysql secure installation
mysql -u root<<-EOF
#UPDATE mysql.user SET Password=PASSWORD('@@{Mysql_password}@@') WHERE User='@@{Mysql_user}@@';
DELETE FROM mysql.user WHERE User='@@{Mysql_user}@@' AND Host NOT IN ('localhost', '127.0.0.1', '::1');
DELETE FROM mysql.user WHERE User='';
DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%';
FLUSH PRIVILEGES;
EOF
sudo yum install firewalld -y
sudo service firewalld start
sudo firewall-cmd --add-service=mysql --permanent
sudo firewall-cmd --reload
#mysql -u @@{Mysql_user}@@ -p@@{Mysql_password}@@ <<-EOF
mysql -u @@{Mysql_user}@@ <<-EOF
CREATE DATABASE @@{Database_name}@@;
GRANT ALL PRIVILEGES ON homestead.* TO '@@{Database_name}@@'@'%' identified by 'secret';
FLUSH PRIVILEGES;
EOF
#!/bin/bash
echo "Goodbye!"
Now that the blueprint has been created and saved, you can launch it!
Note
Every launch performed requires a name change, making each launch unique - this can be done by incrementing the suffix in the name.
You’ve successfully created a blueprint, and launched it as an application.