Ravi Srinivasan
2019-03-25 1ad1869d33452767e7560f5f9e76683b6e1aefd9
commit | author | age
1a8071 1 # DevOps Culture & Practice
D 2
3 ## Learner Outcomes
4ba1c2 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.
1a8071 7
6c5da4 8 ## Cluster Information
ME 9
4ba1c2 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
74d1f1 13
4ba1c2 14 ## Learner Pre-requisites
69951c 15 The following are the minimal hardware requirements for running the lab exercises in this course
RS 16 * 64-bit Intel Core i5/i7 CPU or equivalent with virtualization extensions enabled
17 * 4GB memory
18 * 80GB hard disk
dea1fe 19
4ba1c2 20 The lab exercises have been tested on the following operating systems
RS 21  * Fedora 29 64-bit
22  * Microsoft Windows 10 Pro 64-bit
23  * macOS 10.14 "Mojave"
24
69951c 25 The following table lists the software requirements for running the lab exercises:
RS 26
27  | Software | Version | Check |
28  | -------- | ------- | ----- |
29  | OCP CLI | v3.11 | $ oc version &#124; grep -i --color oc |
30  | Ansible | => v2.5 | $ ansible --version &#124; grep -i --color ansible |
31  | NodeJS | v8.x LTS | $ node -v |
32  | Git Installed | | $ git --version |
33  | Google Chrome Web Browser | (>60) | click [here](chrome://version/) if Google Chrome is your default browser else copy the link `chrome://version/` in your Chome |
34  | Docker latest | Community Edition | $ docker --version |
35  | JDK | v1.8 | $ java -version |
36  | Access to an OpenShift cluster | | `oc login -u <username> -p <password> <CLUSTER_URL>` |
37  | Text editor such as Atom or Visual Studio Code <br><br> (The exercises were created using `VSCode`, so the screenshots will match its layout and color schemes) | - | - |
38
39
40
41  <b><span style="color:red">NOTE</span></b>
42
4ba1c2 43  > You will need administrator or super user level access on your system to install the prerequisite software for all the three operating systems.
RS 44  Locked down systems with restricted accounts are not supported.
a06958 45
RS 46  > 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.
4ba1c2 47
RS 48 ### Linux
49
4477ba 50 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.
4ba1c2 51 ```bash
4477ba 52 tar -xvzf node-v8.x.y-linux-x64.tar.gz -C /usr/local/
4ba1c2 53 ```
4477ba 54 Replace 'x' and 'y' with the version you downloaded in the above step.
RS 55
56 2. Edit your ***.bashrc*** file and add the ***node*** binary to your ***PATH*** environment variable
4ba1c2 57 ```bash
4477ba 58 echo 'export PATH=/usr/local/node-v8.x.y/bin:$PATH' >> $HOME/.bashrc
4ba1c2 59 ```
RS 60
4477ba 61 3. Install OpenJDK version 1.8
4ba1c2 62 ```bash
RS 63 dnf install java-1.8.0-openjdk-devel
64 ```
65
4477ba 66 4. Install Google Chrome version 70 or higher by downloading and running the the 64-bit RPM installer from https://google.com/chrome
4ba1c2 67 ```bash
RS 68 dnf install google-chrome-stable_current_x86_64.rpm
69 ```
4477ba 70 5. Install Docker, Git and Ansible
4ba1c2 71 ```bash
RS 72 dnf install git ansible docker
73 systemctl enable docker
74 systemctl start docker
75 ```
4477ba 76 6. Download and uncompress the OpenShift 3.11 client binary archive. Copy the ***oc*** binary to ***/usr/local/bin*** folder on your system
4ba1c2 77 ```bash
RS 78 wget https://github.com/openshift/origin/releases/download/v3.11.0/openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz
79 tar -xvzf openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz
80 cp openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit/oc /usr/local/bin/
81 chmod +x /usr/local/bin/oc
82 ```
4477ba 83 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
4ba1c2 84 ```bash
RS 85 dnf install <rpm_name>
86 ```
87
88 ### macOS
89 1. Install HomeBrew for macOS by following the installation instructions at https://brew.sh/
90
91 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.
92 ```bash
93 brew install node@8
94 ```
95 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
96
97 4. Install Google Chrome version 70 or higher by downloading it from https://google.com/chrome
98
99 5. Install Docker for Mac by following the instructions from https://store.docker.com/editions/community/docker-ce-desktop-mac
100
101 6. Install Git using brew
102 ```bash
103 brew install git
104 ```
105
a06958 106 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
4ba1c2 107 ```bash
RS 108 brew install ansible
109 ```
110 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
111
112 9. Download and uncompress the OpenShift 3.11 client binary archive. Copy the ***oc*** binary to ***/usr/local/bin*** folder on your system
113 ```bash
a06958 114 curl -L -O https://github.com/openshift/origin/releases/download/v3.11.0/openshift-origin-client-tools-v3.11.0-0cbc58b-mac.zip
4ba1c2 115 unzip openshift-origin-client-tools-v3.11.0-0cbc58b-mac.zip
d6dea5 116 cp oc /usr/local/bin/
4ba1c2 117 chmod +x /usr/local/bin/oc
RS 118 ```
119
120 ### Microsoft Windows
121
65a905 122 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 123
4477ba 124 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.
4ba1c2 125
4477ba 126 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.
4ba1c2 127
RS 128 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.
129
130 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
131
4477ba 132 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 133
134 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.
4ba1c2 135
RS 136 3. Install Google Chrome version 70 or higher by downloading it from https://google.com/chrome
137
4477ba 138 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 139
140 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.
141
142 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.
4ba1c2 143
RS 144 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.
145
4477ba 146 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***.
4ba1c2 147
69951c 148 <b><span style="color:red">NOTE</span></b>
RS 149
150 > Ensure that the ***Git Bash*** component is selected during installation. You will need this to run bash shell scripts during the execution of lab exercises.
151
4ba1c2 152 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
RS 153
154 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.
155
69951c 156 Execute the following commands in the ***Windows Command Prompt*** to run Ansible playbooks on Windows systems:
4ba1c2 157
RS 158 * Pull the container image containing the tools and utilities that are required for running Ansible playbooks:
159 ```bash
231a66 160 docker pull quay.io/redhat/do500-toolbox
4ba1c2 161 ```
4477ba 162 * Create a working directory under your ***C:\*** drive to store the lab exercise files and Ansible playbooks
RS 163 ```bash
164 mkdir C:\do500-workspace
165 ```
4ba1c2 166
65a905 167 * Launch the container and run a quick test:
4ba1c2 168 ```bash
231a66 169 docker run -it -v C:/do500-workspace:/home/tool-box/workarea:Z quay.io/redhat/do500-toolbox /bin/bash
4ba1c2 170 ```
69951c 171
RS 172 <b><span style="color:red">NOTE</span></b>
173 > When you launch the container for the very first time, you will be prompted by Docker, as well as the Windows security subsystem to allow read and write access to the ***C:\do500-workspace*** directory. Allow read and write access to this directory by entering your Windows username and password when prompted.
4ba1c2 174
65a905 175 * 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:
4ba1c2 176 ```bash
RS 177 bash-4.4$ oc login -u <username> -p <password> <CLUSTER_URL>
65a905 178 bash-4.4$ oc version
RS 179 bash-4.4$ ansible --version
180 bash-4.4$ exit
4ba1c2 181 ```
RS 182
65a905 183 Your instructor will provide the ***username*** and ***password*** information for the OpenShift cluster when you are ready to run the lab exercises.
4ba1c2 184
1a8071 185 ## Git and Containers 101
D 186  - Git tutorial covering the basics - https://try.github.io/
187  - Handy guide for those new to containers - https://developers.redhat.com/blog/2018/02/22/container-terminology-practical-introduction/
0f4d08 188
b66742 189 ## Setup your IDE
4ba1c2 190 The following plug-ins are useful for providing syntax highlighting for various lab files:
b66742 191  - YAML Syntax Highlighter
D 192  - JavaScript Syntax Highlighter
193  - Vue.js
4ba1c2 194  - ESlint
38f5f2 195  - Jenkinsfile