Ravi Srinivasan
2019-01-10 16e153972b364a90f1cea60706cd3e093fbf38b4
commit | author | age
664135 1 # DevOps Culture & Practice
D 2
3 ## Learner Outcomes
3e2c63 4 * Provide an immersive experience for students through practical application of DevOps culture using modern software development practices.
RS 5
6 * Allow students to experience the cultural shift they need to make in order to begin a successful DevOps journey.
664135 7
530a25 8 ## Cluster Information
ME 9
3e2c63 10 An OpenShift Cluster is required to complete the lab exercises. Students will receive by email (and by the instructors on site) the following information regarding the OpenShift cluster:
RS 11  - <**CLUSTER_URL**> -- Openshift Webconsole/API Server URL
12  - <**APPS_URL**> -- Wildcard subdomain for the exposed applications deployed in the Cluster
5d0992 13
3e2c63 14 ## Learner Pre-requisites
RS 15 The following table lists the software requirements for running the lab exercises:
16
2bd7ed 17  | Software | Version | Check |
RR 18  | -------- | ------- | ----- |
5219d1 19  | OCP CLI | v3.11 | $ oc version &#124; grep -i --color oc  <br><span style="color:red">oc </span> v3.11.0+0cbc58b |
d34eea 20  | Ansible | => v2.5 | $ ansible --version &#124; grep -i --color ansible <br> <span style="color:red">ansible</span> 2.7.2 <br> .... <br>|
RS 21  | NodeJS | v8.x LTS | $ node -v <br> v8.11.3|
2bd7ed 22  | Git Installed | | $ git --version <br> git version 2.17.1|
RR 23  | Google Chrome Web Browser | (>59) | click [here](chrome://version/) if Google Chrome is your default browser else copy the link `chrome://version/` in your Chome |
d34eea 24  | Docker latest | Community Edition | $ docker --version <br> Docker version 18.05.0-ce, build f150324|
RS 25  | JDK | v1.8 | $ java -version <br>java version "1.8.0_131"<br>Java(TM) SE Runtime Environment (build 1.8.0_131-b11)<br>Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)|
530a25 26  | Access to an OpenShift cluster | | `oc login -u <username> -p <password> <CLUSTER_URL>` |
d34eea 27  | Text editor such as Atom, IntelliJ or Visual Studio Code <br><br> (The exercises were created using `VSCode`, so the screenshots will match its layout and color schemes) | - | - |
2bd7ed 28
3e2c63 29 The lab exercises have been tested on the following operating systems
RS 30  * Fedora 29 64-bit
31  * Microsoft Windows 10 Pro 64-bit
32  * macOS 10.14 "Mojave"
33
34  **NOTE**
35  > You will need administrator or super user level access on your system to install the prerequisite software for all the three operating systems.
36  Locked down systems with restricted accounts are not supported.
d34eea 37
RS 38  > You can use any text editor to edit lab files. Using an editor that provides syntax highlighting and automatic indentation is helpful. We recommend ***Atom*** or ***Visual Studio Code***  for this course.
3e2c63 39
RS 40 ### Linux
41
16e153 42 1. Download the Node.js 8.x LTS Linux 64-bit binary archive file from https://nodejs.org/dist/latest-v8.x/. The binary will be named as ***node-v8.x.y-linux-x64.tar.gz***, where 'x' and 'y' indicates the major and minor version of the latest Node.js 8 LTS release.
3e2c63 43 ```bash
16e153 44 tar -xvzf node-v8.x.y-linux-x64.tar.gz -C /usr/local/
3e2c63 45 ```
16e153 46 Replace 'x' and 'y' with the version you downloaded in the above step.
RS 47
48 2. Edit your ***.bashrc*** file and add the ***node*** binary to your ***PATH*** environment variable
3e2c63 49 ```bash
16e153 50 echo 'export PATH=/usr/local/node-v8.x.y/bin:$PATH' >> $HOME/.bashrc
3e2c63 51 ```
RS 52
16e153 53 3. Install OpenJDK version 1.8
3e2c63 54 ```bash
RS 55 dnf install java-1.8.0-openjdk-devel
56 ```
57
16e153 58 4. Install Google Chrome version 70 or higher by downloading and running the the 64-bit RPM installer from https://google.com/chrome
3e2c63 59 ```bash
RS 60 dnf install google-chrome-stable_current_x86_64.rpm
61 ```
16e153 62 5. Install Docker, Git and Ansible
3e2c63 63 ```bash
RS 64 dnf install git ansible docker
65 systemctl enable docker
66 systemctl start docker
67 ```
16e153 68 6. Download and uncompress the OpenShift 3.11 client binary archive. Copy the ***oc*** binary to ***/usr/local/bin*** folder on your system
3e2c63 69 ```bash
RS 70 wget https://github.com/openshift/origin/releases/download/v3.11.0/openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz
71 tar -xvzf openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz
72 cp openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit/oc /usr/local/bin/
73 chmod +x /usr/local/bin/oc
74 ```
16e153 75 7. Download and install Atom text editor RPM installer from https://atom.io/download/rpm, or the Visual Studio Code RPM installer from https://code.visualstudio.com/docs/?dv=linux64_rpm
3e2c63 76 ```bash
RS 77 dnf install <rpm_name>
78 ```
79
80 ### macOS
81 1. Install HomeBrew for macOS by following the installation instructions at https://brew.sh/
82
83 2. Install Node.js version 8.x LTS using the brew command, and follow the instructions to add the **node** binary to the **PATH** environment variable.
84 ```bash
85 brew install node@8
86 ```
87 3. Install JDK version 1.8 for MacOS by using the installer from the Oracle website at https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
88
89 4. Install Google Chrome version 70 or higher by downloading it from https://google.com/chrome
90
91 5. Install Docker for Mac by following the instructions from https://store.docker.com/editions/community/docker-ce-desktop-mac
92
93 6. Install Git using brew
94 ```bash
95 brew install git
96 ```
97
d34eea 98 7. You need Ansible version 2.5 or greater to run the exercise playbooks. If you have not installed Ansible, or have an older version, install or upgrade it using brew
3e2c63 99 ```bash
RS 100 brew install ansible
101 ```
102 8. Download and install Atom text editor from https://atom.io/download/mac, or Visual Studio Code from https://code.visualstudio.com/docs/?dv=osx
103
104 9. Download and uncompress the OpenShift 3.11 client binary archive. Copy the ***oc*** binary to ***/usr/local/bin*** folder on your system
105 ```bash
d34eea 106 curl -L -O https://github.com/openshift/origin/releases/download/v3.11.0/openshift-origin-client-tools-v3.11.0-0cbc58b-mac.zip
3e2c63 107 unzip openshift-origin-client-tools-v3.11.0-0cbc58b-mac.zip
RS 108 cp openshift-origin-client-tools-v3.11.0-0cbc58b-mac/oc /usr/local/bin/
109 chmod +x /usr/local/bin/oc
110 ```
111
112 ### Microsoft Windows
113
d3d465 114 You will be adding several directories to the ***PATH*** environment variable. Follow the instructions at https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/ to edit the ***PATH*** environment variable on Windows 10.
RS 115
16e153 116 1. Download the Node.js 8.x LTS Windows 64-bit binary archive file from https://nodejs.org/dist/latest-v8.x/. The binary will be named as ***node-v8.x.y-win-x64.zip***, where 'x' and 'y' indicates the major and minor version of the latest Node.js 8 LTS release.
3e2c63 117
16e153 118 Extract the zip file archive under a suitable folder in the ***C:\*** drive, for example ***C:\nodejs***. Make sure that your directory name does not have any spaces in it.
3e2c63 119
RS 120 Add the directory where you uncompressed the zip file to the ***PATH*** environment variable, so that the ***node.exe*** and ***npm.cmd*** executable files are available in the system path.
121
122 2. Install JDK version 1.8 for Windows 64-bit by using the installer from the Oracle website at https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
123
16e153 124 Ensure that you install the JDK into a directory which has no spaces in its name, for example ***C:\Java***. Add a new environment variable called ***JAVA_HOME*** which points to the top level directory where you installed the JDK.
RS 125
126 Add the ***JAVA_HOME\bin*** directory to the ***PATH*** environment variable, so that the ***java.exe*** and ***javac.exe*** executable files are available in the system path.
3e2c63 127
RS 128 3. Install Google Chrome version 70 or higher by downloading it from https://google.com/chrome
129
16e153 130 4. Install Docker for Windows by following the instructions from https://hub.docker.com/editions/community/docker-ce-desktop-windows. Before downloading, you will be asked to create an account. Register and download Docker for Windows.
RS 131
132 Ensure that you install Docker into a directory which has no spaces in its name, for example ***C:\Docker***. You will be prompted to enable Hyper-V during installation.
133
134 Windows will restart a couple of times after enabling Hyper-V and continue with the Docker installation. Follow the instructions provided in the link above to test and verify your Docker installation.
3e2c63 135
RS 136 5. Download and install Git for Windows by using the 64-bit installer from https://github.com/git-for-windows/git/releases/download/v2.20.0.windows.1/Git-2.20.0-64-bit.exe.
137
16e153 138 Follow the instructions at https://www.atlassian.com/git/tutorials/install-git#windows to install and verify your Git installation. Ensure that you install Git into a directory which has no spaces in its name, for example ***C:\Git***.
3e2c63 139
RS 140 6. Download and install Atom text editor from https://github.com/atom/atom/releases/download/v1.33.0/AtomSetup-x64.exe, or Visual Studio Code from https://code.visualstudio.com/docs/?dv=win64
141
142 7. You will use a custom container image for running OpenShift client commands, and Ansible playbooks. You will map a directory on your local Windows system containing Ansible playbooks to a directory inside the container, and run the Ansible playbooks from within the container.
143
144 Execute the following commands to run Ansible playbooks on Windows systems:
145
146 * Pull the container image containing the tools and utilities that are required for running Ansible playbooks:
147 ```bash
d3d465 148 docker pull quay.io/jrigsbee/do500-toolbox
3e2c63 149 ```
16e153 150 * Create a working directory under your ***C:\*** drive to store the lab exercise files and Ansible playbooks
RS 151 ```bash
152 mkdir C:\do500-workspace
153 ```
3e2c63 154
d3d465 155 * Launch the container and run a quick test:
3e2c63 156 ```bash
d3d465 157 docker run -it -v C:/do500-workspace:/home/tool-box/workarea:Z quay.io/jrigsbee/do500-toolbox /bin/bash
3e2c63 158 ```
RS 159
d3d465 160 * Once you are inside the container, you can log in to the OpenShift cluster using the OpenShift ***oc*** command-line client, and verify that Ansible is installed:
3e2c63 161 ```bash
RS 162 bash-4.4$ oc login -u <username> -p <password> <CLUSTER_URL>
d3d465 163 bash-4.4$ oc version
RS 164 bash-4.4$ ansible --version
165 bash-4.4$ exit
3e2c63 166 ```
RS 167
d3d465 168 Your instructor will provide the ***username*** and ***password*** information for the OpenShift cluster when you are ready to run the lab exercises.
3e2c63 169
664135 170 ## Git and Containers 101
D 171  - Git tutorial covering the basics - https://try.github.io/
172  - Handy guide for those new to containers - https://developers.redhat.com/blog/2018/02/22/container-terminology-practical-introduction/
c951f7 173
64c594 174 ## Setup your IDE
3e2c63 175 The following plug-ins are useful for providing syntax highlighting for various lab files:
64c594 176  - YAML Syntax Highlighter
D 177  - JavaScript Syntax Highlighter
178  - Vue.js
3e2c63 179  - ESlint
RS 180  - Jenkinsfile