SlideShare a Scribd company logo
1 of 8
Download to read offline
SoftLayer
Getting Started
http://sftlyr.com/dockerlab
Today we will be exploring automation and devops tools that can help manage a SoftLayer deployment.
We will be using:
softlayer-python: A Python library that provides raw API access, a simplified manager layer for SoftLayer services, and a command line
tool. – https://github.com/softlayer/softlayer-python
SaltStack: A server and infrastructure management utility. This tool allows for central management of multiple devices. In our case we
will use it to issue commands to ‘minion’ servers rather than logging into them directly. - http://www.saltstack.com/
Docker: Docker is a utility to build, ship, and run, applications in Linux Containers(LXC) - https://www.docker.com/
Ghost: Ghost is a blogging application written in nodejs. Along with being awesome, it is simple to setup and setting up a Ghost blog will
be the goal of this lab. - https://ghost.org/
When issuing commands look for words in: BLUE. These words will need to be changed to fit your lab environment.
Each section has a corresponding command. Section 1 has the command “1”, section 2 has the command “2” and so on.
Prerequisites
An SSH Client
• Windows

Putty.exe ( http://www.putty.org/ )
• Linux/Mac

You should already have an SSH client which you can access through a terminal with the command ssh.
A Brief Overview
The diagram below is an example Salt deployment. salt.lablayer.info is the salt-master. The salt-master is able to control and issue
commands to salt-minions. These minions are identified in this topology as minion01 & minion02.
Part 1: Logging in to the salt-master
We have already created the salt-master for you, so all you need to do now is get the login credentials from the portal, and login with
ssh.
1. Navigate to - https://control.softlayer.com
2. Login using the credentials provided.
3. Go to Devices -> Device List and click the little triangle to expand the panel.
4. Click “Show Password” to display the password for your server (it should be called salt.username.lablayer.info)
5. Locate the Public IP listed for your server
6. SSH the salt-master with the Public IP and password located in steps 4 & 5.
$> ssh root@<Public IP>
Part 2: Configuring the Python CLI
The python CLI is an open source tool that simplifies the use of the SoftLayer API. The salt-master already has the softlayer-python
library installed. Before we can use it though, we must give it our account credentials.
1. Start the configuration process with slcli config setup
2. When prompted enter your lab username
3. When prompted enter your lab password(not the password to your salt-master)
4. When prompted for Endpoint URL, enter public
An example of Part 2 steps 1-4
We can test that the if the configuration was successful by running slcli vs list. You should see a listing of virtual machines on your
account. If not, please ask for assistance.
Step 3: SSH Keys
An SSH Key is a pair of very large numbers: A Public Key, a number which acts as a lock and is installed on the server you want to login
to, and a Private Key, a number which acts as the actual key. When you login to a server that has a Public key that matches your Private
key, no password is needed to login to the server. SoftLayer supports provisioning servers with your Public Key. When a server is created
with a Public Key, it is not necessary to log into the portal to locate it’s password.
1. Create your Public and Private keys with ssh-keygen
2. You will be prompted 3 times for input. Each time hit enter to accept the default configurations
3. Upload your Public Key to SoftLayer the SoftLayer API: slcli sshkey add --in-file=/root/.ssh/id_rsa.pub test01
4. Keep track of the Public Key Label(your lab username), as you will need to specify it when creating new servers.
5. Treat your Private Key like a password; don’t share it with anyone.
Step 4: Creating the salt-minion
Salt is a server management system that takes the pain and suffering out of managing servers. We already have a salt-master, so now
we just need to create a salt-minion.
$> slcli vs create --datacenter=hkg02 --hostname=minion01 --domain=test01.lablayer.info --
billing hourly --key=test01 --cpu=1 --memory=1024 --image=05c8ee79-66d1-4127-9907-
f130e9074e5e
This will create a new virtual server. Make sure to specify your Public Key Label.
Keep an eye on the transaction process with the following command.
$> slcli vs detail <VS ID>
Once the “active_transaction” section is “-“, we can continue.
Step 5: Configuring the Minion
To get the salt-minion working, we just have to tell it which IP address the salt-master server is located at. This will be the Public IP you
used in section 1.
1. Configure the salt-minion with the salt-master IP address with ssh <salt-minion IP> “echo ‘master: <salt-master
IP>’ > /etc/salt/minion.d/master.conf”
2. Restart the salt-minion process with ssh <minion IP> “service salt-minion restart”
Step 6: Working with Salt
Now that we have taught the salt-minion about the salt-master it is time to teach the salt-master about the salt-minion.
1. Find all the servers attempting to connect to the salt-master with salt-key –L
2. Accept the salt-minion with salt-key -A -y
3. Test the salt configuration with salt ‘*’ test.ping
4. See all support salt commands with salt ‘*’ sys.doc
This will give you a VERY long list of all the magic salt can do. But for now we are just going to focus on cmd.run, which will let you
run commands remotely.
5. Test cmd.run with salt ‘*’ cmd.run ‘free –m’
Step 7: Docker
Docker (https://www.docker.com/whatisdocker/) is a utility that helps you easily deploy applications. Combined with salt, we barely have
to even think about our servers anymore. So let’s get started
Docker has a wide variety of other containers which you can check out (https://registry.hub.docker.com/) or just build your own, but today
we are going to install Ghost (https://ghost.org/) which is a neat little blogging platform.
The first command may take a few minutes to complete.
$> salt ‘*’ state.highstate
This will compile the salt state files, and apply them to all matching hosts.
Put minion01’s Public IP address into your browser and see if you get a welcome page.
Feel free to mess around with the Ghost blog to see what it can do. Hopefully this presentation wasn’t too overwhelming, if you have any
questions please let us know.
Salt State File:
Located in /srv/salt these 2 files tell salt exactly what to do to reach its “highstate”.
First is the /srv/salt/top.sls file, this is where salt starts looking. In our “BASE” definition, we want to apply the config
to “*” or all servers. And it will apply whats in the “docker” folder. When just a single folder like this is specified, salt
will look for a /srv/salt/docker/init.sls file.
/srv/salt/docker/init.sls tells salt to pull in the “ghost” latest image from the docker registry.
It sets up the container, with its proper port bindings, and then makes sure its running.
Step 8: Creating your domain
A properly configured domain name prevents us from having to remember all these IP addresses, so lets set that up now. We are going to
be using the lablayer.info domain. To make this easy, we will use the SoftLayer Python CLI tool.
Instead of test01, use your username.
$> slcli dns create test01.lablayer.info

$> slcli dns add test01.lablayer.info salt-master A <MASTER IP>

$> slcli dns add test01.lablayer.info minion01 A <MINION IP>

$> slcli dns list test01.lablayer.info



More Related Content

What's hot

Connect Amazon EC2 Linux Instance
Connect Amazon EC2 Linux InstanceConnect Amazon EC2 Linux Instance
Connect Amazon EC2 Linux InstanceVCP Muthukrishna
 
How To Connect Amazon AWS EC2 with Key Pair – Linux
How To Connect Amazon AWS EC2 with Key Pair – LinuxHow To Connect Amazon AWS EC2 with Key Pair – Linux
How To Connect Amazon AWS EC2 with Key Pair – LinuxVCP Muthukrishna
 
Build your own secure mail server on the cloud using Amazon Web Services
Build your own secure mail server on the cloud using Amazon Web ServicesBuild your own secure mail server on the cloud using Amazon Web Services
Build your own secure mail server on the cloud using Amazon Web Servicesponukumatla joel nishanth
 
Cloudera amazon-ec2
Cloudera amazon-ec2Cloudera amazon-ec2
Cloudera amazon-ec2Randy Zwitch
 
How To Create EC2 instance Linux Server
How To Create EC2 instance Linux ServerHow To Create EC2 instance Linux Server
How To Create EC2 instance Linux ServerVCP Muthukrishna
 
How To Deploy A Cloud Based Webserver in 5 minutes - LAMP
How To Deploy A Cloud Based Webserver in 5 minutes - LAMPHow To Deploy A Cloud Based Webserver in 5 minutes - LAMP
How To Deploy A Cloud Based Webserver in 5 minutes - LAMPMatt Dunlap
 
Setting up a kubernetes cluster on ubuntu 18.04- loves cloud
Setting up a kubernetes cluster on ubuntu 18.04- loves cloudSetting up a kubernetes cluster on ubuntu 18.04- loves cloud
Setting up a kubernetes cluster on ubuntu 18.04- loves cloudLoves Cloud
 
How to Configure Amazon AWS EC2 Elastic IP Address
How to Configure Amazon AWS EC2 Elastic IP AddressHow to Configure Amazon AWS EC2 Elastic IP Address
How to Configure Amazon AWS EC2 Elastic IP AddressVCP Muthukrishna
 
How To Install and Configure Salt Master on Ubuntu
How To Install and Configure Salt Master on UbuntuHow To Install and Configure Salt Master on Ubuntu
How To Install and Configure Salt Master on UbuntuVCP Muthukrishna
 
How To Install and Configure Apache SSL on CentOS 7
How To Install and Configure Apache SSL on CentOS 7How To Install and Configure Apache SSL on CentOS 7
How To Install and Configure Apache SSL on CentOS 7VCP Muthukrishna
 
Aegir presentation
Aegir presentationAegir presentation
Aegir presentationMindtrades
 
Jenkins log monitoring with elk stack
Jenkins log monitoring with elk stackJenkins log monitoring with elk stack
Jenkins log monitoring with elk stackSubhasis Roy
 
How To Check IE Enhanced Security Is Enabled Windows PowerShell
How To Check IE Enhanced Security Is Enabled Windows PowerShellHow To Check IE Enhanced Security Is Enabled Windows PowerShell
How To Check IE Enhanced Security Is Enabled Windows PowerShellVCP Muthukrishna
 
Keep Your Servers in GitHub
Keep Your Servers in GitHubKeep Your Servers in GitHub
Keep Your Servers in GitHubYegor Bugayenko
 
Securing docker containers
Securing docker containersSecuring docker containers
Securing docker containersMihir Shah
 
How To Install and Configure Splunk on RHEL 7 in AWS
How To Install and Configure Splunk on RHEL 7 in AWSHow To Install and Configure Splunk on RHEL 7 in AWS
How To Install and Configure Splunk on RHEL 7 in AWSVCP Muthukrishna
 
How To Install and Configure AWS CLI on RHEL 7
How To Install and Configure AWS CLI on RHEL 7How To Install and Configure AWS CLI on RHEL 7
How To Install and Configure AWS CLI on RHEL 7VCP Muthukrishna
 

What's hot (20)

Connect Amazon EC2 Linux Instance
Connect Amazon EC2 Linux InstanceConnect Amazon EC2 Linux Instance
Connect Amazon EC2 Linux Instance
 
How To Connect Amazon AWS EC2 with Key Pair – Linux
How To Connect Amazon AWS EC2 with Key Pair – LinuxHow To Connect Amazon AWS EC2 with Key Pair – Linux
How To Connect Amazon AWS EC2 with Key Pair – Linux
 
Build your own secure mail server on the cloud using Amazon Web Services
Build your own secure mail server on the cloud using Amazon Web ServicesBuild your own secure mail server on the cloud using Amazon Web Services
Build your own secure mail server on the cloud using Amazon Web Services
 
Cloudera amazon-ec2
Cloudera amazon-ec2Cloudera amazon-ec2
Cloudera amazon-ec2
 
L5 swagger
L5 swaggerL5 swagger
L5 swagger
 
How To Create EC2 instance Linux Server
How To Create EC2 instance Linux ServerHow To Create EC2 instance Linux Server
How To Create EC2 instance Linux Server
 
How To Deploy A Cloud Based Webserver in 5 minutes - LAMP
How To Deploy A Cloud Based Webserver in 5 minutes - LAMPHow To Deploy A Cloud Based Webserver in 5 minutes - LAMP
How To Deploy A Cloud Based Webserver in 5 minutes - LAMP
 
Setting up a kubernetes cluster on ubuntu 18.04- loves cloud
Setting up a kubernetes cluster on ubuntu 18.04- loves cloudSetting up a kubernetes cluster on ubuntu 18.04- loves cloud
Setting up a kubernetes cluster on ubuntu 18.04- loves cloud
 
How to Configure Amazon AWS EC2 Elastic IP Address
How to Configure Amazon AWS EC2 Elastic IP AddressHow to Configure Amazon AWS EC2 Elastic IP Address
How to Configure Amazon AWS EC2 Elastic IP Address
 
How To Install and Configure Salt Master on Ubuntu
How To Install and Configure Salt Master on UbuntuHow To Install and Configure Salt Master on Ubuntu
How To Install and Configure Salt Master on Ubuntu
 
Commands
CommandsCommands
Commands
 
Step by-step installation of a secure linux web dns- and mail server
Step by-step installation of a secure linux web  dns- and mail serverStep by-step installation of a secure linux web  dns- and mail server
Step by-step installation of a secure linux web dns- and mail server
 
How To Install and Configure Apache SSL on CentOS 7
How To Install and Configure Apache SSL on CentOS 7How To Install and Configure Apache SSL on CentOS 7
How To Install and Configure Apache SSL on CentOS 7
 
Aegir presentation
Aegir presentationAegir presentation
Aegir presentation
 
Jenkins log monitoring with elk stack
Jenkins log monitoring with elk stackJenkins log monitoring with elk stack
Jenkins log monitoring with elk stack
 
How To Check IE Enhanced Security Is Enabled Windows PowerShell
How To Check IE Enhanced Security Is Enabled Windows PowerShellHow To Check IE Enhanced Security Is Enabled Windows PowerShell
How To Check IE Enhanced Security Is Enabled Windows PowerShell
 
Keep Your Servers in GitHub
Keep Your Servers in GitHubKeep Your Servers in GitHub
Keep Your Servers in GitHub
 
Securing docker containers
Securing docker containersSecuring docker containers
Securing docker containers
 
How To Install and Configure Splunk on RHEL 7 in AWS
How To Install and Configure Splunk on RHEL 7 in AWSHow To Install and Configure Splunk on RHEL 7 in AWS
How To Install and Configure Splunk on RHEL 7 in AWS
 
How To Install and Configure AWS CLI on RHEL 7
How To Install and Configure AWS CLI on RHEL 7How To Install and Configure AWS CLI on RHEL 7
How To Install and Configure AWS CLI on RHEL 7
 

Viewers also liked

GRDS International ECG proceedings,October 2016,Hongkong
GRDS International ECG proceedings,October 2016,HongkongGRDS International ECG proceedings,October 2016,Hongkong
GRDS International ECG proceedings,October 2016,HongkongGlobal R & D Services
 
M Solutions Referenties
M Solutions ReferentiesM Solutions Referenties
M Solutions Referentiesgarrowiersema
 
Unit a at marina bay club naples florida.text.marked
Unit a at marina bay club naples florida.text.markedUnit a at marina bay club naples florida.text.marked
Unit a at marina bay club naples florida.text.markedVineyards Naples
 
Lucha corrupcion en colombia
Lucha corrupcion en colombiaLucha corrupcion en colombia
Lucha corrupcion en colombiajulian ba
 
Investigação(Marco 5ºC)
Investigação(Marco 5ºC)Investigação(Marco 5ºC)
Investigação(Marco 5ºC)tuchav
 
The pearl at vineyards naples florida.text.marked
The pearl at vineyards naples florida.text.markedThe pearl at vineyards naples florida.text.marked
The pearl at vineyards naples florida.text.markedVineyards Naples
 
Location Recce
Location Recce Location Recce
Location Recce greenie101
 

Viewers also liked (15)

Microempresa
MicroempresaMicroempresa
Microempresa
 
GRDS International ECG proceedings,October 2016,Hongkong
GRDS International ECG proceedings,October 2016,HongkongGRDS International ECG proceedings,October 2016,Hongkong
GRDS International ECG proceedings,October 2016,Hongkong
 
M Solutions Referenties
M Solutions ReferentiesM Solutions Referenties
M Solutions Referenties
 
Unit a at marina bay club naples florida.text.marked
Unit a at marina bay club naples florida.text.markedUnit a at marina bay club naples florida.text.marked
Unit a at marina bay club naples florida.text.marked
 
SavingMoreNowIG
SavingMoreNowIGSavingMoreNowIG
SavingMoreNowIG
 
Teks anekdot
Teks anekdotTeks anekdot
Teks anekdot
 
Lucha corrupcion en colombia
Lucha corrupcion en colombiaLucha corrupcion en colombia
Lucha corrupcion en colombia
 
7
77
7
 
Işik ve Ses
Işik ve SesIşik ve Ses
Işik ve Ses
 
Investigação(Marco 5ºC)
Investigação(Marco 5ºC)Investigação(Marco 5ºC)
Investigação(Marco 5ºC)
 
The pearl at vineyards naples florida.text.marked
The pearl at vineyards naples florida.text.markedThe pearl at vineyards naples florida.text.marked
The pearl at vineyards naples florida.text.marked
 
Insuficiencia renal cronica
Insuficiencia renal cronicaInsuficiencia renal cronica
Insuficiencia renal cronica
 
Hipoglicemia en diabéticos
Hipoglicemia en diabéticosHipoglicemia en diabéticos
Hipoglicemia en diabéticos
 
Florencia frau
Florencia frauFlorencia frau
Florencia frau
 
Location Recce
Location Recce Location Recce
Location Recce
 

Similar to SoftLayer-demoLabV3

SaltStack's NetAPI at Photobucket - Denver SaltStack Meetup
SaltStack's NetAPI at Photobucket - Denver SaltStack MeetupSaltStack's NetAPI at Photobucket - Denver SaltStack Meetup
SaltStack's NetAPI at Photobucket - Denver SaltStack MeetupJon Henry
 
Definitive guide to setting up a lamp server using open source software
Definitive guide to setting up a lamp server using open source softwareDefinitive guide to setting up a lamp server using open source software
Definitive guide to setting up a lamp server using open source softwareparves kamal
 
Automating the Cloud with Terraform, and Ansible
Automating the Cloud with Terraform, and AnsibleAutomating the Cloud with Terraform, and Ansible
Automating the Cloud with Terraform, and AnsibleBrian Hogan
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power pointjustmeanscsr
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power pointjustmeanscsr
 
Laravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello ProductionLaravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello ProductionJoe Ferguson
 
Deploying Rails applications with Moonshine
Deploying Rails applications with MoonshineDeploying Rails applications with Moonshine
Deploying Rails applications with MoonshineRobot Mode
 
Getting started with AWS
Getting started with AWSGetting started with AWS
Getting started with AWSJungwon Seo
 
Apache web server tutorial for linux
Apache web server tutorial for linuxApache web server tutorial for linux
Apache web server tutorial for linuxSahad Sali
 
Scaling on EC2 in a fast-paced environment (LISA'11 - Full Paper)
Scaling on EC2 in a fast-paced environment (LISA'11 - Full Paper)Scaling on EC2 in a fast-paced environment (LISA'11 - Full Paper)
Scaling on EC2 in a fast-paced environment (LISA'11 - Full Paper)Nicolas Brousse
 
Diva23
Diva23Diva23
Diva23diva23
 
Configuration of Apache Web Server On CentOS 8
Configuration of Apache Web Server On CentOS 8Configuration of Apache Web Server On CentOS 8
Configuration of Apache Web Server On CentOS 8Kaan Aslandağ
 
(DVO306) AWS CodeDeploy: Automating Your Software Deployments
(DVO306) AWS CodeDeploy: Automating Your Software Deployments(DVO306) AWS CodeDeploy: Automating Your Software Deployments
(DVO306) AWS CodeDeploy: Automating Your Software DeploymentsAmazon Web Services
 
Project-make a public website server using raspberry pi
Project-make a public website server using raspberry piProject-make a public website server using raspberry pi
Project-make a public website server using raspberry piFahim Hossain
 
Configuration Management and Salt
Configuration Management and SaltConfiguration Management and Salt
Configuration Management and Salt55020
 
Tutorial CentOS 5 untuk Webhosting
Tutorial CentOS 5 untuk WebhostingTutorial CentOS 5 untuk Webhosting
Tutorial CentOS 5 untuk WebhostingBeni Krisbiantoro
 
Setting up the hyperledger composer in ubuntu
Setting up the hyperledger composer in ubuntuSetting up the hyperledger composer in ubuntu
Setting up the hyperledger composer in ubuntukesavan N B
 
Using aphace-as-proxy-server
Using aphace-as-proxy-serverUsing aphace-as-proxy-server
Using aphace-as-proxy-serverHARRY CHAN PUTRA
 

Similar to SoftLayer-demoLabV3 (20)

SaltStack's NetAPI at Photobucket - Denver SaltStack Meetup
SaltStack's NetAPI at Photobucket - Denver SaltStack MeetupSaltStack's NetAPI at Photobucket - Denver SaltStack Meetup
SaltStack's NetAPI at Photobucket - Denver SaltStack Meetup
 
Definitive guide to setting up a lamp server using open source software
Definitive guide to setting up a lamp server using open source softwareDefinitive guide to setting up a lamp server using open source software
Definitive guide to setting up a lamp server using open source software
 
Automating the Cloud with Terraform, and Ansible
Automating the Cloud with Terraform, and AnsibleAutomating the Cloud with Terraform, and Ansible
Automating the Cloud with Terraform, and Ansible
 
How to begin with Amazon EC2?
How to begin with Amazon EC2?How to begin with Amazon EC2?
How to begin with Amazon EC2?
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power point
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power point
 
Laravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello ProductionLaravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello Production
 
Deploying Rails applications with Moonshine
Deploying Rails applications with MoonshineDeploying Rails applications with Moonshine
Deploying Rails applications with Moonshine
 
Getting started with AWS
Getting started with AWSGetting started with AWS
Getting started with AWS
 
Apache web server tutorial for linux
Apache web server tutorial for linuxApache web server tutorial for linux
Apache web server tutorial for linux
 
Scaling on EC2 in a fast-paced environment (LISA'11 - Full Paper)
Scaling on EC2 in a fast-paced environment (LISA'11 - Full Paper)Scaling on EC2 in a fast-paced environment (LISA'11 - Full Paper)
Scaling on EC2 in a fast-paced environment (LISA'11 - Full Paper)
 
Diva23
Diva23Diva23
Diva23
 
Configuration of Apache Web Server On CentOS 8
Configuration of Apache Web Server On CentOS 8Configuration of Apache Web Server On CentOS 8
Configuration of Apache Web Server On CentOS 8
 
Mail
MailMail
Mail
 
(DVO306) AWS CodeDeploy: Automating Your Software Deployments
(DVO306) AWS CodeDeploy: Automating Your Software Deployments(DVO306) AWS CodeDeploy: Automating Your Software Deployments
(DVO306) AWS CodeDeploy: Automating Your Software Deployments
 
Project-make a public website server using raspberry pi
Project-make a public website server using raspberry piProject-make a public website server using raspberry pi
Project-make a public website server using raspberry pi
 
Configuration Management and Salt
Configuration Management and SaltConfiguration Management and Salt
Configuration Management and Salt
 
Tutorial CentOS 5 untuk Webhosting
Tutorial CentOS 5 untuk WebhostingTutorial CentOS 5 untuk Webhosting
Tutorial CentOS 5 untuk Webhosting
 
Setting up the hyperledger composer in ubuntu
Setting up the hyperledger composer in ubuntuSetting up the hyperledger composer in ubuntu
Setting up the hyperledger composer in ubuntu
 
Using aphace-as-proxy-server
Using aphace-as-proxy-serverUsing aphace-as-proxy-server
Using aphace-as-proxy-server
 

SoftLayer-demoLabV3

  • 1. SoftLayer Getting Started http://sftlyr.com/dockerlab Today we will be exploring automation and devops tools that can help manage a SoftLayer deployment. We will be using: softlayer-python: A Python library that provides raw API access, a simplified manager layer for SoftLayer services, and a command line tool. – https://github.com/softlayer/softlayer-python SaltStack: A server and infrastructure management utility. This tool allows for central management of multiple devices. In our case we will use it to issue commands to ‘minion’ servers rather than logging into them directly. - http://www.saltstack.com/ Docker: Docker is a utility to build, ship, and run, applications in Linux Containers(LXC) - https://www.docker.com/ Ghost: Ghost is a blogging application written in nodejs. Along with being awesome, it is simple to setup and setting up a Ghost blog will be the goal of this lab. - https://ghost.org/ When issuing commands look for words in: BLUE. These words will need to be changed to fit your lab environment. Each section has a corresponding command. Section 1 has the command “1”, section 2 has the command “2” and so on. Prerequisites An SSH Client • Windows
 Putty.exe ( http://www.putty.org/ ) • Linux/Mac
 You should already have an SSH client which you can access through a terminal with the command ssh.
  • 2. A Brief Overview The diagram below is an example Salt deployment. salt.lablayer.info is the salt-master. The salt-master is able to control and issue commands to salt-minions. These minions are identified in this topology as minion01 & minion02. Part 1: Logging in to the salt-master We have already created the salt-master for you, so all you need to do now is get the login credentials from the portal, and login with ssh. 1. Navigate to - https://control.softlayer.com 2. Login using the credentials provided. 3. Go to Devices -> Device List and click the little triangle to expand the panel. 4. Click “Show Password” to display the password for your server (it should be called salt.username.lablayer.info) 5. Locate the Public IP listed for your server 6. SSH the salt-master with the Public IP and password located in steps 4 & 5. $> ssh root@<Public IP> Part 2: Configuring the Python CLI The python CLI is an open source tool that simplifies the use of the SoftLayer API. The salt-master already has the softlayer-python library installed. Before we can use it though, we must give it our account credentials.
  • 3. 1. Start the configuration process with slcli config setup 2. When prompted enter your lab username 3. When prompted enter your lab password(not the password to your salt-master) 4. When prompted for Endpoint URL, enter public An example of Part 2 steps 1-4 We can test that the if the configuration was successful by running slcli vs list. You should see a listing of virtual machines on your account. If not, please ask for assistance. Step 3: SSH Keys An SSH Key is a pair of very large numbers: A Public Key, a number which acts as a lock and is installed on the server you want to login to, and a Private Key, a number which acts as the actual key. When you login to a server that has a Public key that matches your Private key, no password is needed to login to the server. SoftLayer supports provisioning servers with your Public Key. When a server is created with a Public Key, it is not necessary to log into the portal to locate it’s password. 1. Create your Public and Private keys with ssh-keygen 2. You will be prompted 3 times for input. Each time hit enter to accept the default configurations
  • 4. 3. Upload your Public Key to SoftLayer the SoftLayer API: slcli sshkey add --in-file=/root/.ssh/id_rsa.pub test01 4. Keep track of the Public Key Label(your lab username), as you will need to specify it when creating new servers. 5. Treat your Private Key like a password; don’t share it with anyone. Step 4: Creating the salt-minion Salt is a server management system that takes the pain and suffering out of managing servers. We already have a salt-master, so now we just need to create a salt-minion. $> slcli vs create --datacenter=hkg02 --hostname=minion01 --domain=test01.lablayer.info -- billing hourly --key=test01 --cpu=1 --memory=1024 --image=05c8ee79-66d1-4127-9907- f130e9074e5e This will create a new virtual server. Make sure to specify your Public Key Label. Keep an eye on the transaction process with the following command. $> slcli vs detail <VS ID>
  • 5. Once the “active_transaction” section is “-“, we can continue. Step 5: Configuring the Minion To get the salt-minion working, we just have to tell it which IP address the salt-master server is located at. This will be the Public IP you used in section 1. 1. Configure the salt-minion with the salt-master IP address with ssh <salt-minion IP> “echo ‘master: <salt-master IP>’ > /etc/salt/minion.d/master.conf” 2. Restart the salt-minion process with ssh <minion IP> “service salt-minion restart” Step 6: Working with Salt Now that we have taught the salt-minion about the salt-master it is time to teach the salt-master about the salt-minion. 1. Find all the servers attempting to connect to the salt-master with salt-key –L 2. Accept the salt-minion with salt-key -A -y 3. Test the salt configuration with salt ‘*’ test.ping 4. See all support salt commands with salt ‘*’ sys.doc This will give you a VERY long list of all the magic salt can do. But for now we are just going to focus on cmd.run, which will let you run commands remotely. 5. Test cmd.run with salt ‘*’ cmd.run ‘free –m’
  • 6. Step 7: Docker Docker (https://www.docker.com/whatisdocker/) is a utility that helps you easily deploy applications. Combined with salt, we barely have to even think about our servers anymore. So let’s get started Docker has a wide variety of other containers which you can check out (https://registry.hub.docker.com/) or just build your own, but today we are going to install Ghost (https://ghost.org/) which is a neat little blogging platform. The first command may take a few minutes to complete. $> salt ‘*’ state.highstate
  • 7. This will compile the salt state files, and apply them to all matching hosts. Put minion01’s Public IP address into your browser and see if you get a welcome page. Feel free to mess around with the Ghost blog to see what it can do. Hopefully this presentation wasn’t too overwhelming, if you have any questions please let us know. Salt State File: Located in /srv/salt these 2 files tell salt exactly what to do to reach its “highstate”. First is the /srv/salt/top.sls file, this is where salt starts looking. In our “BASE” definition, we want to apply the config to “*” or all servers. And it will apply whats in the “docker” folder. When just a single folder like this is specified, salt will look for a /srv/salt/docker/init.sls file. /srv/salt/docker/init.sls tells salt to pull in the “ghost” latest image from the docker registry. It sets up the container, with its proper port bindings, and then makes sure its running.
  • 8. Step 8: Creating your domain A properly configured domain name prevents us from having to remember all these IP addresses, so lets set that up now. We are going to be using the lablayer.info domain. To make this easy, we will use the SoftLayer Python CLI tool. Instead of test01, use your username. $> slcli dns create test01.lablayer.info
 $> slcli dns add test01.lablayer.info salt-master A <MASTER IP>
 $> slcli dns add test01.lablayer.info minion01 A <MINION IP>
 $> slcli dns list test01.lablayer.info