Introduction
|
Cloud computing is very flexible and has many diverse uses.
Setup of Compute Canada cloud environments is left to its users.
In this course we will setup a cloud environment to run WordPress.
We will see methods to easy setup of cloud environments.
|
How the Internet works
|
Computers often have an IP on a LAN and connect to the Internet through a router.
You can see what your computer’s IP address is by using either ipconfig on windows or ifconfig commands on linux or Mac.
You can see your computer’s public IP using the site ipv4.icanhazip.com.
Ports allow computers and routers to differentiate types network traffic.
|
Introduction to cloud computing
|
Elasticity refers to the ability to scale devices up or down to meet demand.
A Virtual Machine or Virtual Device is simulated with software running on physical hardware.
A cloud allows one to borrow or rent virtual devices on-demand.
Infrastructure as a Service (IaaS): the service provider provides you with the ability to create and manage virtual devices. You have complete control over VM configuration.
Platform as a Service (PaaS): the service provider provides you with an environment to build and setup your software.
Software as a Service (SaaS): the service provider provides the software and all the infrastructure and operating system configuration and management required to run the software. (e.g. gmail).
OpenStack is a cloud operating system which allows you to manage your virtual devices.
|
Creating a keypair
|
A shell is a text based method for interacting with a computer.
SSH is a Secure SHell that allows remote interaction with a computer.
An SSH key pair allows a user to be authenticated on a remote computer.
The Linux filesystem is a tree with / at the root and directories creating branches.
The cd command is used to change directories.
The pwd command is used to display the current working directory.
The ls command is used to list the directory structure.
The ssh-keygen command is used to create key pairs.
The cat command is used print the contents of a file to the terminal.
The chmod command is used change the file mode or permissions.
The private key, id_rsa , must only be readable and writable by the file’s owner.
|
Creating a virtual machine
|
The flavor of a VM prescribes the hardware profile of the VM.
A boot source specifies from what the VM should boot.
A public key must be inject into the VM in order to connect to it.
A floating IP must be added to a VM to connect to it from outside the local network in the cloud.
Port 22 must be opened in the security rules to allow SSH to connect to the VM.
A security group controls which ports to allow traffic in and out on.
|
Creating a persistent virtual machine
|
p flavors or persistent flavors can have their VCPUs oversubscribed by up to 8 times.
A volume is a virtual hard drive allowing its contents to persist from one VM to the next.
p flavors should typically boot from a volume.
A p flavor not booting from a volume will have an unusably small root disk.
|
Applying updates
|
Use sudo apt update to update the package list.
Use sudo apt upgrade to upgrade packages.
Reboot after updates have been installed.
You may need to repeat the apt update , apt upgrade , reboot process a few times to ensure all updates have been applied.
|
Creating a web server
|
Use apt search to find a specific package name.
Backup configuration files before making changes.
The apache2ctrl command is used to manage the apache web service.
The systemctl command is used to manage system services.
|
Installing MySQL
|
MySQL also has a ‘root’ account that is used to manage the MySQL server, this is different from the operating system ‘root’ account used to manage the operating system.
The mysql command allows you to view and modify MySQL databases.
The SHOW DATABASES command shows the available databases in your MySQL server.
The USE command switches which database you actively working with.
The SHOW TABLES command shows the tables in the active database.
The DESCRIBE <table> command displays data columns present in the given table.
The SELECT command displays rows from a table.
The UPDATE command is used to modify rows in a table.
The EXIT command exits the mysql program.
|
Installing PHP
|
|
Creating a Self-Signed SSL Certificate
|
|
Creating a WordPress site
|
|
Installing OpenStack CL client
|
The CL client can be used to manager your OpenStack project from any computer connected to the Internet.
The OpenStack RC file provides settings to connect the CL client with your cloud project.
The source command is used to apply settings in a file to your shell environment.
|
Using the OpenStack CL client
|
openstack help shows the list of available commands.
openstack help <command-group> shows the list of sub commands matching <command-group> .
openstack help <command-group> <command> shows the help text for <command> .
It is important to keep track of the volume disk type.
|
Automating with cloud-init
|
User data provided to a VM can be either a cloud-config or script file.
User data can be set using the --user-data on the command line or using the Post-Creation tab when launching a VM within horizon.
Cloud-init can be used to automate the initial installation of configuration of software
Cloud-init runs once after the first boot of a newly crated VM
|
Bash Scripting
|
A for loop executes commands multiple times while changing the loop variable each iteration.
A stream is a sequence of data elements which are made available over time.
The echo command sends a string to a stream.
The head command displays the begging of a file or stream.
Pipes | are used to pipe the output of one command to the input of the next.
tr translates characters in one set to corresponding characters in another set.
Redirects < ,> are used to redirect output and input to files or streams.
sed is a stream editor which can be used to replace one string with another in a stream.
|
YAML
|
YAML is a format to store data in a way that is human readable.
A YAML file can be validated using yamllint.
White space is important in YAML.
Indentation indicates scope.
Block notation (indicated with a | ) is used to preserver newline characters.
|
Cloud-config
|
|
Using Heat Orchestration Templates (HOT)
|
|
Creating HOTs
|
|