Ravi Srinivasan
2018-12-18 3e2c63f4a22e1c0de3243d4cb03fb247a5d87386
commit | author | age
664135 1 # DevOps Culture & Practice
3e2c63 2 <!-- > Red Hat Open Innovation Labs Enablement Material. Preparing Engineers, consultants and TSMs with all the cultural and engineering practices for life in a Residency.
cdcafd 3
950122 4 ![jenkins-crio-ocp-star-wars-kubes](./images/jenkins-crio-ocp-star-wars-kubes.png)
cdcafd 5
3e2c63 6 This is a collection of practices and exercises to take a learner through a four day simulated residency experience. Learners can expect to be exposed to labs practices such as [Event Storming](https://rht-labs.github.io/practice-library/practices/event-storming/), [Social Contract](https://rht-labs.github.io/practice-library/practices/social-contract/) and [Impact Mapping](https://rht-labs.github.io/practice-library/practices/impact-mapping/) among many more which can be found in our [Practice Library](https://rht-labs.github.io/practice-library/). Learners will also be exposed to `Labs CI/CD` - how we use OpenShift & Ansible in conjunction with Jenkins to automate build and deploy of a sample todolist application and its required infrastructure. -->
664135 7
D 8 ## Learner Outcomes
3e2c63 9 * Provide an immersive experience for students through practical application of DevOps culture using modern software development practices.
RS 10
11 * Allow students to experience the cultural shift they need to make in order to begin a successful DevOps journey.
664135 12
530a25 13 ## Cluster Information
ME 14
3e2c63 15 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 16  - <**CLUSTER_URL**> -- Openshift Webconsole/API Server URL
17  - <**APPS_URL**> -- Wildcard subdomain for the exposed applications deployed in the Cluster
5d0992 18
3e2c63 19 ## Learner Pre-requisites
RS 20 The following table lists the software requirements for running the lab exercises:
21
2bd7ed 22  | Software | Version | Check |
RR 23  | -------- | ------- | ----- |
5219d1 24  | OCP CLI | v3.11 | $ oc version &#124; grep -i --color oc  <br><span style="color:red">oc </span> v3.11.0+0cbc58b |
3e2c63 25  | Ansible | => v2.6 | $ ansible --version &#124; grep -i --color ansible <br> <span style="color:red">ansible</span> 2.7.2 <br> .... <br>|
2bd7ed 26  | NodeJS | v8.x | $ node -v <br> v8.11.3|
RR 27  | Git Installed | | $ git --version <br> git version 2.17.1|
28  | 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 |
29  | Docker latest | Community Edition - Edge | $ docker --version <br> Docker version 18.05.0-ce, build f150324|
30  | JDK | v8 | $ 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 31  | Access to an OpenShift cluster | | `oc login -u <username> -p <password> <CLUSTER_URL>` |
2bd7ed 32  | 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 colour schemes) | - | - |
RR 33
3e2c63 34 The lab exercises have been tested on the following operating systems
RS 35  * Fedora 29 64-bit
36  * Microsoft Windows 10 Pro 64-bit
37  * macOS 10.14 "Mojave"
38
39  **NOTE**
40  > You will need administrator or super user level access on your system to install the prerequisite software for all the three operating systems.
41  Locked down systems with restricted accounts are not supported.
42
43 ### Linux
44
45 1. Download and Install Node.js version 8.x LTS
46 ```bash
47 wget https://nodejs.org/dist/latest-v8.x/node-v8.14.0-linux-x64.tar.gz
48 tar -xvzf node-v8.14.0-linux-x64.tar.gz -C /usr/local/
49 ```
50 Edit your ***.bashrc*** file and add the ***node*** binary to your ***PATH*** environment variable
51 ```bash
52 echo 'export PATH=/usr/local/node-v8.14.0/bin:$PATH' >> $HOME/.bashrc
53 ```
54
55 2. Install OpenJDK version 1.8
56 ```bash
57 dnf install java-1.8.0-openjdk-devel
58 ```
59
60 3. Install Google Chrome version 70 or higher by downloading and running the the 64-bit RPM installer from https://google.com/chrome
61 ```bash
62 dnf install google-chrome-stable_current_x86_64.rpm
63 ```
64 4. Install Docker, Git and Ansible
65 ```bash
66 dnf install git ansible docker
67 systemctl enable docker
68 systemctl start docker
69 ```
70 5. Download and uncompress the OpenShift 3.11 client binary archive. Copy the ***oc*** binary to ***/usr/local/bin*** folder on your system
71 ```bash
72 wget https://github.com/openshift/origin/releases/download/v3.11.0/openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz
73 tar -xvzf openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz
74 cp openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit/oc /usr/local/bin/
75 chmod +x /usr/local/bin/oc
76 ```
77 6. 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
78 ```bash
79 dnf install <rpm_name>
80 ```
81
82 ### macOS
83 1. Install HomeBrew for macOS by following the installation instructions at https://brew.sh/
84
85 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.
86 ```bash
87 brew install node@8
88 ```
89 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
90
91 4. Install Google Chrome version 70 or higher by downloading it from https://google.com/chrome
92
93 5. Install Docker for Mac by following the instructions from https://store.docker.com/editions/community/docker-ce-desktop-mac
94
95 6. Install Git using brew
96 ```bash
97 brew install git
98 ```
99
100 7. Install Ansible using brew
101 ```bash
102 brew install ansible
103 ```
104 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
105
106 9. Download and uncompress the OpenShift 3.11 client binary archive. Copy the ***oc*** binary to ***/usr/local/bin*** folder on your system
107 ```bash
108 wget https://github.com/openshift/origin/releases/download/v3.11.0/openshift-origin-client-tools-v3.11.0-0cbc58b-mac.zip
109 unzip openshift-origin-client-tools-v3.11.0-0cbc58b-mac.zip
110 cp openshift-origin-client-tools-v3.11.0-0cbc58b-mac/oc /usr/local/bin/
111 chmod +x /usr/local/bin/oc
112 ```
113
114 ### Microsoft Windows
115
116 1. Download the 64-bit Node.js 8.x LTS Windows binary archive file from https://nodejs.org/dist/latest-v8.x/node-v8.14.0-win-x64.zip.
117
118 Extract the zip file archive under a suitable folder in the ***C:\*** drive. Make sure that your directory name does not have any spaces in it.
119
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
124 Ensure that you install the JDK into a directory which has no spaces in its name. 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.
125
126 3. Install Google Chrome version 70 or higher by downloading it from https://google.com/chrome
127
128 4. Install Docker for Windows by following the instructions from https://hub.docker.com/editions/community/docker-ce-desktop-windows
129
130 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.
131
132 Follow the instructions at https://www.atlassian.com/git/tutorials/install-git#windows to install and verify your Git installation.
133
134 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
135
136 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.
137
138 Execute the following commands to run Ansible playbooks on Windows systems:
139
140 * Pull the container image containing the tools and utilities that are required for running Ansible playbooks:
141 ```bash
142 docker pull quay.io/redhat-training/do500-toolbox
143 ```
144
145 * Launch the container:
146 ```bash
147 docker run -it -v C:/do500-workspace:/home/tool-box/workarea:Z -p 8080:8080 -p 9000:9000 do500-toolbox /bin/bash
148 ```
149
150 The ***C:/do500-workspace*** directory on your Windows system contains the lab files and Ansible playbooks for the lab exercises.
151
152 * Once you are inside the container, you can log in to the OpenShift cluster using the OpenShift ***oc*** command-line client, and launch the playbooks:
153 ```bash
154 bash-4.4$ oc login -u <username> -p <password> <CLUSTER_URL>
155 bash-4.4$ cd workarea/enablement-ci-cd
156 bash-4.4$ ansible-playbook playbook.yml ...
157 ```
158
159 <!-- 7. Download and uncompress the OpenShift 3.11 client binary archive from https://github.com/openshift/origin/releases/download/v3.11.0/openshift-origin-client-tools-v3.11.0-0cbc58b-windows.zip, and extract it under the ***C:\*** drive. Add the directory where you uncompressed the zip file to the ***PATH*** environment variable, so that the ***oc.exe*** executable files is available in the system path. -->
160
664135 161 ## Git and Containers 101
D 162  - Git tutorial covering the basics - https://try.github.io/
163  - Handy guide for those new to containers - https://developers.redhat.com/blog/2018/02/22/container-terminology-practical-introduction/
c951f7 164
64c594 165 ## Setup your IDE
3e2c63 166 The following plug-ins are useful for providing syntax highlighting for various lab files:
64c594 167  - YAML Syntax Highlighter
D 168  - JavaScript Syntax Highlighter
169  - Vue.js
3e2c63 170  - ESlint
RS 171  - Jenkinsfile