how to manage azure with open source
TRANSCRIPT
How to manage Microsoft Azure with open source
Taehee Jang
Ubuntu Korea Community Adviser
Microsoft MVP (Cloud and Datacenter Management)
2017-09-16
List
• Bash on Ubuntu on Windows – “grep” command
• Azure CLI 2.0 – Changed installation method & Basic usage
• Juju – What is Juju?
• Run Docker on Bash on Ubuntu on Windows
1. grep
Entire grep commands) https://www.gnu.org/software/grep/manual/grep.html
grep
Find text by using grep
grep 'some text' /etc/ssh/sshd_config
grep 'word' file1 file2 file3
Show texts except lines which contain specific characters
grep -v "#" /etc/apache2/sites-available/default-ssl.conf
Source) https://www.tecmint.com/12-practical-examples-of-linux-grep-command/
grep
Use with pipe
cat /etc/ssh/sshd_config | grep 'some text'
dpkg -l | grep -i python
Show with sentences before or after searched texts
ifconfig | grep -A 4 eth0
ifconfig | grep -B 2 UP
Source) https://www.tecmint.com/12-practical-examples-of-linux-grep-command/
grep
Search texts including subdirectories
grep –r “function” ./*
Count matched texts
ifconfig | grep –c inet6
Source) https://www.tecmint.com/12-practical-examples-of-linux-grep-command/
grep
Search words inside gzip file
zgrep –i error /var/log/syslog.2.gz
grep with regular expressions
grep –E → egrep
grep with simple strings
grep –F → fgrep
Source) https://www.tecmint.com/12-practical-examples-of-linux-grep-command/
2. Azure CLI 2.0
Azure CLI 2.0
▪ Written in JavaScript with Node.js -> Python
• Support : Ubuntu, Debian, CentOS, Redhat, OpenSUSE, and Mac
• Required : python libssl-dev libffi-dev python-dev build-essential
• Remove 1.0 before install 2.0
• curl -L https://aka.ms/InstallAzureCli | bash -> exec -l $SHELL
Install Azure CLI 2.0(Linux / WSL)
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ wheezy main" | sudo tee /etc/apt/sources.list.d/azure-cli.list
sudo apt-key adv --keyserver packages.microsoft.com --recv-keys 417A0893
sudo apt-get install apt-transport-https
sudo apt-get update && sudo apt-get install azure-cli
Source) https://docs.microsoft.com/ko-kr/cli/azure/install-azure-cli?view=azure-cli-latest#install-on-windowsSource) https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest#install-on-windows
Start Azure CLI 2.0
Start Azure CLI 2.0
az group create –name <group name> --location <region>
az network vnet create –resource-group <group name> --name <network name> --address-prefix <IP class> --subnet-name <subnet name> --subnet-prefix <IP class>
az vm create –n <vm name> –g <group name> --image “<OS>” –size <vm size>
Source) https://docs.microsoft.com/en-us/cli/azure/?view=azure-cli-latest#az_configure
3. What is Juju?
Support Clouds
Model, Charm, Bundle
Charm Model
Select My Cloud and Region
See public clouds list
juju clouds
Show clouds with regions
juju regions azure or juju show-cloud azure
Set my default cloud region
juju set-default-region azure koreacentral
Add Credentials to My Device
Add my juju credential to Bash on Ubuntu on Windows
juju add-credential azure
Enter credential name: <Name as I want>
Select auth-type: <Automatically set to interactive type if vacant>
Enter subscription-id: <My subscription id when “az login”>
Add Controllers to My Cloud
Create juju state server(controller) on Azure
juju bootstrap azure <My controller name>
You can make multiple controllers and add other companies’ cloud.
Remove controller
destroy-controller <Controller name I created>
Execute Juju GUI and Login
Connect Juju GUI URL
juju gui
Check my username and password for Juju GUI login
juju show-controller --show-password
Deploy Charm(Service) and Relate Charms
Type CLI command or search the charm on charm store
juju deploy <service as you want>
Connect between charms(services)
juju add-relation <charm 1> <charm 2>
Expose public IP for external access
juju expose <charm name to expose>
Configure Charms
SSH
How to access a specific unit
juju ssh <application name/unit number>
User command, Relation debugging
juju debug-hooks
For more information, please visit https://cloudbase.it/juju/
Juju Charms for Windows (12 Services)
Storage Spaces Direct
Nova – Hyper-VSQL Server Express
Cinder
Active Directory SharePoint Exchange Server
SQL Server AlwaysOn
Windows File ServerScale-Out File Server
Virtual DesktopInfrastructure (VDI)
Windows Server Failover Clustering
Windows Server Update Services
For more information, please visit https://cloudbase.it/juju/
Others
Check log for Juju charms
juju debug-log
Check deployed machine and charm status
juju status
Update cloud region changes
update-clouds
4. Docker & Bash on Ubuntu on Windows
Run Docker on Bash on Ubuntu on Windows
Install Docker for Windows
Source) https://blog.jayway.com/2017/04/19/running-docker-on-bash-on-windows/
Run Docker on Bash on Ubuntu on Windows
vim ~/.bashrc and add 2 lines
PATH="$HOME/bin:$HOME/.local/bin:$PATH"
PATH="$PATH:/mnt/c/Program\ Files/Docker/Docker/resources/bin“
Install packages to add https repository
# apt install apt-transport-https ca-certificates curl \
software-properties-common
Source) https://blog.jayway.com/2017/04/19/running-docker-on-bash-on-windows/
Run Docker on Bash on Ubuntu on Windows
Add Docker’s official GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudoapt-key add –
Add repository
# add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable“
Install Docker
sudo apt update && sudo apt install docker-ce
Source) https://blog.jayway.com/2017/04/19/running-docker-on-bash-on-windows/
Run Docker on Bash on Ubuntu on Windows
Enable “Expose daemon on tcp://localhost:2375 without TLS” on Docker
Source) https://blog.jayway.com/2017/04/19/running-docker-on-bash-on-windows/
Run Docker on Bash on Ubuntu on Windows
Connect Docker on WSL to Docker on Windows
echo "export DOCKER_HOST='tcp://0.0.0.0:2375'" >> ~/.bashrc
source ~/.bashrc
Check Docker works
Source) https://blog.jayway.com/2017/04/19/running-docker-on-bash-on-windows/