├── Additional.Information.adoc ├── Common ├── ImageStreams.json ├── ourenvironment.png └── scheduler.json ├── Demonstration.Environment.Setup.adoc ├── LICENSE ├── README.adoc ├── Snippet_DeployPrebuiltImage ├── DemoSnippet.adoc ├── hello-openshift-complete.json ├── hello-openshift-pod.json ├── weightwatcher-complete.json └── weightwatcher-pod.json ├── Snippet_DeployS2I ├── DemoSnippet.adoc ├── WebUI_Login.png └── images │ ├── WebUI_ApplicationDetails1.png │ ├── WebUI_ApplicationDetails2.png │ ├── WebUI_Builds.png │ ├── WebUI_CreateButton.png │ ├── WebUI_Login.png │ ├── WebUI_SelectBuilder.png │ ├── WebUI_SelectProject.png │ └── WebUI_SourceRepository.png └── Snippet_DeployTemplate_2tier ├── DemoSnippet.adoc ├── InstantAppTempalte.json ├── InstantAppTempalte_old.json └── images ├── DemoSnippet.adoc ├── WebUI_CreateButton.png ├── WebUI_Login.png ├── WebUI_SelectProject.png └── WebUI_TemplateInformation.png /Additional.Information.adoc: -------------------------------------------------------------------------------- 1 | = Additional Information 2 | 3 | == Legend 4 | 5 | The demonstration snippets use the following terms to describe your actions: 6 | 7 | * *Action* - Something you need to do. Notice that sometimes the action goes 8 | before the explanation, and some times after. If an action takes a while, it is 9 | better to start the action and then discuss it. 10 | * *Explain* - This means you should explain what is happening. You do not need 11 | to explain things at length, but you should not assume that everyone is clear 12 | on everything that is happening. 13 | * *Point out* - This means there are several items to point out in a larger 14 | group of items. For example, you would point out a few lines in a JSON file but 15 | not explain every line in the file. 16 | * *Show* - Here you let the audience look at the screen and take everything in. 17 | This is usually a good spot to ask for questions from the audience. 18 | * *Ask* - This is where you could start a debate with the audience. For example, 19 | "How do you currently deal with scaling your applications?" Questions should be productive and ideally serve to address pain points that might occur when someone is showing the solution with the product. 20 | * *Caution* - This event has the potential to put your demonstration at risk. 21 | Pay attention to the warning. 22 | 23 | :noaudio: 24 | 25 | == Demonstration Tips 26 | 27 | * _Carefully_ read what you are expected to do in each section. 28 | * Do not assume anything--stick to the instructions. 29 | * Do not just copy and paste. Try to understand what you are being asked to do 30 | and whether you need to adjust values. 31 | * Practice. 32 | * Feel free to use your own words and flow through the demonstrations, as your 33 | situation dictates. However, always remember the limitations of the environment. 34 | * You can run the *Deployment_Post_Script.sh* file on your *ose_fastrax* 35 | environment to practice, but its recommended to provision a fresh environment 36 | for demonstrations. 37 | -------------------------------------------------------------------------------- /Common/ImageStreams.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1beta1", 3 | "kind": "ImageStreamList", 4 | "items": [ 5 | { 6 | "apiVersion": "v1beta1", 7 | "kind": "ImageStream", 8 | "metadata": { 9 | "name": "ruby-20-rhel7" 10 | }, 11 | "spec": { 12 | "dockerImageRepository": "registry.access.redhat.com/openshift3_beta/ruby-20-rhel7", 13 | "tags": [ 14 | { 15 | "name": "v0.4.3.2", 16 | "annotations": { 17 | "description": "Build and run Ruby 2.0 applications", 18 | "iconClass": "icon-ruby", 19 | "tags": "builder,ruby", 20 | "version": "2.0" 21 | } 22 | } 23 | ] 24 | } 25 | }, 26 | { 27 | "apiVersion": "v1beta1", 28 | "kind": "ImageStream", 29 | "metadata": { 30 | "name": "nodejs-010-rhel7" 31 | }, 32 | "spec": { 33 | "dockerImageRepository": "registry.access.redhat.com/openshift3_beta/nodejs-010-rhel7", 34 | "tags": [ 35 | { 36 | "name": "latest", 37 | "annotations": { 38 | "description" : "Build and run NodeJS 0.10 applications", 39 | "iconClass" : "icon-nodejs", 40 | "tags" : "builder,nodejs", 41 | "version" : "0.10" 42 | } 43 | } 44 | ] 45 | } 46 | }, 47 | { 48 | "apiVersion": "v1beta1", 49 | "kind": "ImageStream", 50 | "metadata": { 51 | "name": "perl-516-rhel7" 52 | }, 53 | "spec": { 54 | "dockerImageRepository": "registry.access.redhat.com/openshift3_beta/perl-516-rhel7", 55 | "tags": [ 56 | { 57 | "name": "latest", 58 | "annotations": { 59 | "description": "Build and run Perl 5.16 applications", 60 | "iconClass": "icon-perl", 61 | "tags": "builder,perl", 62 | "version": "5.16" 63 | } 64 | } 65 | ] 66 | } 67 | }, 68 | { 69 | "apiVersion": "v1beta1", 70 | "kind": "ImageStream", 71 | "metadata": { 72 | "name": "python-33-rhel7" 73 | }, 74 | "spec": { 75 | "dockerImageRepository": "registry.access.redhat.com/openshift3_beta/python-33-rhel7", 76 | "tags": [ 77 | { 78 | "name": "latest", 79 | "annotations": { 80 | "description": "Build and run Python 3.3 applications", 81 | "iconClass": "icon-python", 82 | "tags": "builder,python", 83 | "version": "3.3" 84 | } 85 | } 86 | ] 87 | } 88 | }, 89 | { 90 | "apiVersion": "v1beta1", 91 | "kind": "ImageStream", 92 | "metadata": { 93 | "name": "mysql-55-rhel7" 94 | }, 95 | "spec": { 96 | "dockerImageRepository": "registry.access.redhat.com/openshift3_beta/mysql-55-rhel7" 97 | } 98 | }, 99 | { 100 | "apiVersion": "v1beta1", 101 | "kind": "ImageStream", 102 | "metadata": { 103 | "name": "postgresql-92-rhel7" 104 | }, 105 | "spec": { 106 | "dockerImageRepository": "registry.access.redhat.com/openshift3_beta/postgresql-92-rhel7" 107 | } 108 | }, 109 | { 110 | "apiVersion": "v1beta1", 111 | "kind": "ImageStream", 112 | "metadata": { 113 | "name": "mongodb-24-rhel7" 114 | }, 115 | "spec": { 116 | "dockerImageRepository": "registry.access.redhat.com/openshift3_beta/mongodb-24-rhel7" 117 | } 118 | }, 119 | { 120 | "kind": "ImageStream", 121 | "apiVersion": "v1beta1", 122 | "metadata": { 123 | "name": "jboss-webserver3-tomcat7-openshift", 124 | "annotations": { 125 | "description": "Provides JBoss Web Server v3 Tomcat 7 STI images." 126 | } 127 | }, 128 | "spec": { 129 | "dockerImageRepository": "registry.access.redhat.com/jboss-webserver-3/tomcat7-openshift", 130 | "tags": [ 131 | { 132 | "name": "3.0", 133 | "dockerImageReference": "registry.access.redhat.com/jboss-webserver-3/tomcat7-openshift:3.0" 134 | } 135 | ] 136 | } 137 | }, 138 | { 139 | "kind": "ImageStream", 140 | "apiVersion": "v1beta1", 141 | "metadata": { 142 | "name": "jboss-webserver3-tomcat8-openshift", 143 | "annotations": { 144 | "description": "Provides JBoss Web Server v3 Tomcat 8 STI images." 145 | } 146 | }, 147 | "spec": { 148 | "dockerImageRepository": "registry.access.redhat.com/jboss-webserver-3/tomcat8-openshift", 149 | "tags": [ 150 | { 151 | "name": "3.0", 152 | "dockerImageReference": "registry.access.redhat.com/jboss-webserver-3/tomcat8-openshift:3.0" 153 | } 154 | ] 155 | } 156 | }, 157 | { 158 | "kind": "ImageStream", 159 | "apiVersion": "v1beta1", 160 | "metadata": { 161 | "name": "jboss-eap6-openshift", 162 | "annotations": { 163 | "description": "Provides JBoss EAP 6 STI images." 164 | } 165 | }, 166 | "spec": { 167 | "dockerImageRepository": "registry.access.redhat.com/jboss-eap-6/eap-openshift", 168 | "tags": [ 169 | { 170 | "name": "6.4", 171 | "dockerImageReference": "registry.access.redhat.com/jboss-eap-6/eap-openshift:6.4" 172 | } 173 | ] 174 | } 175 | }, 176 | { 177 | "apiVersion": "v1beta1", 178 | "kind": "ImageStream", 179 | "metadata": { 180 | "name": "ruby-20-centos7" 181 | }, 182 | "spec": { 183 | "dockerImageRepository": "openshift/ruby-20-centos7", 184 | "tags": [ 185 | { 186 | "name": "latest", 187 | "annotations": { 188 | "description": "Build and run Ruby 2.0 applications", 189 | "iconClass": "icon-ruby", 190 | "tags": "builder,ruby", 191 | "version": "2.0" 192 | } 193 | } 194 | ] 195 | } 196 | }, 197 | { 198 | "apiVersion": "v1beta1", 199 | "kind": "ImageStream", 200 | "metadata": { 201 | "name": "nodejs-010-centos7" 202 | }, 203 | "spec": { 204 | "dockerImageRepository": "openshift/nodejs-010-centos7", 205 | "tags": [ 206 | { 207 | "name": "latest", 208 | "annotations": { 209 | "description" : "Build and run NodeJS 0.10 applications", 210 | "iconClass" : "icon-nodejs", 211 | "tags" : "builder,nodejs", 212 | "version" : "0.10" 213 | } 214 | } 215 | ] 216 | } 217 | }, 218 | { 219 | "apiVersion": "v1beta1", 220 | "kind": "ImageStream", 221 | "metadata": { 222 | "name": "perl-516-centos7" 223 | }, 224 | "spec": { 225 | "dockerImageRepository": "openshift/perl-516-centos7", 226 | "tags": [ 227 | { 228 | "name": "latest", 229 | "annotations": { 230 | "description": "Build and run Perl 5.16 applications", 231 | "iconClass": "icon-perl", 232 | "tags": "builder,perl", 233 | "version": "5.16" 234 | } 235 | } 236 | ] 237 | } 238 | }, 239 | { 240 | "apiVersion": "v1beta1", 241 | "kind": "ImageStream", 242 | "metadata": { 243 | "name": "python-33-centos7" 244 | }, 245 | "spec": { 246 | "dockerImageRepository": "openshift/python-33-centos7", 247 | "tags": [ 248 | { 249 | "name": "latest", 250 | "annotations": { 251 | "description": "Build and run Python 3.3 applications", 252 | "iconClass": "icon-python", 253 | "tags": "builder,python", 254 | "version": "3.3" 255 | } 256 | } 257 | ] 258 | } 259 | }, 260 | { 261 | "apiVersion": "v1beta1", 262 | "kind": "ImageStream", 263 | "metadata": { 264 | "name": "wildfly-8-centos" 265 | }, 266 | "spec": { 267 | "dockerImageRepository": "openshift/wildfly-8-centos", 268 | "tags": [ 269 | { 270 | "name": "latest", 271 | "annotations": { 272 | "description" : "Build and run Java applications on Wildfly 8", 273 | "iconClass" : "icon-wildfly", 274 | "tags" : "builder,wildfly,java", 275 | "version" : "8" 276 | } 277 | } 278 | ] 279 | } 280 | } 281 | ] 282 | } -------------------------------------------------------------------------------- /Common/ourenvironment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sborenst/OpenShiftEnterprise3_Demo/68733b4147374b80674d3f3e1907a17cebe4ce87/Common/ourenvironment.png -------------------------------------------------------------------------------- /Common/scheduler.json: -------------------------------------------------------------------------------- 1 | { 2 | "predicates" : [ 3 | {"name" : "PodFitsResources"}, 4 | {"name" : "PodFitsPorts"}, 5 | {"name" : "NoDiskConflict"}, 6 | {"name" : "Region", "argument" : {"serviceAffinity" : { "labels" : ["region"]}}} 7 | ],"priorities" : [ 8 | {"name" : "LeastRequestedPriority", "weight" : 1}, 9 | {"name" : "ServiceSpreadingPriority", "weight" : 1}, 10 | {"name" : "Zone", "weight" : 2, "argument" : {"serviceAntiAffinity" : { "label" : "zone" }}} 11 | ] 12 | } -------------------------------------------------------------------------------- /Demonstration.Environment.Setup.adoc: -------------------------------------------------------------------------------- 1 | == Set up your Demonstration Environment 2 | 3 | === Provision Your Demonstration Environment Using Red Hat Product Demo System. 4 | 5 | To perform this demonstration, you must provision the demonstration environment. 6 | Provisioning ensures that you have access to an environment containing all the 7 | components you need to perform this demonstration. 8 | 9 | NOTE: In case you already have an *"OpenShift FASTRAX"* environment you could 10 | use it as they are exactly the same. That means you can skip the following steps 11 | and skip to *"Run the Deployment Script"* section 12 | 13 | 14 | . Go to https://rhpds.redhat.com and use your credentials to log in to the 15 | OPENTLC labs provisioning system, which is built on top of Red Hat CloudForms 16 | to provide a self-service portal. 17 | + 18 | [TIP] 19 | If you forgot your username or password, go to https://www.opentlc.com/pwm to 20 | reset your password or obtain a username reminder. 21 | 22 | . After you log in, navigate to *Services -> Catalogs -> All Services -> 23 | Cloud Infrastructure Demos*. 24 | 25 | . On the left side of the screen, locate the *OpenShift 3.0 Demo* catalog item 26 | and select it. 27 | 28 | . Read the demo's description text for updates other important information 29 | 30 | IMPORTANT: The root user credentials for the demonstration environment will be 31 | listed in the Demonstration description box, make sure you note them down as 32 | they will not be mentioned anywhere in this document. 33 | 34 | . Click the *Order* button that appears on the right. 35 | 36 | . On the next screen, click *Submit* (on the lower right side) to 37 | order your environment. 38 | + 39 | In a few minutes you will receive an email containing the details on how to 40 | connect to the environment. 41 | 42 | . Wait about 30 minutes to allow the environment to build. Your environment 43 | includes the following entities: 44 | - One host for the Master 45 | - One Infrastructure node (Not required) <1> 46 | - Two hosts for nodes 47 | - One administration host for connection into the environment and miscellaneous 48 | tasks 49 | - IPA identity management 50 | 51 | <1> We use this server to demonstrate a highly scalable architecture 52 | [WARNING] 53 | Do not attempt to use *App Control -> Start* after ordering the demo. 54 | The environment is already starting up. Using this command this may corrupt 55 | your environment or cause other complications. To receive an email with your 56 | environments status, select *Status*. 57 | 58 | [NOTE] 59 | Because the environment is all cloud-based, you can access it over the WAN from 60 | anywhere. You should not, however, expect performance to match a bare-metal 61 | environment. 62 | === Set Up SSH 63 | 64 | To access any of your lab systems via SSH, you must use your personal 65 | OPENTLC SSO user name and public SSH key. *(These are the credentials you used 66 | to connect to _labs.opentlc.com_ and _rhpds.redhat.com_`) 67 | 68 | 69 | `If you have not already done so`, you must provide a public SSH key to the 70 | OPENTLC authentication system. 71 | 72 | . Go to https://www.opentlc.com/update and log in. (Using your Opentlc credentials) 73 | + 74 | NOTE: For more information on generating an SSH key, 75 | see the following: 76 | link:https://www.opentlc.com/ssh.html[https://www.opentlc.com/ssh.html] 77 | 78 | . Paste your public key in that location. 79 | 80 | === Test your ability to connect to your servers 81 | 82 | The `oselab` host, (aka: the administration host) is just there to serve 83 | as an access point into the environment and is not part of the OpenShift 84 | environment. (We do actually use th oselab as our dedicated DNS server, but that 85 | is not an OpenShift component.) 86 | 87 | NOTE: An email with all the host Public IPs and DNS host names was sent to you 88 | as soon as the environment started provisioning, if you did not recieve this 89 | email please check your spam folder and verify in RHPDS that your environment 90 | has been deployed. 91 | 92 | . Connect to your administration host and make sure you can access each of your 93 | provisioned hosts: 94 | + 95 | ---- 96 | ssh -i ~/.ssh/yourprivatekey.key opentlcuser@oselab-GUID.oslab.opentlc.com 97 | ---- 98 | 99 | [NOTE] 100 | The text *GUID* is a 4-character unique identifier generated for your lab 101 | environment. Your GUID is at the top of the lab provisioning email. 102 | + 103 | [NOTE] 104 | In these labs, you will see "$guid" and $GUID" used to signify your unique 105 | identifier, We create a environment variable so you don't have to type it each 106 | time. 107 | 108 | .Example 109 | ---- 110 | Laptop$ ssh -i ~/.ssh/mykey.key shacharb-redhat.com@oselab-c3po.oslab.opentlc.com 111 | (root password is: provided) 112 | ---- 113 | 114 | . Once connected to *oselab*, test the connection to each server: 115 | .. use the same *root* password as before : *provided*, when prompted 116 | + 117 | ---- 118 | -bash-4.2$ ssh root@192.168.0.100 119 | -bash-4.2$ ssh root@192.168.0.101 120 | -bash-4.2$ ssh root@192.168.0.200 121 | -bash-4.2$ ssh root@192.168.0.201 122 | ---- 123 | 124 | == Run the Deployment Script 125 | To create the users, projects and other resources that are required for the 126 | Demonstration, we need to run the *Demo_Deployment_Script.sh* 127 | 128 | . From the *Master* (Master00) server, As *root*, run the following command and watch the 129 | script for errors: 130 | + 131 | ---- 132 | [root@master00-GUID ~]# bash /root/Demo_Deployment_Script.sh 133 | ---- 134 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /README.adoc: -------------------------------------------------------------------------------- 1 | :toc: macro 2 | 3 | = OpenShift 3.1 Demonstration 4 | 5 | toc::[] 6 | 7 | = Demonstration Tracks and Snippets 8 | 9 | In this demonstration guide we provide multiple "Demo Snippets". + 10 | _Demo Snippets_ are short demonstrations that can run independently from each 11 | other. + 12 | 13 | When demonstrating any technology, its important to put the demonstrations into 14 | context, we gathered snippets into *Tracks* as a suggestion but you can mix and 15 | match snippets according to your audience. 16 | 17 | You can create any demo with this fully functional environment, please feel free 18 | to email me your snippet [sborenst@redhat.com] 19 | 20 | === Developer's Day Demonstration Scenario (the David track) 21 | 22 | * *Goal* - Demonstrate OpenShift Enterprise's ability to simplify and streamline 23 | rapid application development. 24 | * *Audience* - This is a technical demonstration intended for technical 25 | resources, but you can present it at different depths. 26 | * Consider your audience's areas of interest and select the most appropriate 27 | demo snippets: 28 | - Snippet - link:Snippet_DeployPrebuiltImage/DemoSnippet.adoc[Deploy Application 29 | from a Docker Image and scale.] (command line) 30 | - Snippet - link:Snippet_DeployS2I/DemoSnippet.adoc[Deploy Application 31 | from Git repository Using S2I Build and scale.] (web console) 32 | - Snippet - link:Snippet_DeployTemplate_2tier/DemoSnippet.adoc[Deploy a 33 | two-tiered application from a template] (web console and command line) 34 | 35 | === Operation Team's Day Demonstration Scenario (the Karla track) 36 | 37 | NOTE: *Under Construction and not available atm* 38 | 39 | * *Goal* - Demonstrate OpenShift Enterprise's ability to reduce the complexity 40 | of application deployment and management. 41 | * *Audience* - This is a technical demonstration intended for technical 42 | resources, but you can present it at different depths. 43 | * Consider your audience's areas of interest and select the most appropriate 44 | demo snippets: 45 | - Snippet - Demonstrate application scaling (command line) 46 | - Snippet - Demonstrate application update and rollback 47 | 48 | 49 | = Environment Setup 50 | 51 | This Demonstration is designed to work the the *Red Hat Product Demo System* 52 | (link:https://rhpds.redhat.com[]). + 53 | 54 | NOTE: It is assumed that you have OPENTLC credentials to access the *RHPDS* 55 | environment, and that have completed the _OpenShift FASTRAX training_. 56 | 57 | Follow the instructions in the 58 | link:Demonstration.Environment.Setup.adoc[Demonstration Environment Setup] 59 | Page to provision and configure your environment. 60 | 61 | When you provision your environment you will receive an email from OPENTLC with 62 | the connection details of your environment (IPs and hostnames *not passwords*). 63 | 64 | = Environment Overview 65 | 66 | Our environment is designed to demonstrate a highly scalable PaaS architecture. 67 | We created a 2 layer topology based on Regions and Zones. 68 | 69 | Our *master00* host will be used to host some of the management components of 70 | OpenShift Enterprise, Components such as the Web Console, *The API service* and 71 | the *etcd store*. 72 | 73 | *Infranode* is a regular node like the others but by changing the labels applied 74 | to the node we are going to dedicate it to be used only for "Infrastructure 75 | containers". This is a design choice and not a mandatory constraint. 76 | 77 | the *nodes*, nodes are hosts that are used to run containers (Pods) in the OSE 78 | environment, we label the two nodes to be in the same region but different 79 | zones. This is to simulate a use-case of an environment in a single region and 80 | possibly two cloud availability zones. 81 | 82 | image::Common/ourenvironment.png[our environment] 83 | 84 | = Get Started 85 | 86 | To get started, you need to: 87 | 88 | * Deploy your environment by following the instructions in the 89 | link:Demonstration.Environment.Setup.adoc[Demonstration Environment Setup] page. 90 | - Allow about 30 minutes for provisioning and auto installation and about 5 91 | minutes for running the demo deployment script. 92 | * Read the _Legend_ and demonstration tips in the 93 | link:Additional.Information.adoc[additional information] page. 94 | * Pick a snippet from the available snippet list: 95 | - Snippet - link:Snippet_DeployPrebuiltImage/DemoSnippet.adoc[Deploy Application 96 | from a Docker Image and scale.] (command line) 97 | - Snippet - link:Snippet_DeployS2I/DemoSnippet.adoc[Deploy Application 98 | from Git repository Using S2I Build and scale.] (web console) 99 | - Snippet - link:Snippet_DeployTemplate_2tier/DemoSnippet.adoc[Deploy a 100 | two-tiered application from a template] (web console and command line) 101 | -------------------------------------------------------------------------------- /Snippet_DeployPrebuiltImage/DemoSnippet.adoc: -------------------------------------------------------------------------------- 1 | = Deploy Application from a Docker Image and scale. 2 | :scrollbar: 3 | :data-uri: 4 | :toc: macro 5 | 6 | 7 | toc::[] 8 | 9 | == Deploy From Prebuilt Containers (`hello-openshift` version) 10 | 11 | === Scenario 12 | 13 | In this scenario, David wants to deploy an application based on a container created by someone. 14 | 15 | === Before you begin 16 | 17 | * Did you provision your environment and run the the Demo Deployment Script as 18 | described in 19 | link:Demonstration.Environment.Setup.adoc[Demonstration Environment Setup] page? 20 | * Do you know your environment's GUID? (This would appear in the provisioning 21 | email you would have received when you requested your environment) 22 | * If you already authenticated to openshift (*oc login* command) with a user 23 | (e.g 'david') you don't need to do it again every snippet and you can skip those 24 | instructions in the snippet. 25 | * Credentials for the 'root' user is available in the demonstration environment 26 | description in rhpds.redhat.com not in this document. 27 | * Did you read the _Legend_ and demonstration tips in the 28 | link:Additional.Information.adoc[additional information] page? 29 | 30 | * good luck, 31 | 32 | === Login and Authenticate 33 | 34 | . *Action* - Login to your server and switch to the user `david`. 35 | + 36 | ---- 37 | #From your workstation 38 | [sborenst@desktop01 ~]$ ssh -i ~/.ssh/sborenstkey.pub shacharb-redhat.com@oselab-GUID.oslab.opentlc.com 39 | 40 | #From you administration host (oselab) 41 | [bash-4.2$ ~] ssh root@192.168.0.100 42 | root@192.168.0.100's password: ******** (provided) 43 | 44 | # From the Master server (Master00) 45 | [root@master00-GUID ~]# su - david 46 | [david@master00-GUID ~]$ #you're in 47 | 48 | ---- 49 | NOTE: user "david" not found? You probably missed the "" 50 | . *Action* - As user `david` log in to OpenShift (Password: *provided*)and select the `hello-openshift-demo` project. 51 | + 52 | ** *Caution* - If you have _already logged in_ to OpenShift Enterprise, _do not_ run the `oc login` command again. Because you are already logged in, this will result in an error on screen. 53 | ** *Explain* that you are currently logging in to the master as part of this demonstration, but consider that every command that `david` issues is a command that a developer would do on his or her laptop or workstation, or from wherever he or she is working. 54 | ** *Explain* what projects are and how different projects could have different user permissions and quotas attached to them. 55 | + 56 | ---- 57 | 58 | [david@master00~]$ oc login -u david --insecure-skip-tls-verify --server=https://master00-${GUID}.oslab.opentlc.com:8443 59 | (Password is: provided) 60 | 61 | ---- 62 | 63 | You should expect output similar to this one: 64 | ---- 65 | Login successful. 66 | 67 | Using project "hello-openshift-demo". 68 | 69 | You have access to the following projects and can switch between them with 'oc project ': 70 | 71 | * hello-openshift-demo (current) 72 | * instantapps-demo 73 | * sourcetoimage-demo 74 | * weightwatcher-demo 75 | 76 | Welcome to OpenShift! See 'oc help' to get started. 77 | 78 | 79 | ---- 80 | . If you are not already using the *hello-openshift-demo* project, switch to it: 81 | + 82 | ---- 83 | [david@master00]$ oc project hello-openshift-demo 84 | Now using project "hello-openshift-demo" on server "https://master00-8675.oslab.opentlc.com:8443". 85 | 86 | ---- 87 | 88 | === Define the Pod 89 | 90 | 91 | Here you define the pod, but not the service, replication controllers, or routes. 92 | 93 | . *Show* the `hello-openshift-podonly.json` file. 94 | ** *Explain* that this is a very simple pod definition example and it does not cover services, routes, and other resources. 95 | ** *Point out* the following: 96 | *** `name` - This is the name of the pod. 97 | *** `image` - This is the container image that this pod is running. This can be a local registry or an external one (like `docker.io`). 98 | *** `ports` - These are the ports that the Docker container exposes. Your code and application need to listen on those ports as well. 99 | *** `labels` - This is perhaps the most important component. Labels are "tags" that you apply, so that you can refer to a group of resources (pods, services, and so on). 100 | 101 | 102 | 103 | [source,json] 104 | ---- 105 | [david@master00~]$ cat hello-openshift-pod.json 106 | include::hello-openshift-pod.json[] 107 | ---- 108 | 109 | 110 | === Create the Pod 111 | 112 | Here you create the pod, but not the service, replication controllers, or routes. 113 | 114 | . *Action* - Use the `oc create` command to create the pod from the `hello-openshift-pod.json` file. 115 | ** *Explain* that during this process, OpenShift Enterprise reviews and processes the file. You could easily have added other pods or resources into the file, and OpenShift Enterprise would have processed them together. 116 | . *Optional* - You can use the `docker ps` command to show the running container and the `docker logs -f $DOCKERPID&` command to show the internal Docker log for the container being built. 117 | + 118 | ---- 119 | 120 | [david@master00~]$ oc create -f hello-openshift-pod.json 121 | ---- 122 | 123 | . Expect the following output: 124 | ---- 125 | pods/hello-openshift-pod 126 | ---- 127 | 128 | . *Action* - Run *oc get pods* to show the pod status and that you can access the pod locally. 129 | ** *Explain* the output to the audience. 130 | ** *Point out* the following: 131 | *** `NAME` - The pod name. 132 | *** `REASON` - The pod's status or last error message 133 | *** `AGE` - The pod age since it was first launched. 134 | 135 | + 136 | ---- 137 | 138 | 139 | [david@master00~]$ oc get pods 140 | NAME READY REASON RESTARTS AGE 141 | hello-openshift 1/1 Running 0 20s 142 | ---- 143 | . *Action* get the pod's information using *oc describe* 144 | + 145 | ---- 146 | [david@master00~]$ oc describe pod hello-openshift 147 | ---- 148 | 149 | . You will see output similar to this one: 150 | ** *Point out* the following: 151 | *** `Image` - This is the Docker image that is used to deploy this pod. 152 | *** `Host` - This is the host that our pods resides/runs in. 153 | *** `IP` - This is the internal IP address accessible on the local network. 154 | + 155 | ---- 156 | Name: hello-openshift 157 | Image(s): openshift/hello-openshift:v0.4.3 158 | Host: node00-f4fc.oslab.opentlc.com/192.168.0.200 159 | Labels: name=hello-openshift 160 | Status: Running 161 | IP: 10.1.0.9 162 | Replication Controllers: 163 | Containers: 164 | hello-openshift: 165 | Image: openshift/hello-openshift:v0.4.3 166 | State: Running 167 | Started: Fri, 03 Jul 2015 02:11:24 -0400 168 | Ready: True 169 | Restart Count: 0 170 | Conditions: 171 | Type Status 172 | Ready True 173 | Events: 174 | 175 | 176 | ---- 177 | 178 | . *Action* - Test your pod 179 | . *CATION* You need to use the `IP`of `your` own pod from the last output 180 | + 181 | ---- 182 | [david@master00~]$ curl http://10.1.0.9:8080 183 | 184 | ---- 185 | . Expect the following output: 186 | + 187 | ---- 188 | Hello OpenShift! 189 | ---- 190 | 191 | NOTE: The container will be up in a few seconds, but the application in the container might take a few minutes to load. 192 | 193 | 194 | === Deploy a Complete Application With Service and Route to Match 195 | 196 | . *Action* - Review the following complete application example `hello-openshift-complete.json` file. 197 | ** *Ask* how complicated or simple it would be to define a full application stack in the audience's current environment. 198 | ** *Point out* the following: 199 | + 200 | [NOTE] 201 | You should understand every line in the file in case the audience asks questions. However, do not explain each line. 202 | 203 | *** `"kind": "Service"` - Explain what a service is and that here you are creating a "front end" for this pod or group of pods. 204 | *** `"kind": "Route"` - Explain that a route resource allows external access using a HAProxy container. You could have many routes to the same application. 205 | *** `"replicas": 1` - Explain that you currently set this pod to have a single replica. If you want to deploy many replicas or scale out at any time, you can simply change this value. 206 | *** `"labels":` - The label you enter here is applied to each resource item you create for this application. This simplifies management. 207 | *** `"triggers":` - This is an optional component. Explain that you can set triggers to redeploy containers under certain conditions--for example, if a newer image is available. 208 | 209 | + 210 | [source,json] 211 | ---- 212 | 213 | [david@master00~]$ cat hello-openshift-complete.json 214 | include::hello-openshift-complete.json[] 215 | 216 | ---- 217 | 218 | . *Action* - Create your application using the *oc create* command. 219 | ** *Explain* that by passing the `.json` file to OpenShift Enterprise, you are requesting all the resource items in the file to be created. 220 | ** *Optional* - Show your audience the web console. 221 | .. *Ask* the audience for any questions. This is a good time to find out, for example, if the process is clear, or if they see themselves using this tool. 222 | + 223 | ---- 224 | 225 | [david@master00~]$ oc create -f hello-openshift-complete.json 226 | [david@master00~]$ oc expose service hello-openshift-service --hostname=hello-openshift.cloudapps-$GUID.oslab.opentlc.com 227 | ---- 228 | 229 | 230 | === Show the Application Using Your Browser 231 | 232 | . *Action* - Browse to: link:http://hello-openshift.cloudapps-$GUID.oslab.opentlc.com[http://hello-openshift.cloudapps-$GUID.oslab.opentlc.com] 233 | ** *Explain* that you have now deployed a container that is externally accessible. You could scale the application at any time, and the route and service ensure that traffic always routes to the application. 234 | ** *Big finish* - Offer some closing words on this demo. 235 | 236 | 237 | === Show the Application Using the Command Line 238 | 239 | . *Action* - You can run the following commands to show the application resources from the command line 240 | .. *Show* The audience that you now have a Pod, a ReplicationController (RC) and a DeploymentConfig (DC) 241 | .. *Explain* the roles of the RC and DC resources. 242 | .. *Point Out:* 243 | ... The differences between the single sad pod from the beginning of this demonstration and the pod that was generated by our DC and RC 244 | ... That when we run *oc get rc* and see our RCs we can see how many replicas we are running. 245 | ---- 246 | [david@master00-70ac ~]$ oc get pods 247 | POD IP CONTAINER(S) IMAGE(S) HOST LABELS STATUS CREATED 248 | hello-openshift-1-ok0aa 10.1.0.6 hello-openshift openshift/hello-openshift master00-70ac.oslab.opentlc.com/192.168.0.100 deployment=hello-openshift-1,deploymentconfig=hello-openshift,name=hello-openshift Running About a minute 249 | hello-openshift-pod 10.1.0.5 hello-openshift-singlesadpod openshift/hello-openshift master00-70ac.oslab.opentlc.com/192.168.0.100 name=hello-openshift-singlesadpod Running 2 minutes 250 | [david@master00-70ac ~]$ oc get dc 251 | NAME TRIGGERS LATEST VERSION 252 | hello-openshift ImageChange 1 253 | [david@master00-70ac ~]$ oc get rc 254 | CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS 255 | hello-openshift-1 hello-openshift openshift/hello-openshift deployment=hello-openshift-1,deploymentconfig=hello-openshift,name=hello-openshift 1 256 | 257 | [david@master00-70ac ~]$ curl http://hello-openshift.cloudapps-$GUID.oslab.opentlc.com 258 | Hello OpenShift! 259 | ---- 260 | 261 | === Optional - Show how to increase the replicas of the deployed pods. 262 | 263 | . *Action* - Run the following command. 264 | .. *Explain* the role of the DC (`DeploymentConfig`) 265 | .. *Point Out:* 266 | - Triggers - What makes the DC redeploy the pods 267 | - Replicas - How many replicas are required of this pod - This is where we will make a permanent change to an environment 268 | 269 | ---- 270 | 271 | [david@master00-70ac ~]$ oc describe dc hello-openshift 272 | Name: hello-openshift 273 | Created: 3 minutes ago 274 | Labels: 275 | Latest Version: 1 276 | Triggers: Config 277 | Strategy: Recreate 278 | Template: 279 | Selector: name=hello-openshift 280 | Replicas: 1 281 | Containers: 282 | NAME IMAGE ENV 283 | hello-openshift openshift/hello-openshift:v0.4.3 284 | Deployment #1 (latest): 285 | Name: hello-openshift-1 286 | Created: 3 minutes ago 287 | Status: Complete 288 | Replicas: 1 current / 1 desired 289 | Selector: deployment=hello-openshift-1,deploymentconfig=hello-openshift,name=hello-openshift 290 | Labels: openshift.io/deployment-config.name=hello-openshift 291 | Pods Status: 1 Running / 0 Waiting / 0 Succeeded / 0 Failed 292 | No events. 293 | 294 | 295 | ---- 296 | 297 | 298 | . *Action* - Run the following command. 299 | .. *Action* - Use the *oc scale* command to increase the *replica* count from 1 to 10. 300 | .. *Explain* By changing the DeploymentConfig we are raising the "desired state" of the replica count from 1 to 10, this will result in immediate change. 301 | .. *Note* How efficient OpenShift 3 is, the output of the *oc scale* command is the simple and concise *"scaled"* 302 | 303 | ---- 304 | 305 | [david@master00-70ac ~]$ oc scale dc hello-openshift --replicas=10 306 | scaled 307 | ---- 308 | 309 | . *Action* - Run the following commands to show the the new replicas that were created and that the service has updated with the new pods. 310 | .. *Explain* that new pods are created by the RC the next time it syncs with the desired state defined in the DC 311 | ...*Explain* The Service will be updated with the new pod names as they appear. 312 | 313 | ---- 314 | [david@master00-70ac ~]$ oc get pods 315 | NAME READY REASON RESTARTS AGE 316 | hello-openshift-1-0dxco 1/1 Running 0 4m 317 | hello-openshift-1-0zyoj 1/1 Running 0 4m 318 | hello-openshift-1-17j8o 1/1 Running 0 8m 319 | hello-openshift-1-8rfly 1/1 Running 0 8m 320 | hello-openshift-1-9ve89 1/1 Running 0 4m 321 | hello-openshift-1-bcw8z 1/1 Running 0 8m 322 | hello-openshift-1-dtfos 1/1 Running 0 14m 323 | hello-openshift-1-mtv6s 1/1 Running 0 8m 324 | hello-openshift-1-r1lbp 1/1 Running 0 4m 325 | hello-openshift-1-y8ffs 1/1 Running 0 4m 326 | ---- 327 | 328 | . *Action* Use the *oc describe* command to display the service. 329 | .. *Explain* That the service is automatically listing all the new pods that have the label: *"name=hello-openshift"* 330 | + 331 | ---- 332 | [david@master00-70ac ~]$ oc describe service hello-openshift-service 333 | Name: hello-openshift-service 334 | Labels: 335 | Selector: name=hello-openshift 336 | Type: ClusterIP 337 | IP: 172.30.47.5 338 | Port: 27017/TCP 339 | Endpoints: 10.1.0.14:8080,10.1.0.15:8080,10.1.0.16:8080 + 7 more... 340 | Session Affinity: None 341 | No events. 342 | ---- 343 | 344 | . *Optional Action* - If you have a room full of syntax geeks you can show this example of getting the pods to display with their nodes and ips 345 | .. *Explain* that we can use edit the `template` of our output on the fly and call on different attributes in the object 346 | + 347 | ---- 348 | [david@master00-f4fc ~]$ oc get pod -t '{{range .items}}{{.metadata.name}}| {{.status.phase}} | {{.spec.host}} | {{.status.podIP}} {{"\n"}}{{end}}' 349 | 350 | hello-openshift-1-0dxco| Running | node01-f4fc.oslab.opentlc.com | 10.1.1.10 351 | hello-openshift-1-0zyoj| Running | node01-f4fc.oslab.opentlc.com | 10.1.1.9 352 | hello-openshift-1-17j8o| Running | node00-f4fc.oslab.opentlc.com | 10.1.0.15 353 | hello-openshift-1-8rfly| Running | node01-f4fc.oslab.opentlc.com | 10.1.1.7 354 | hello-openshift-1-9ve89| Running | node00-f4fc.oslab.opentlc.com | 10.1.0.16 355 | hello-openshift-1-bcw8z| Running | node01-f4fc.oslab.opentlc.com | 10.1.1.8 356 | hello-openshift-1-dtfos| Running | node00-f4fc.oslab.opentlc.com | 10.1.0.14 357 | hello-openshift-1-mtv6s| Running | node01-f4fc.oslab.opentlc.com | 10.1.1.6 358 | hello-openshift-1-r1lbp| Running | node00-f4fc.oslab.opentlc.com | 10.1.0.17 359 | hello-openshift-1-y8ffs| Running | node00-f4fc.oslab.opentlc.com | 10.1.0.18 360 | 361 | ---- 362 | -------------------------------------------------------------------------------- /Snippet_DeployPrebuiltImage/hello-openshift-complete.json: -------------------------------------------------------------------------------- 1 | { 2 | "kind": "List", 3 | "apiVersion": "v1", 4 | "metadata": { 5 | "name": "hello-service-complete-example" 6 | }, 7 | "items": [ 8 | { 9 | "kind": "Service", 10 | "apiVersion": "v1", 11 | "metadata": { 12 | "name": "hello-openshift-service", 13 | "labels": { 14 | "name": "hello-openshift" 15 | } 16 | }, 17 | "spec": { 18 | "selector": { 19 | "name": "hello-openshift" 20 | }, 21 | "ports": [ 22 | { 23 | "protocol": "TCP", 24 | "port": 27017, 25 | "targetPort": 8080 26 | } 27 | ] 28 | } 29 | }, 30 | { 31 | "kind": "Route", 32 | "apiVersion": "v1", 33 | "metadata": { 34 | "name": "hello-openshift-route", 35 | "labels": { 36 | "name": "hello-openshift" 37 | } 38 | }, 39 | "spec": { 40 | "host": "hello-openshift-demo.cloudapps-GUID.oslab.opentlc.com", 41 | "to": { 42 | "name": "hello-openshift-service" 43 | }, 44 | "tls": { 45 | "termination": "edge" 46 | } 47 | } 48 | }, 49 | { 50 | "kind": "DeploymentConfig", 51 | "apiVersion": "v1", 52 | "metadata": { 53 | "name": "hello-openshift", 54 | "labels": { 55 | "name": "hello-openshift" 56 | } 57 | }, 58 | "spec": { 59 | "strategy": { 60 | "type": "Recreate", 61 | "resources": {} 62 | }, 63 | "triggers": [ 64 | { 65 | "type": "ConfigChange" 66 | } 67 | ], 68 | "replicas": 1, 69 | "selector": { 70 | "name": "hello-openshift" 71 | }, 72 | "template": { 73 | "metadata": { 74 | "creationTimestamp": null, 75 | "labels": { 76 | "name": "hello-openshift" 77 | } 78 | }, 79 | "spec": { 80 | "containers": [ 81 | { 82 | "name": "hello-openshift", 83 | "image": "openshift/hello-openshift:v1.0.6", 84 | "ports": [ 85 | { 86 | "name": "http", 87 | "containerPort": 8080, 88 | "protocol": "TCP" 89 | } 90 | ], 91 | "resources": { 92 | "limits": { 93 | "cpu": "10m", 94 | "memory": "16Mi" 95 | } 96 | }, 97 | "terminationMessagePath": "/dev/termination-log", 98 | "imagePullPolicy": "IfNotPresent", 99 | "capabilities": {}, 100 | "securityContext": { 101 | "capabilities": {}, 102 | "privileged": false 103 | }, 104 | "livenessProbe": { 105 | "tcpSocket": { 106 | "port": 8080 107 | }, 108 | "timeoutSeconds": 1, 109 | "initialDelaySeconds": 10 110 | } 111 | } 112 | ], 113 | "restartPolicy": "Always", 114 | "dnsPolicy": "ClusterFirst", 115 | "serviceAccount": "", 116 | "nodeSelector": { 117 | "region": "primary" 118 | } 119 | } 120 | } 121 | } 122 | } 123 | ] 124 | } 125 | -------------------------------------------------------------------------------- /Snippet_DeployPrebuiltImage/hello-openshift-pod.json: -------------------------------------------------------------------------------- 1 | { 2 | "kind": "Pod", 3 | "apiVersion": "v1", 4 | "metadata": { 5 | "name": "hello-openshift", 6 | "creationTimestamp": null, 7 | "labels": { 8 | "name": "hello-openshift" 9 | } 10 | }, 11 | "spec": { 12 | "containers": [ 13 | { 14 | "name": "hello-openshift", 15 | "image": "openshift/hello-openshift:latest", 16 | "ports": [ 17 | { 18 | "containerPort": 8080, 19 | "protocol": "TCP" 20 | } 21 | ], 22 | "resources": { 23 | "limits": { 24 | "cpu": "10m", 25 | "memory": "16Mi" 26 | } 27 | }, 28 | "terminationMessagePath": "/dev/termination-log", 29 | "imagePullPolicy": "IfNotPresent", 30 | "capabilities": {}, 31 | "securityContext": { 32 | "capabilities": {}, 33 | "privileged": false 34 | }, 35 | "nodeSelector": { 36 | "region": "primary" 37 | } 38 | } 39 | ], 40 | "restartPolicy": "Always", 41 | "dnsPolicy": "ClusterFirst", 42 | "serviceAccount": "" 43 | }, 44 | "status": {} 45 | } 46 | -------------------------------------------------------------------------------- /Snippet_DeployPrebuiltImage/weightwatcher-complete.json: -------------------------------------------------------------------------------- 1 | { 2 | "kind": "List", 3 | "apiVersion": "v1", 4 | "metadata": { 5 | "name": "weightwatcher-complete-example" 6 | }, 7 | "items": [ 8 | { 9 | "kind": "Service", 10 | "apiVersion": "v1", 11 | "metadata": { 12 | "name": "weightwatcher-service" 13 | }, 14 | "spec": { 15 | "selector": { 16 | "name": "weightwatcher" 17 | }, 18 | "ports": [ 19 | { 20 | "protocol": "TCP", 21 | "port": 27017, 22 | "targetPort": 8080 23 | } 24 | ] 25 | } 26 | }, 27 | { 28 | "kind": "Route", 29 | "apiVersion": "v1", 30 | "metadata": { 31 | "name": "weightwatcher-route" 32 | }, 33 | "spec": { 34 | "host": "weightwatcher-demo.weighwatcher.cloudapps-GUID.oslab.opentlc.com", 35 | "to": { 36 | "name": "weightwatcher-service" 37 | } 38 | } 39 | }, 40 | { 41 | "kind": "Pod", 42 | "apiVersion": "v1", 43 | "metadata": { 44 | "name": "weightwatcher", 45 | "creationTimestamp": null, 46 | "labels": { 47 | "name": "weightwatcher" 48 | } 49 | }, 50 | "spec": { 51 | "containers": [ 52 | { 53 | "name": "weightwatcher", 54 | "image": "spicozzi/weightwatcher", 55 | "ports": [ 56 | { 57 | "containerPort": 8080, 58 | "protocol": "TCP" 59 | } 60 | ], 61 | "resources": { 62 | "limits": { 63 | "cpu": "10m", 64 | "memory": "500Mi" 65 | } 66 | }, 67 | "terminationMessagePath": "/dev/termination-log", 68 | "imagePullPolicy": "IfNotPresent", 69 | "capabilities": {}, 70 | "securityContext": { 71 | "capabilities": {}, 72 | "privileged": true 73 | }, 74 | "nodeSelector": { 75 | "region": "primary" 76 | } 77 | } 78 | ], 79 | "restartPolicy": "Always", 80 | "dnsPolicy": "ClusterFirst", 81 | "serviceAccount": "" 82 | }, 83 | "status": {} 84 | } 85 | 86 | 87 | ] 88 | } 89 | -------------------------------------------------------------------------------- /Snippet_DeployPrebuiltImage/weightwatcher-pod.json: -------------------------------------------------------------------------------- 1 | { 2 | "kind": "Pod", 3 | "apiVersion": "v1", 4 | "metadata": { 5 | "name": "weightwatcher", 6 | "creationTimestamp": null, 7 | "labels": { 8 | "name": "weightwatcher" 9 | } 10 | }, 11 | "spec": { 12 | "containers": [ 13 | { 14 | "name": "weightwatcher-singlesadpod", 15 | "image": "spicozzi/weightwatcher", 16 | "ports": [ 17 | { 18 | "containerPort": 8080, 19 | "protocol": "TCP" 20 | } 21 | ], 22 | "resources": { 23 | "limits": { 24 | "cpu": "10m", 25 | "memory": "500Mi" 26 | } 27 | }, 28 | "terminationMessagePath": "/dev/termination-log", 29 | "imagePullPolicy": "IfNotPresent", 30 | "capabilities": {}, 31 | "securityContext": { 32 | "capabilities": {}, 33 | "privileged": true 34 | }, 35 | "nodeSelector": { 36 | "region": "primary" 37 | } 38 | } 39 | ], 40 | "restartPolicy": "Always", 41 | "dnsPolicy": "ClusterFirst", 42 | "serviceAccount": "" 43 | }, 44 | "status": {} 45 | } 46 | -------------------------------------------------------------------------------- /Snippet_DeployS2I/DemoSnippet.adoc: -------------------------------------------------------------------------------- 1 | = Deploy Application from Git repository Using S2I Build and scale. 2 | :scrollbar: 3 | :data-uri: 4 | :toc: macro 5 | 6 | toc::[] 7 | 8 | == Deploy From an Existing Git Repository 9 | 10 | === Scenario 11 | 12 | In this scenario, David wants to deploy and test an application from an existing 13 | Git repository. 14 | 15 | === Before you begin 16 | 17 | * Did you provision your environment and run the the Demo Deployment Script as 18 | described in 19 | link:Demonstration.Environment.Setup.adoc[Demonstration Environment Setup] page? 20 | * Do you know your environment's GUID? (This would appear in the provisioning 21 | email you would have received when you requested your environment) 22 | * If you already authenticated to openshift (*oc login* command) with a user 23 | (e.g 'david') you don't need to do it again every snippet and you can skip those 24 | instructions in the snippet. 25 | * Credentials for the 'root' user is available in the demonstration environment 26 | description in rhpds.redhat.com not in this document. 27 | * Did you read the _Legend_ and demonstration tips in the 28 | link:Additional.Information.adoc[additional information] page? 29 | 30 | * good luck, 31 | 32 | 33 | In this scenario, David wants to deploy and test an application from an existing 34 | Git repository. 35 | 36 | === Review the Target Git Repository and Log In to the OpenShift Web Console 37 | 38 | . *Action* - Browse to 39 | link:https://github.com/openshift/simple-openshift-sinatra-sti[https://github.com/openshift/simple-openshift-sinatra-sti]. 40 | ** *Explain* that what you see here is a Git repository containing a sample Ruby 41 | application using the Sinatra Ruby Gem. 42 | 43 | ** *Optional* - Review the files briefly with the audience if you think it would 44 | help them understand. 45 | . *Action* - Browse to 46 | link:https://master00-GUID.oslab.opentlc.com:8443[https://master00-GUID.oslab.opentlc.com:8443] and log in using the `david` account with the password provided 47 | + 48 | [NOTE] 49 | *GUID* in the URL refers to your Global Unique Identifier. 50 | + 51 | ==== 52 | You can see a preview here: link:images/WebUI_Login.png[WebUI Login Preview] 53 | ==== 54 | 55 | ** *Explain* that you are currently logging into the OpenShift web console as 56 | the user `david`. 57 | ** *Point out* the following: 58 | *** You can create users locally or link to an enterprise directory. 59 | *** You can group users and create working teams. 60 | *** You can use quotas to set resource limits for users, projects, and teams. 61 | 62 | === Deploy Your S2I Application 63 | 64 | . *Action* - Select the *SourceToImage* project. 65 | + 66 | ==== 67 | You can see a preview here: link:images/WebUI_SelectProject.png[WebUI Select Project Preview] 68 | ==== 69 | . *Action* - Click the *Create* button. 70 | + 71 | ==== 72 | You can see a preview here: link:images/WebUI_CreateButton.png[WebUI Create Button Preview] 73 | ==== 74 | 75 | . *Action* - Paste the Git repository into the *Source Repository* text box: 76 | link:https://github.com/openshift/simple-openshift-sinatra-sti[https://github.com/openshift/simple-openshift-sinatra-sti] 77 | + 78 | ==== 79 | You can see a preview here: link:images/WebUI_SourceRepository.png[WebUI Source Repository Preview] 80 | ==== 81 | 82 | ** *Explain* that you are creating a new application. To do that, you need to 83 | provide OpenShift Enterprise with two key pieces of information: 84 | *** The source code repository 85 | *** The builder image or the base image on which to build the container 86 | 87 | . *Action* - Click the blue arrow to progress to the next step, and select 88 | *ruby:2.0*. 89 | + 90 | ==== 91 | You can see a preview here: link:images/WebUI_SelectBuilder.png[WebUI Select Builder Preview] 92 | ==== 93 | ** *Explain* that you picked the *ruby:2.0* image as your builder image. The 94 | code and all of its dependencies will be layered on top of this image. 95 | ** *Explain* that you can have OpenShift Enterprise automatically rebuild and 96 | redeploy the entire application if an image update occurs. 97 | ** *Explain* that you can have different `ImageStreams`. You can deploy from 98 | either certified Red Hat builder images or your own. 99 | 100 | . *Action* - Confirm your selection by clicking *Select this Image*. 101 | ** *Show* and *explain* that next you select the application attributes, such 102 | as ports, routes, triggers, and more. 103 | 104 | . *Action* - Set the name of the application to `simplerubyapp`. 105 | + 106 | ==== 107 | You can see a preview here: link:images/WebUI_ApplicationDetails1.png[WebUI Application Details Preview] 108 | ==== 109 | ** *Show* that you can select to have a route for the application or not. 110 | ** *Show* that you can select the number of replicas the application has. 111 | ** *Show* that you can set a label for the application to manage it by label. 112 | 113 | . *Action* - Click *Create*. 114 | + 115 | ==== 116 | You can see a preview here: link:images/WebUI_ApplicationDetails2.png[WebUI Application Details Preview] 117 | ==== 118 | ** *Show* that you got a successful message stating "All resources for 119 | application `simplerubyapp` were created successfully." 120 | ** *Show* that there are currently no pods created. 121 | 122 | . *Action* - Click *Browse* and then *Builds* 123 | ** *Show* That you can start a build or wait for the build to start 124 | automatically 125 | + 126 | ==== 127 | You can see a preview here: link:images/WebUI_Builds.png[WebUI Builds Preview] 128 | ==== 129 | 130 | + 131 | [NOTE] 132 | The web console should refresh shortly to indicate that a build was started. 133 | 134 | === The Build Process 135 | 136 | . *Action* - Connect as user `david` to your master host and authenticate to 137 | OpenShift Enterprise using the `oc login` command. 138 | ** *Caution* - If you have _already logged in_ to OpenShift Enterprise, _do not_ 139 | run the `oc login` command again. You are already logged in, and this will 140 | result in an error on the screen. 141 | + 142 | ---- 143 | [david@master00~]$ oc login -u david --insecure-skip-tls-verify --server=https://master00-${GUID}.oslab.opentlc.com:8443 144 | ---- 145 | 146 | . If you are not already using the *sourcetoimage-demo* project, switch to it: 147 | + 148 | ---- 149 | 150 | [david@master00~]$ oc project sourcetoimage-demo 151 | Using project "sourcetoimage-demo" 152 | 153 | ---- 154 | 155 | 156 | . *Action* - get information about the build using the *oc get builds* and o 157 | ** *Explain* that you can see that you requested a build process and that you 158 | can follow the build log using simple commands. 159 | ** *Point out* a few lines to explain to your audience if they are so inclined. 160 | For example, you can point out the following: 161 | *** The image that OpenShift Enterprise is selecting and importing 162 | *** The repository read and dependencies installed (Sinatra Gem) 163 | + 164 | ---- 165 | 166 | [david@master00-31c5]$ oc get builds 167 | NAME TYPE STATUS POD 168 | simplerubyapp-1 S2I Running simplerubyapp-1 169 | 170 | [david@master00-31c5 openshift]$ oc build-logs simplerubyapp-1 171 | .... 172 | .... 173 | I0703 09:21:34.916120 1 docker.go:180] Image registry.access.redhat.com/openshift3/ruby-20-rhel7:latest available locally 174 | I0703 09:21:34.916257 1 docker.go:267] Image contains io.s2i.scripts-url set to 'image:///usr/local/sti' 175 | I0703 09:21:34.916472 1 download.go:56] Using image internal scripts from: image:///usr/local/sti/assemble 176 | I0703 09:21:34.916889 1 download.go:56] Using image internal scripts from: image:///usr/local/sti/run 177 | I0703 09:21:34.943521 1 docker.go:180] Image registry.access.redhat.com/openshift3/ruby-20-rhel7:latest available locally 178 | .... 179 | ..... 180 | I0703 09:21:36.932550 1 docker.go:357] Attaching to container 181 | I0703 09:21:36.952808 1 docker.go:414] Starting container 182 | I0703 09:21:37.596081 1 docker.go:424] Waiting for container 183 | I0703 09:21:38.109326 1 sti.go:388] ---> Installing application source 184 | I0703 09:21:38.132331 1 sti.go:388] ---> Building your Ruby application from source 185 | I0703 09:21:38.132537 1 sti.go:388] ---> Running 'bundle install --deployment' 186 | I0703 09:21:43.225774 1 sti.go:388] Fetching gem metadata from https://rubygems.org/.......... 187 | I0703 09:21:49.860178 1 sti.go:388] Installing rack (1.5.2) 188 | I0703 09:21:50.158742 1 sti.go:388] Installing rack-protection (1.5.3) 189 | I0703 09:21:50.670381 1 sti.go:388] Installing tilt (1.4.1) 190 | I0703 09:21:52.292218 1 sti.go:388] Installing sinatra (1.4.5) 191 | I0703 09:21:52.292271 1 sti.go:388] Using bundler (1.3.5) 192 | I0703 09:21:52.297487 1 sti.go:388] Your bundle is complete! 193 | .... 194 | .... 195 | I0703 09:22:08.108088 1 sti.go:96] Using provided push secret for pushing 172.30.133.153:5000/sourcetoimage/simplerubyapp image 196 | I0703 09:22:08.108117 1 sti.go:99] Pushing 172.30.133.153:5000/sourcetoimage/simplerubyapp image ... 197 | I0703 09:27:07.204498 1 sti.go:103] Successfully pushed 172.30.133.153:5000/sourcetoimage/simplerubyapp 198 | ---- 199 | 200 | . *Explain* While you wait for the build to complete, *explain* the concepts of 201 | _service resources_ and _route resources_. 202 | .. *Show* the service created for this application under *Browse -> Services* in 203 | the web console. 204 | .. *Explain* services. 205 | .. *Show* that the route for the application was set. 206 | 207 | 208 | . *Action* Use the *oc get pods* command to display the pods 209 | .. *Show the status, or REASON, of the pod, it might still be "Pending" if the 210 | image is being deployed. 211 | + 212 | ---- 213 | [david@master00-31c5 ~]$ oc get pods 214 | NAME READY REASON RESTARTS AGE 215 | simplerubyapp-1-build 0/1 ExitCode:0 0 7m 216 | simplerubyapp-1-toei3 1/1 Running 0 1m 217 | 218 | ---- 219 | 220 | === Expose the service and create ANOTHER route for the environment 221 | . *Explain* A route would have already been created for you, something in the lines of: 222 | simplerubyapp.sourcetoimage-demo.cloudapps-d4fb.oslab.opentlc.com 223 | . *Action* - Show the existing *routes* for your project: 224 | + 225 | ---- 226 | [david@master00-d4fb ~]$ oc get routes 227 | NAME HOST/PORT PATH SERVICE LABELS 228 | simplerubyapp simplerubyapp.sourcetoimage-demo.cloudapps-d4fb.oslab.opentlc.com simplerubyapp generatedby=OpenShiftWebConsole,name=simplerubyapp 229 | ---- 230 | . *Action* - Run the *oc expose* command to create another route for the application. 231 | .. *Caution* - Make sure that the GUID value is populated correctly. Review the 232 | file and make sure that the `host:` value is set correctly. 233 | .. *Explain* that in the current version, you do not use the web console to set 234 | routes. In the near future, you will be able to do all this in the web console. 235 | .. *Explain* that in this scenario, you decided to add another route to your 236 | application, so it is available under another URL. 237 | .. *Explain* that you are creating a route so that when a user resolves 238 | `othername.cloudapps-GUID.oslab.opentlc.com`, you will route the user to 239 | one of the pods under the `simplerubyapp` service. 240 | .. *Show* - you can use curl or your browser to see the application at 241 | link:othername.cloudapps-GUID.oslab.opentlc.com[othername.cloudapps-GUID.oslab.opentlc.com]. 242 | + 243 | [source,json] 244 | ---- 245 | [david@master00 ~]$ oc expose service simplerubyapp --name=simplerubyapp-route --hostname=othername.cloudapps-$GUID.oslab.opentlc.com 246 | ---- 247 | 248 | . *Optional* - Add the route manually for the environment. 249 | .. *Action* - Run the *oc expose* command to create a route for the application. 250 | . *Action* - Show the existing *routes* for your project: 251 | + 252 | ---- 253 | [david@master00-d4fb ~]$ oc get routes 254 | NAME HOST/PORT PATH SERVICE LABELS 255 | simplerubyapp simplerubyapp.sourcetoimage-demo.cloudapps-d4fb.oslab.opentlc.com simplerubyapp generatedby=OpenShiftWebConsole,name=simplerubyapp 256 | simplerubyapp-route othername.cloudapps-d4fb.oslab.opentlc.com 257 | ---- 258 | 259 | 260 | === Complete the Demonstration 261 | 262 | . *Action* - Browse to: 263 | link:http://simplerubyapp.cloudapps-$GUID.oslab.opentlc.com[http://simplerubyapp.cloudapps-$GUID.oslab.opentlc.com]. 264 | ** *Explain* what you did, and that this is a very common workflow for every 265 | development environment. 266 | ** *Point out* the following: 267 | *** You created an image from a Git repository and a builder image. 268 | *** You created a service that acts as a list that represents all of your pods. 269 | *** You created a route to direct to that service. 270 | *** S2I builds _do not_ need to recreate the image every time. When the code 271 | changes, the builds just "add a layer" with the code. 272 | -------------------------------------------------------------------------------- /Snippet_DeployS2I/WebUI_Login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sborenst/OpenShiftEnterprise3_Demo/68733b4147374b80674d3f3e1907a17cebe4ce87/Snippet_DeployS2I/WebUI_Login.png -------------------------------------------------------------------------------- /Snippet_DeployS2I/images/WebUI_ApplicationDetails1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sborenst/OpenShiftEnterprise3_Demo/68733b4147374b80674d3f3e1907a17cebe4ce87/Snippet_DeployS2I/images/WebUI_ApplicationDetails1.png -------------------------------------------------------------------------------- /Snippet_DeployS2I/images/WebUI_ApplicationDetails2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sborenst/OpenShiftEnterprise3_Demo/68733b4147374b80674d3f3e1907a17cebe4ce87/Snippet_DeployS2I/images/WebUI_ApplicationDetails2.png -------------------------------------------------------------------------------- /Snippet_DeployS2I/images/WebUI_Builds.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sborenst/OpenShiftEnterprise3_Demo/68733b4147374b80674d3f3e1907a17cebe4ce87/Snippet_DeployS2I/images/WebUI_Builds.png -------------------------------------------------------------------------------- /Snippet_DeployS2I/images/WebUI_CreateButton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sborenst/OpenShiftEnterprise3_Demo/68733b4147374b80674d3f3e1907a17cebe4ce87/Snippet_DeployS2I/images/WebUI_CreateButton.png -------------------------------------------------------------------------------- /Snippet_DeployS2I/images/WebUI_Login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sborenst/OpenShiftEnterprise3_Demo/68733b4147374b80674d3f3e1907a17cebe4ce87/Snippet_DeployS2I/images/WebUI_Login.png -------------------------------------------------------------------------------- /Snippet_DeployS2I/images/WebUI_SelectBuilder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sborenst/OpenShiftEnterprise3_Demo/68733b4147374b80674d3f3e1907a17cebe4ce87/Snippet_DeployS2I/images/WebUI_SelectBuilder.png -------------------------------------------------------------------------------- /Snippet_DeployS2I/images/WebUI_SelectProject.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sborenst/OpenShiftEnterprise3_Demo/68733b4147374b80674d3f3e1907a17cebe4ce87/Snippet_DeployS2I/images/WebUI_SelectProject.png -------------------------------------------------------------------------------- /Snippet_DeployS2I/images/WebUI_SourceRepository.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sborenst/OpenShiftEnterprise3_Demo/68733b4147374b80674d3f3e1907a17cebe4ce87/Snippet_DeployS2I/images/WebUI_SourceRepository.png -------------------------------------------------------------------------------- /Snippet_DeployTemplate_2tier/DemoSnippet.adoc: -------------------------------------------------------------------------------- 1 | = Deploy a two-tiered application from a template 2 | :scrollbar: 3 | :data-uri: 4 | :toc: macro 5 | 6 | 7 | toc::[] 8 | 9 | == Deploy a Two-Tiered Application From a Template (Web Console and Command Line) 10 | 11 | === Scenario 12 | 13 | In this scenario, David wants to deploy a two-tiered "Web-DB" application using a template. 14 | 15 | 16 | === Before you begin 17 | 18 | * Did you provision your environment and run the the Demo Deployment Script as 19 | described in 20 | link:Demonstration.Environment.Setup.adoc[Demonstration Environment Setup] page? 21 | * Do you know your environment's GUID? (This would appear in the provisioning 22 | email you would have received when you requested your environment) 23 | * If you already authenticated to openshift (*oc login* command) with a user 24 | (e.g 'david') you don't need to do it again every snippet and you can skip those 25 | instructions in the snippet. 26 | * Credentials for the 'root' user is available in the demonstration environment 27 | description in rhpds.redhat.com not in this document. 28 | * Did you read the _Legend_ and demonstration tips in the 29 | link:Additional.Information.adoc[additional information] page? 30 | 31 | * good luck, 32 | 33 | 34 | 35 | === Deploy Your Application Using the Web Console 36 | 37 | . *Action* - Browse to the OpenShift Enterprise web console: link:https://master00-GUID.oslab.opentlc.com:8443[https://master00-GUID.oslab.opentlc.com:8443]. 38 | + 39 | [NOTE] 40 | Remember that *GUID* in the URL refers to your Global Unique Identifier. 41 | 42 | . *Action* - Log in using the `david` account with password `R3dh4t1!` 43 | ** *Explain* - I am currently logging into the OpenShift Enterprise web console as the user `david`. 44 | ** *Point out* the following: 45 | *** You can create users locally or link to an enterprise directory. 46 | *** You can group users and create teams. 47 | *** You can use quotas to set resource limits on users, projects, and teams. 48 | + 49 | ==== 50 | You can see a preview here: link:images/WebUI_Login.png[WebUI Login Preview] 51 | ==== 52 | 53 | . *Action* - Select the `Instant Apps Demonstration` project. 54 | + 55 | ==== 56 | You can see a preview here: link:images/WebUI_SelectProject.png[WebUI Select Project Preview] 57 | ==== 58 | 59 | . *Action* - Click the *Create* button. 60 | + 61 | ==== 62 | You can see a preview here: link:images/WebUI_CreateButton.png[WebUI Create Button Preview] 63 | ==== 64 | . *Action* Click `demo-2tier-application`, in the list of templates. 65 | ** *Explain* that you are now creating a new application from a template that was loaded in the OpenShift Enterprise environment. 66 | ** *Point out* that this template was added only to this project and is not available for other projects, of course, you could add a template as "Public" and have it accessed by all users. 67 | . *Action* - Click the *Select Template* box. 68 | ** *Explain* that you need to review the images and edit the application attributes, such as labels and parameters. 69 | ** *Show* that you can set a label for the application to manage it by label. 70 | ** *Show* that parameters such as usernames and credentials are generated for each template, but you can also set them manually. 71 | + 72 | ==== 73 | You can see a preview here: link:images/WebUI_TemplateInformation.png[WebUI Template Information Preview] 74 | ==== 75 | . *Action* - Click *Create*. 76 | ** *Explain* what is about to happen: Builds are getting started and services are being created for the front end and back end. 77 | . *Optional* - Select *Browse* on the left side of the screen and show the *Builds*, *Services*, and *Pods* panes. 78 | 79 | . *Action* - After the build is complete, Open link:http://frontend.instantapps-demo.cloudapps-guid.oslab.opentlc.com/[http://frontend.instantapps-demo.cloudapps-guid.oslab.opentlc.com/] 80 | 81 | NOTE: You can finish the demonstration here, if you want to show the command line you can continue to the next section. 82 | 83 | == Review the template in the command line (Optional) 84 | 85 | === Log In and Authenticate 86 | 87 | . *Action* - Log in to your server and switch to the user `david`: 88 | + 89 | ---- 90 | 91 | [sborenst@desktop01 ~]$ ssh -i ~/.ssh/sborenstkey.pub shacharb-redhat.com@oselab-GUID.oslab.opentlc.com 92 | 93 | [bash-4.2$ ~] ssh root@192.168.0.100 94 | root@192.168.0.100's password: ******** (provided) 95 | 96 | [root@master00-GUID ~]# su - david 97 | 98 | ---- 99 | 100 | . *Action* - As user `david`, log in to OpenShift Enterprise and select the `instantapps-demo` project. 101 | + 102 | ** *Caution* - If you have _already logged in_ to OpenShift Enterprise, _do not_ run the `oc login` command again. You are already logged in, and this will result in an error on the screen. 103 | ** *Explain* that you are currently logging in to the master as part of this demonstration, but consider that every command that `david` issues is a command that the developer could do on his or her laptop or workstation, or from wherever he or she is working. 104 | ** *Explain* what projects are and how different projects could have different user permissions and quotas attached to them. 105 | + 106 | ---- 107 | 108 | [david@master00~]$ oc login -u david --insecure-skip-tls-verify --server=https://master00-${GUID}.oslab.opentlc.com:8443 109 | ---- 110 | . If you are not already using the *instantapps-demo* project, switch to it: 111 | + 112 | ---- 113 | [david@master00~]$ oc project instantapps-demo 114 | Using project "instantapps-demo" 115 | ---- 116 | 117 | 118 | === Review the Build Process 119 | 120 | . *Action* - Run the following commands to display the current process. 121 | + 122 | ** *Explain* the process the audience is seeing and the different resources that you created. 123 | ** *Point out* the following 124 | *** The `service` resource created for `frontend` and `backend` 125 | *** The `route` resource created for the `frontend` 126 | + 127 | ---- 128 | 129 | [david@master00~]$ oc get builds 130 | NAME TYPE STATUS POD 131 | ruby-sample-build-1 Source Complete ruby-sample-build-1-build 132 | ---- 133 | 134 | . *Action* Look at the build logs using the *oc build-logs* command 135 | + 136 | ---- 137 | [david@master00~]$ oc build-logs ruby-sample-build-1 138 | I0703 09:57:49.921355 1 sti.go:388] ---> Installing application source 139 | I0703 09:57:49.990848 1 sti.go:388] ---> Building your Ruby application from source 140 | I0703 09:57:49.990927 1 sti.go:388] ---> Running 'bundle install --deployment' 141 | I0703 09:57:56.212277 1 sti.go:388] Fetching gem metadata from https://rubygems.org/.......... 142 | I0703 09:58:00.672821 1 sti.go:388] Installing rake (10.3.2) 143 | I0703 09:58:02.017834 1 sti.go:388] Installing i18n (0.6.11) 144 | I0703 09:58:09.992863 1 sti.go:388] Installing json (1.8.1) 145 | 146 | ... 147 | ... 148 | I0703 09:58:57.122259 1 cfg.go:64] Using serviceaccount user for Docker authentication 149 | I0703 09:58:57.122318 1 sti.go:96] Using provided push secret for pushing 172.30.133.153:5000/instantapps/ruby-sample image 150 | I0703 09:58:57.122351 1 sti.go:99] Pushing 172.30.133.153:5000/instantapps/ruby-sample image ... 151 | I0703 10:02:01.730922 1 sti.go:103] Successfully pushed 172.30.133.153:5000/instantapps/ruby-sample 152 | 153 | ---- 154 | 155 | 156 | . *Explain* While we wait for the build to complete, we can create an alias for our application. 157 | * *Action* - Use the *oc expose* command to create another `route` for the our application. 158 | ** *Explain* that in this scenario, you decided to add another route to your application, so it is available under another URL. 159 | ** *Explain* that you are creating a route so that when a user resolves `myinstant.cloudapps-guid.oslab.opentlc.com`, you will "route" (actualy its more like "proxy") the user to one of the pods under the `frontend` service. 160 | + 161 | ---- 162 | [david@master00~]$ oc expose service frontend --name=myinst-route --hostname=myinst.cloudapps-$GUID.oslab.opentlc.com 163 | ---- 164 | 165 | . *Action* - Show the *routes* for the project using the *oc get routes* command 166 | + 167 | ---- 168 | [david@master00~]$ oc get routes 169 | NAME HOST/PORT PATH SERVICE LABELS 170 | example-route frontend.instantapps-demo.cloudapps-c3po.oslab.opentlc.com frontend template=application-template-stibuild 171 | myinst-route myinst.cloudapps-c3po.oslab.opentlc.com frontend template=application-template-stibuild 172 | 173 | 174 | ---- 175 | 176 | 177 | . *Show* that the pods were all created, 2 for the *frontend* and 1 *database* backend. 178 | + 179 | ---- 180 | [david@master00~]$ oc get pods 181 | NAME READY REASON RESTARTS AGE 182 | database-1-3vjjb 1/1 Running 0 5m 183 | frontend-1-akq23 1/1 Running 0 25s 184 | frontend-1-yiivo 1/1 Running 0 24s 185 | ruby-sample-build-1-build 0/1 ExitCode:0 0 5m 186 | 187 | ---- 188 | 189 | . *Show* that the Services were all created, 1 for the *frontend* and 1 *database* backend service. 190 | + 191 | ---- 192 | [david@master00~]$ oc get services 193 | NAME LABELS SELECTOR IP(S) PORT(S) 194 | database template=application-template-stibuild name=database 172.30.176.104 5434/TCP 195 | frontend template=application-template-stibuild name=frontend 172.30.149.55 5432/TCP 196 | ---- 197 | 198 | . *Show* that the two *deployments* have been created 199 | + 200 | ---- 201 | [david@master00~]$ oc get dc 202 | NAME TRIGGERS LATEST VERSION 203 | database ConfigChange 1 204 | frontend ConfigChange, ImageChange 1 205 | ---- 206 | 207 | === Complete the Command Line Demonstration 208 | 209 | . *Action* - Browse to: link:http://myinst.cloudapps-guid.oslab.opentlc.com[myinst.cloudapps-GUID.oslab.opentlc.com]. 210 | ** *Explain* what you did, and that this is a very common workflow for every development environment. 211 | ** *Point out* the following: 212 | *** You created a Ruby front end and a database backend. 213 | *** Using the template, both parts of the application environment can share values like usernames and passwords. 214 | *** You can randomize and generate values for each template. 215 | *** You created a route to direct to the front end service. 216 | 217 | == Scaling up the template (Optional) 218 | 219 | === Show how to increase the replicas of the deployed pods. 220 | 221 | . *Action* - Run the following command. 222 | .. *Explain* the role of the DC (`DeploymentConfig`) 223 | .. *Point Out:* 224 | - Triggers - What makes the DC redeploy the pods 225 | - Replicas - How many replicas are required of this pod - This is where we will make a permanent change to an environment 226 | 227 | ---- 228 | 229 | [david@master00 ~]$ oc describe dc frontend 230 | Name: frontend 231 | Created: 39 minutes ago 232 | Labels: template=application-template-stibuild 233 | Latest Version: 1 234 | Triggers: Image(ruby-sample@latest, auto=true), Config 235 | Strategy: Recreate 236 | Template: 237 | Selector: name=frontend 238 | Replicas: 2 239 | Containers: 240 | NAME IMAGE ENV 241 | ruby-helloworld 172.30.198.41:5000/instantapps-demo/ruby-sample@sha256:1ac706189796259481c5058d6c4540bbd7e3c08279a54960b049479882972250 ADMIN_PASSWORD=QMETygi6,ADMIN_USERNAME=admin8JL,MYSQL_DATABASE=root,MYSQL_PASSWORD=W0lQHFKY,MYSQL_USER=user8IV 242 | Deployment #1 (latest): 243 | Name: frontend-1 244 | Created: 35 minutes ago 245 | Status: Complete 246 | Replicas: 2 current / 2 desired 247 | Selector: deployment=frontend-1,deploymentconfig=frontend,name=frontend 248 | Labels: openshift.io/deployment-config.name=frontend,template=application-template-stibuild 249 | Pods Status: 2 Running / 0 Waiting / 0 Succeeded / 0 Failed 250 | No events. 251 | 252 | 253 | ---- 254 | 255 | 256 | . *Action* - Run the following command. 257 | .. *Action* - Use the *oc scale* command to increase the *replica* count of the deployment pods from 1 to 10. 258 | .. *Explain* By changing the DeploymentConfig we are raising the "desired state" of the replica count from 1 to 10, this will result in immediate change. 259 | .. *Note* How efficient OpenShift 3 is, the output of the *oc scale* command is the simple and concise *"scaled"* 260 | 261 | ---- 262 | 263 | [david@master00~]$ oc scale dc frontend --replicas=10 264 | scaled 265 | ---- 266 | 267 | . *Action* - Run the following commands to show the the new replicas that were created and that the service has updated with the new pods. 268 | .. *Explain* that new pods are created by the RC the next time it syncs with the desired state defined in the DC 269 | ...*Explain* The Service will be updated with the new pod names as they appear. 270 | 271 | ---- 272 | [david@master00~]$ oc get pods -w 273 | NAME READY REASON RESTARTS AGE 274 | database-1-35tpq 1/1 Running 0 41m 275 | frontend-1-0zri2 1/1 Running 0 25s 276 | frontend-1-5pmmc 0/1 Pending 0 25s 277 | frontend-1-b94xp 1/1 Running 0 26s 278 | frontend-1-e8cb4 1/1 Running 0 37m 279 | frontend-1-kumxt 1/1 Running 0 26s 280 | frontend-1-kvwgj 1/1 Running 0 37m 281 | frontend-1-rkc9h 0/1 Pending 0 25s 282 | frontend-1-umwjt 0/1 Pending 0 25s 283 | frontend-1-vc0jf 0/1 Pending 0 25s 284 | frontend-1-vhgam 1/1 Running 0 25s 285 | ruby-sample-build-1-build 0/1 ExitCode:0 0 40m 286 | 287 | ---- 288 | 289 | . *Action* Use the *oc describe* command to display the service. 290 | .. *Explain* That the service is automatically listing all the new pods that have the label: *"name=hello-openshift"* 291 | + 292 | ---- 293 | [david@master00~]$ oc describe service frontend 294 | Name: frontend 295 | Labels: template=application-template-stibuild 296 | Selector: name=frontend 297 | Type: ClusterIP 298 | IP: 172.30.182.104 299 | Port: web 5432/TCP 300 | Endpoints: 10.1.2.11:8080,10.1.2.12:8080,10.1.2.13:8080 + 7 more... 301 | Session Affinity: None 302 | No events. 303 | 304 | ---- 305 | 306 | . *Optional Action* - If you have a room full of syntax geeks you can show this example of getting the pods to display with their nodes and ips 307 | .. *Explain* that we can use edit the `template` of our output on the fly and call on different attributes in the object 308 | + 309 | ---- 310 | [david@master00-f4fc ~]$ oc get pod -t '{{range .items}}{{.metadata.name}}| {{.status.phase}} | {{.spec.host}} | {{.status.podIP}} {{"\n"}}{{end}}' 311 | 312 | database-1-35tpq| Running | node00-c3po.oslab.opentlc.com | 10.1.2.10 313 | frontend-1-0zri2| Running | node01-c3po.oslab.opentlc.com | 10.1.3.16 314 | frontend-1-5pmmc| Running | node00-c3po.oslab.opentlc.com | 10.1.2.15 315 | frontend-1-b94xp| Running | node01-c3po.oslab.opentlc.com | 10.1.3.15 316 | frontend-1-e8cb4| Running | node00-c3po.oslab.opentlc.com | 10.1.2.11 317 | frontend-1-kumxt| Running | node00-c3po.oslab.opentlc.com | 10.1.2.12 318 | frontend-1-kvwgj| Running | node01-c3po.oslab.opentlc.com | 10.1.3.14 319 | frontend-1-rkc9h| Running | node00-c3po.oslab.opentlc.com | 10.1.2.14 320 | frontend-1-umwjt| Running | node01-c3po.oslab.opentlc.com | 10.1.3.17 321 | frontend-1-vc0jf| Running | node01-c3po.oslab.opentlc.com | 10.1.3.18 322 | frontend-1-vhgam| Running | node00-c3po.oslab.opentlc.com | 10.1.2.13 323 | ruby-sample-build-1-build| Succeeded | node01-c3po.oslab.opentlc.com | 10.1.3.11 324 | 325 | 326 | ---- 327 | 328 | === Complete the Command Line Demonstration 329 | 330 | ** *Explain* what you did, and that this is a very common workflow for every development environment. 331 | ** *Point out* the following: 332 | - Using a Tempalte, we created two "deployments", one based on a MySQL image and another an, S2I build from our Git repository. 333 | - The Template created 2 services, "frontend" and "backend". 334 | - With a single command we can scale up our application within seconds. 335 | -------------------------------------------------------------------------------- /Snippet_DeployTemplate_2tier/InstantAppTempalte.json: -------------------------------------------------------------------------------- 1 | { 2 | "kind": "Template", 3 | "apiVersion": "v1", 4 | "metadata": { 5 | "name": "demo-2tier-application", 6 | "creationTimestamp": null, 7 | "annotations": { 8 | "description": "This is an demonstration of a Ruby and MySQL application on OpenShift 3", 9 | "iconClass": "icon-ruby", 10 | "tags": "instant-app,ruby,mysql" 11 | } 12 | }, 13 | "objects": [ 14 | { 15 | "kind": "Service", 16 | "apiVersion": "v1", 17 | "metadata": { 18 | "name": "frontend", 19 | "creationTimestamp": null 20 | }, 21 | "spec": { 22 | "ports": [ 23 | { 24 | "name": "web", 25 | "protocol": "TCP", 26 | "port": 5432, 27 | "targetPort": 8080, 28 | "nodePort": 0 29 | } 30 | ], 31 | "selector": { 32 | "name": "frontend" 33 | }, 34 | "portalIP": "", 35 | "type": "ClusterIP", 36 | "sessionAffinity": "None" 37 | }, 38 | "status": { 39 | "loadBalancer": {} 40 | } 41 | }, 42 | { 43 | "kind": "Route", 44 | "apiVersion": "v1", 45 | "metadata": { 46 | "name": "example-route", 47 | "creationTimestamp": null 48 | }, 49 | "spec": { 50 | "host": "template-demo.cloudapps-GUID.oslab.opentlc.com", 51 | "to": { 52 | "kind": "Service", 53 | "name": "frontend" 54 | } 55 | }, 56 | "spec": { 57 | "to": { 58 | "kind": "Service", 59 | "name": "frontend" 60 | } 61 | }, 62 | "status": {} 63 | }, 64 | { 65 | "kind": "ImageStream", 66 | "apiVersion": "v1", 67 | "metadata": { 68 | "name": "ruby-sample", 69 | "creationTimestamp": null 70 | }, 71 | "spec": {}, 72 | "status": { 73 | "dockerImageRepository": "" 74 | } 75 | }, 76 | { 77 | "kind": "ImageStream", 78 | "apiVersion": "v1", 79 | "metadata": { 80 | "name": "ruby-20-rhel7", 81 | "creationTimestamp": null 82 | }, 83 | "spec": { 84 | "dockerImageRepository": "registry.access.redhat.com/openshift3/ruby-20-rhel7" 85 | }, 86 | "status": { 87 | "dockerImageRepository": "" 88 | } 89 | }, 90 | { 91 | "kind": "BuildConfig", 92 | "apiVersion": "v1", 93 | "metadata": { 94 | "name": "ruby-sample-build", 95 | "creationTimestamp": null, 96 | "labels": { 97 | "name": "ruby-sample-build" 98 | } 99 | }, 100 | "spec": { 101 | "triggers": [ 102 | { 103 | "type": "github", 104 | "github": { 105 | "secret": "secret101" 106 | } 107 | }, 108 | { 109 | "type": "generic", 110 | "generic": { 111 | "secret": "secret101" 112 | } 113 | }, 114 | { 115 | "type": "imageChange", 116 | "imageChange": {} 117 | } 118 | ], 119 | "source": { 120 | "type": "Git", 121 | "git": { 122 | "uri": "git://github.com/openshift/ruby-hello-world.git", 123 | "ref": "master" 124 | } 125 | }, 126 | "strategy": { 127 | "type": "Source", 128 | "sourceStrategy": { 129 | "from": { 130 | "kind": "ImageStreamTag", 131 | "name": "ruby:latest", 132 | "namespace": "openshift" 133 | }, 134 | "incremental": true 135 | } 136 | }, 137 | "output": { 138 | "to": { 139 | "kind": "ImageStreamTag", 140 | "name": "ruby-sample:latest" 141 | } 142 | }, 143 | "resources": {} 144 | }, 145 | "status": { 146 | "lastVersion": 0 147 | } 148 | }, 149 | { 150 | "kind": "DeploymentConfig", 151 | "apiVersion": "v1", 152 | "metadata": { 153 | "name": "frontend", 154 | "creationTimestamp": null 155 | }, 156 | "spec": { 157 | "strategy": { 158 | "type": "Recreate" 159 | }, 160 | "triggers": [ 161 | { 162 | "type": "ImageChange", 163 | "imageChangeParams": { 164 | "automatic": true, 165 | "containerNames": [ 166 | "ruby-helloworld" 167 | ], 168 | "from": { 169 | "kind": "ImageStreamTag", 170 | "name": "ruby-sample:latest" 171 | }, 172 | "lastTriggeredImage": "" 173 | } 174 | }, 175 | { 176 | "type": "ConfigChange" 177 | } 178 | ], 179 | "replicas": 2, 180 | "selector": { 181 | "name": "frontend" 182 | }, 183 | "template": { 184 | "metadata": { 185 | "creationTimestamp": null, 186 | "labels": { 187 | "name": "frontend" 188 | } 189 | }, 190 | "nodeSelector": { 191 | "region": "primary" 192 | }, 193 | "spec": { 194 | "containers": [ 195 | { 196 | "name": "ruby-helloworld", 197 | "image": "ruby-sample", 198 | "ports": [ 199 | { 200 | "containerPort": 8080, 201 | "protocol": "TCP" 202 | } 203 | ], 204 | "env": [ 205 | { 206 | "name": "ADMIN_USERNAME", 207 | "value": "${ADMIN_USERNAME}" 208 | }, 209 | { 210 | "name": "ADMIN_PASSWORD", 211 | "value": "${ADMIN_PASSWORD}" 212 | }, 213 | { 214 | "name": "MYSQL_USER", 215 | "value": "${MYSQL_USER}" 216 | }, 217 | { 218 | "name": "MYSQL_PASSWORD", 219 | "value": "${MYSQL_PASSWORD}" 220 | }, 221 | { 222 | "name": "MYSQL_DATABASE", 223 | "value": "${MYSQL_DATABASE}" 224 | } 225 | ], 226 | "resources": {}, 227 | "terminationMessagePath": "/dev/termination-log", 228 | "imagePullPolicy": "IfNotPresent", 229 | "capabilities": {}, 230 | "securityContext": { 231 | "capabilities": {}, 232 | "privileged": false 233 | } 234 | } 235 | ], 236 | "restartPolicy": "Always", 237 | "dnsPolicy": "ClusterFirst", 238 | "serviceAccount": "" 239 | } 240 | } 241 | }, 242 | "status": {} 243 | }, 244 | { 245 | "kind": "Service", 246 | "apiVersion": "v1", 247 | "metadata": { 248 | "name": "database", 249 | "creationTimestamp": null 250 | }, 251 | "spec": { 252 | "ports": [ 253 | { 254 | "name": "db", 255 | "protocol": "TCP", 256 | "port": 5434, 257 | "targetPort": 3306, 258 | "nodePort": 0 259 | } 260 | ], 261 | "selector": { 262 | "name": "database" 263 | }, 264 | "portalIP": "", 265 | "type": "ClusterIP", 266 | "sessionAffinity": "None" 267 | }, 268 | "status": { 269 | "loadBalancer": {} 270 | } 271 | }, 272 | { 273 | "kind": "DeploymentConfig", 274 | "apiVersion": "v1", 275 | "metadata": { 276 | "name": "database", 277 | "creationTimestamp": null 278 | }, 279 | "spec": { 280 | "strategy": { 281 | "type": "Recreate" 282 | }, 283 | "triggers": [ 284 | { 285 | "type": "ConfigChange" 286 | } 287 | ], 288 | "replicas": 1, 289 | "selector": { 290 | "name": "database" 291 | }, 292 | "template": { 293 | "metadata": { 294 | "creationTimestamp": null, 295 | "labels": { 296 | "name": "database" 297 | } 298 | }, 299 | "nodeSelector": { 300 | "region": "primary" 301 | }, 302 | "spec": { 303 | "containers": [ 304 | { 305 | "name": "ruby-helloworld-database", 306 | "image": "registry.access.redhat.com/openshift3/mysql-55-rhel7:latest", 307 | "ports": [ 308 | { 309 | "containerPort": 3306, 310 | "protocol": "TCP" 311 | } 312 | ], 313 | "env": [ 314 | { 315 | "name": "MYSQL_USER", 316 | "value": "${MYSQL_USER}" 317 | }, 318 | { 319 | "name": "MYSQL_PASSWORD", 320 | "value": "${MYSQL_PASSWORD}" 321 | }, 322 | { 323 | "name": "MYSQL_DATABASE", 324 | "value": "${MYSQL_DATABASE}" 325 | } 326 | ], 327 | "resources": {}, 328 | "terminationMessagePath": "/dev/termination-log", 329 | "imagePullPolicy": "Always", 330 | "capabilities": {}, 331 | "securityContext": { 332 | "capabilities": {}, 333 | "privileged": false 334 | } 335 | } 336 | ], 337 | "restartPolicy": "Always", 338 | "dnsPolicy": "ClusterFirst", 339 | "serviceAccount": "" 340 | } 341 | } 342 | }, 343 | "status": {} 344 | } 345 | ], 346 | "parameters": [ 347 | { 348 | "name": "ADMIN_USERNAME", 349 | "description": "administrator username", 350 | "generate": "expression", 351 | "from": "admin[A-Z0-9]{3}" 352 | }, 353 | { 354 | "name": "ADMIN_PASSWORD", 355 | "description": "administrator password", 356 | "generate": "expression", 357 | "from": "[a-zA-Z0-9]{8}" 358 | }, 359 | { 360 | "name": "MYSQL_USER", 361 | "description": "database username", 362 | "generate": "expression", 363 | "from": "user[A-Z0-9]{3}" 364 | }, 365 | { 366 | "name": "MYSQL_PASSWORD", 367 | "description": "database password", 368 | "generate": "expression", 369 | "from": "[a-zA-Z0-9]{8}" 370 | }, 371 | { 372 | "name": "MYSQL_DATABASE", 373 | "description": "database name", 374 | "value": "root" 375 | } 376 | ], 377 | "labels": { 378 | "template": "application-template-stibuild" 379 | } 380 | } 381 | -------------------------------------------------------------------------------- /Snippet_DeployTemplate_2tier/InstantAppTempalte_old.json: -------------------------------------------------------------------------------- 1 | { 2 | "kind": "Template", 3 | "apiVersion": "v1", 4 | "metadata": { 5 | "name": "instantapp-2tier-application", 6 | "creationTimestamp": null, 7 | "annotations": { 8 | "description": "This is an demonstration of a Ruby and MySQL application on OpenShift 3", 9 | "iconClass": "icon-ruby", 10 | "tags": "instant-app,ruby,mysql" 11 | } 12 | }, 13 | "objects": [ 14 | { 15 | "kind": "Service", 16 | "apiVersion": "v1", 17 | "metadata": { 18 | "name": "frontend", 19 | "creationTimestamp": null 20 | }, 21 | "spec": { 22 | "ports": [ 23 | { 24 | "name": "web", 25 | "protocol": "TCP", 26 | "port": 5432, 27 | "targetPort": 8080, 28 | "nodePort": 0 29 | } 30 | ], 31 | "selector": { 32 | "name": "frontend" 33 | }, 34 | "portalIP": "", 35 | "type": "ClusterIP", 36 | "sessionAffinity": "None" 37 | }, 38 | "status": { 39 | "loadBalancer": {} 40 | } 41 | }, 42 | { 43 | "kind": "Route", 44 | "apiVersion": "v1", 45 | "metadata": { 46 | "name": "route-edge", 47 | "creationTimestamp": null 48 | }, 49 | "spec": { 50 | "host": "instantapp-demo.cloudapps-GUID.oslab.opentlc.com", 51 | "to": { 52 | "kind": "Service", 53 | "name": "frontend" 54 | } 55 | }, 56 | "status": {} 57 | }, 58 | { 59 | "kind": "ImageStream", 60 | "apiVersion": "v1", 61 | "metadata": { 62 | "name": "ruby-sample", 63 | "creationTimestamp": null 64 | }, 65 | "spec": {}, 66 | "status": { 67 | "dockerImageRepository": "" 68 | } 69 | }, 70 | { 71 | "kind": "ImageStream", 72 | "apiVersion": "v1", 73 | "metadata": { 74 | "name": "ruby-20-rhel7", 75 | "creationTimestamp": null 76 | }, 77 | "spec": { 78 | "dockerImageRepository": "registry.access.redhat.com/openshift3/ruby-20-rhel7" 79 | }, 80 | "status": { 81 | "dockerImageRepository": "" 82 | } 83 | }, 84 | { 85 | "kind": "BuildConfig", 86 | "apiVersion": "v1", 87 | "metadata": { 88 | "name": "ruby-sample-build", 89 | "creationTimestamp": null, 90 | "labels": { 91 | "name": "ruby-sample-build" 92 | } 93 | }, 94 | "spec": { 95 | "triggers": [ 96 | { 97 | "type": "github", 98 | "github": { 99 | "secret": "secret101" 100 | } 101 | }, 102 | { 103 | "type": "generic", 104 | "generic": { 105 | "secret": "secret101" 106 | } 107 | }, 108 | { 109 | "type": "imageChange", 110 | "imageChange": {} 111 | } 112 | ], 113 | "source": { 114 | "type": "Git", 115 | "git": { 116 | "uri": "git://github.com/openshift/ruby-hello-world.git", 117 | "ref": "beta4" 118 | } 119 | }, 120 | "strategy": { 121 | "type": "Source", 122 | "sourceStrategy": { 123 | "from": { 124 | "kind": "ImageStreamTag", 125 | "name": "ruby:latest", 126 | "namespace": "openshift" 127 | }, 128 | "incremental": true 129 | } 130 | }, 131 | "output": { 132 | "to": { 133 | "kind": "ImageStreamTag", 134 | "name": "ruby-sample:latest" 135 | } 136 | }, 137 | "resources": {} 138 | }, 139 | "status": { 140 | "lastVersion": 141 | } 142 | { 143 | "image": "openshift/ruby-20-rhel7", 144 | "tag": "latest" 145 | }, 146 | "type": "imageChange" 147 | } 148 | ] 149 | }, 150 | { 151 | "kind": "DeploymentConfig", 152 | "apiVersion": "v1", 153 | "metadata": { 154 | "name": "frontend", 155 | "creationTimestamp": null 156 | }, 157 | "spec": { 158 | "strategy": { 159 | "type": "Recreate" 160 | }, 161 | "triggers": [ 162 | { 163 | "type": "ImageChange", 164 | "imageChangeParams": { 165 | "automatic": true, 166 | "containerNames": [ 167 | "ruby-helloworld" 168 | ], 169 | "from": { 170 | "kind": "ImageStreamTag", 171 | "name": "ruby-sample:latest" 172 | }, 173 | "lastTriggeredImage": "" 174 | } 175 | }, 176 | { 177 | "type": "ConfigChange" 178 | } 179 | ], 180 | "replicas": 2, 181 | "selector": { 182 | "name": "frontend" 183 | }, 184 | "template": { 185 | "metadata": { 186 | "creationTimestamp": null, 187 | "labels": { 188 | "name": "frontend" 189 | } 190 | }, 191 | "nodeSelector": { 192 | "region": "primary" 193 | }, 194 | "spec": { 195 | "containers": [ 196 | { 197 | "name": "ruby-helloworld", 198 | "image": "ruby-sample", 199 | "ports": [ 200 | { 201 | "containerPort": 8080, 202 | "protocol": "TCP" 203 | } 204 | ], 205 | "env": [ 206 | { 207 | "name": "ADMIN_USERNAME", 208 | "value": "${ADMIN_USERNAME}" 209 | }, 210 | { 211 | "name": "ADMIN_PASSWORD", 212 | "value": "${ADMIN_PASSWORD}" 213 | }, 214 | { 215 | "name": "MYSQL_USER", 216 | "value": "${MYSQL_USER}" 217 | }, 218 | { 219 | "name": "MYSQL_PASSWORD", 220 | "value": "${MYSQL_PASSWORD}" 221 | }, 222 | { 223 | "name": "MYSQL_DATABASE", 224 | "value": "${MYSQL_DATABASE}" 225 | } 226 | ], 227 | "resources": {}, 228 | "terminationMessagePath": "/dev/termination-log", 229 | "imagePullPolicy": "IfNotPresent", 230 | "capabilities": {}, 231 | "securityContext": { 232 | "capabilities": {}, 233 | "privileged": false 234 | } 235 | } 236 | ], 237 | "restartPolicy": "Always", 238 | "dnsPolicy": "ClusterFirst", 239 | "serviceAccount": "" 240 | } 241 | } 242 | }, 243 | "status": {}, 244 | "triggers": [ 245 | { 246 | "imageChangeParams": { 247 | "automatic": true, 248 | "containerNames": [ 249 | "ruby-helloworld" 250 | ], 251 | "from": { 252 | "name": "origin-ruby-sample" 253 | }, 254 | "tag": "Latest" 255 | }, 256 | "type": "ImageChange" 257 | } 258 | ] 259 | }, 260 | { 261 | "kind": "Service", 262 | "apiVersion": "v1", 263 | "metadata": { 264 | "name": "database", 265 | "creationTimestamp": null 266 | }, 267 | "spec": { 268 | "ports": [ 269 | { 270 | "name": "db", 271 | "protocol": "TCP", 272 | "port": 5434, 273 | "targetPort": 3306, 274 | "nodePort": 0 275 | } 276 | ], 277 | "selector": { 278 | "name": "database" 279 | }, 280 | "portalIP": "", 281 | "type": "ClusterIP", 282 | "sessionAffinity": "None" 283 | }, 284 | "status": { 285 | "loadBalancer": {} 286 | } 287 | }, 288 | { 289 | "kind": "DeploymentConfig", 290 | "apiVersion": "v1", 291 | "metadata": { 292 | "name": "database", 293 | "creationTimestamp": null 294 | }, 295 | "spec": { 296 | "strategy": { 297 | "type": "Recreate" 298 | }, 299 | "triggers": [ 300 | { 301 | "type": "ConfigChange" 302 | } 303 | ], 304 | "replicas": 1, 305 | "selector": { 306 | "name": "database" 307 | }, 308 | "template": { 309 | "metadata": { 310 | "creationTimestamp": null, 311 | "labels": { 312 | "name": "database" 313 | } 314 | }, 315 | "nodeSelector": { 316 | "region": "primary" 317 | }, 318 | "spec": { 319 | "containers": [ 320 | { 321 | "name": "ruby-helloworld-database", 322 | "image": "registry.access.redhat.com/openshift3_beta/mysql-55-rhel7:latest", 323 | "ports": [ 324 | { 325 | "containerPort": 3306, 326 | "protocol": "TCP" 327 | } 328 | ], 329 | "env": [ 330 | { 331 | "name": "MYSQL_USER", 332 | "value": "${MYSQL_USER}" 333 | }, 334 | { 335 | "name": "MYSQL_PASSWORD", 336 | "value": "${MYSQL_PASSWORD}" 337 | }, 338 | { 339 | "name": "MYSQL_DATABASE", 340 | "value": "${MYSQL_DATABASE}" 341 | } 342 | ], 343 | "resources": {}, 344 | "terminationMessagePath": "/dev/termination-log", 345 | "imagePullPolicy": "Always", 346 | "capabilities": {}, 347 | "securityContext": { 348 | "capabilities": {}, 349 | "privileged": false 350 | } 351 | } 352 | ], 353 | "restartPolicy": "Always", 354 | "dnsPolicy": "ClusterFirst", 355 | "serviceAccount": "" 356 | } 357 | } 358 | }, 359 | "status": {} 360 | } 361 | ], 362 | "parameters": [ 363 | { 364 | "name": "ADMIN_USERNAME", 365 | "description": "administrator username", 366 | "generate": "expression", 367 | "from": "admin[A-Z0-9]{3}" 368 | }, 369 | { 370 | "name": "ADMIN_PASSWORD", 371 | "description": "administrator password", 372 | "generate": "expression", 373 | "from": "[a-zA-Z0-9]{8}" 374 | }, 375 | { 376 | "name": "MYSQL_USER", 377 | "description": "database username", 378 | "generate": "expression", 379 | "from": "user[A-Z0-9]{3}" 380 | }, 381 | { 382 | "name": "MYSQL_PASSWORD", 383 | "description": "database password", 384 | "generate": "expression", 385 | "from": "[a-zA-Z0-9]{8}" 386 | }, 387 | { 388 | "name": "MYSQL_DATABASE", 389 | "description": "database name", 390 | "value": "root" 391 | } 392 | ], 393 | "labels": { 394 | "template": "application-template-stibuild" 395 | } 396 | } 397 | -------------------------------------------------------------------------------- /Snippet_DeployTemplate_2tier/images/DemoSnippet.adoc: -------------------------------------------------------------------------------- 1 | = Deploy a two-tiered application from a template 2 | :scrollbar: 3 | :data-uri: 4 | :toc: macro 5 | 6 | 7 | toc::[] 8 | 9 | == Deploy a Two-Tiered Application From a Template (Web Console and Command Line) 10 | 11 | === Scenario 12 | 13 | In this scenario, David wants to deploy a two-tiered `Web-DB` application using an `Instant Apps` template. 14 | 15 | 16 | === Before you begin 17 | 18 | * Did you provision your environment and run the the Demo Deployment Script as 19 | described in 20 | link:Demonstration.Environment.Setup.adoc[Demonstration Environment Setup] page? 21 | * Do you know your environment's GUID? (This would appear in the provisioning 22 | email you would have received when you requested your environment) 23 | * If you already authenticated to openshift (*oc login* command) with a user 24 | (e.g 'david') you don't need to do it again every snippet and you can skip those 25 | instructions in the snippet. 26 | * Credentials for the 'root' user is available in the demonstration environment 27 | description in rhpds.redhat.com not in this document. 28 | * Did you read the _Legend_ and demonstration tips in the 29 | link:Additional.Information.adoc[additional information] page? 30 | 31 | * good luck, 32 | 33 | 34 | 35 | === Deploy Your Application Using the Web Console 36 | 37 | . *Action* - Browse to the OpenShift Enterprise web console: link:https://master00-GUID.oslab.opentlc.com:8443[https://master00-GUID.oslab.opentlc.com:8443]. 38 | + 39 | [NOTE] 40 | Remember that *GUID* in the URL refers to your Global Unique Identifier. 41 | 42 | . *Action* - Log in using the `david` account with password `R3dh4t1!` 43 | ** *Explain* - I am currently logging into the OpenShift Enterprise web console as the user `david`. 44 | ** *Point out* the following: 45 | *** You can create users locally or link to an enterprise directory. 46 | *** You can group users and create teams. 47 | *** You can use quotas to set resource limits on users, projects, and teams. 48 | + 49 | ==== 50 | You can see a preview here: link:images/WebUI_Login.png[WebUI Login Preview] 51 | ==== 52 | 53 | . *Action* - Select the `Instant Apps Demonstration` project. 54 | + 55 | ==== 56 | You can see a preview here: link:images/WebUI_SelectProject.png[WebUI Select Project Preview] 57 | ==== 58 | 59 | . *Action* - Click the *Create* button. 60 | + 61 | ==== 62 | You can see a preview here: link:images/WebUI_CreateButton.png[WebUI Create Button Preview] 63 | ==== 64 | . *Action* Click `instantapp-2tier-application`. 65 | ** *Explain* that you are now creating a new application from a template that was loaded in the OpenShift Enterprise environment. 66 | 67 | . *Action* - Click the *Select Template* box. 68 | ** *Explain* that you need to review the images and edit the application attributes, such as labels and parameters. 69 | ** *Show* that you can set a label for the application to manage it by label. 70 | ** *Show* that parameters such as usernames and credentials are generated for each template, but you can also set them manually. 71 | 72 | . *Action* - Click *Create*. 73 | ** *Explain* what is about to happen: Builds are getting started and services are being created for the front end and back end. 74 | . *Optional* - Select *Browse* on the left side of the screen and show the *Builds*, *Services*, and *Pods* panes. 75 | 76 | === Log In and Authenticate 77 | 78 | . *Action* - Log in to your server and switch to the user `david`: 79 | + 80 | ---- 81 | 82 | [sborenst@desktop01 ~]$ ssh -i ~/.ssh/sborenstkey.pub shacharb-redhat.com@oselab-GUID.oslab.opentlc.com 83 | 84 | [bash-4.2$ ~] ssh root@192.168.0.100 85 | root@192.168.0.100's password: ******** (provided) 86 | 87 | [root@master00-GUID ~]# su - david 88 | 89 | ---- 90 | 91 | . *Action:* - As user `david`, log in to OpenShift Enterprise and select the `instantapps-demo` project. 92 | + 93 | ** *Caution* - If you have _already logged in_ to OpenShift Enterprise, _do not_ run the `oc login` command again. You are already logged in, and this will result in an error on the screen. 94 | ** *Explain* that you are currently logging in to the master as part of this demonstration, but consider that every command that `david` issues is a command that the developer could do on his or her laptop or workstation, or from wherever he or she is working. 95 | ** *Explain* what projects are and how different projects could have different user permissions and quotas attached to them. 96 | + 97 | ---- 98 | 99 | [david@master00~]$ oc login -u david --insecure-skip-tls-verify --server=https://master00-${GUID}.oslab.opentlc.com:8443 100 | ---- 101 | . If you are not already using the *instantapps-demo* project, switch to it: 102 | + 103 | ---- 104 | 105 | [david@master00~]$ oc project instantapps-demo 106 | Using project "instantapps-demo" 107 | 108 | ---- 109 | 110 | 111 | === Review the Build Process 112 | 113 | . *Action* - Run the following commands to display the current process. 114 | + 115 | ** *Explain* the process the audience is seeing and the different resources that you created. 116 | ** *Point out* the following 117 | *** The `service` resource created for `frontend` and `backend` 118 | *** The `route` resource created for the `frontend` 119 | + 120 | ---- 121 | 122 | [david@master00~]$ oc get builds 123 | NAME TYPE STATUS POD 124 | ruby-sample-build-1 Source Complete ruby-sample-build-1-build 125 | ---- 126 | 127 | . *Action* Look at the build logs using the *oc build-logs* command 128 | + 129 | ---- 130 | [david@master00~]$ oc build-logs ruby-sample-build-1 131 | I0703 09:57:49.921355 1 sti.go:388] ---> Installing application source 132 | I0703 09:57:49.990848 1 sti.go:388] ---> Building your Ruby application from source 133 | I0703 09:57:49.990927 1 sti.go:388] ---> Running 'bundle install --deployment' 134 | I0703 09:57:56.212277 1 sti.go:388] Fetching gem metadata from https://rubygems.org/.......... 135 | I0703 09:58:00.672821 1 sti.go:388] Installing rake (10.3.2) 136 | I0703 09:58:02.017834 1 sti.go:388] Installing i18n (0.6.11) 137 | I0703 09:58:09.992863 1 sti.go:388] Installing json (1.8.1) 138 | 139 | ... 140 | ... 141 | I0703 09:58:57.122259 1 cfg.go:64] Using serviceaccount user for Docker authentication 142 | I0703 09:58:57.122318 1 sti.go:96] Using provided push secret for pushing 172.30.133.153:5000/instantapps/ruby-sample image 143 | I0703 09:58:57.122351 1 sti.go:99] Pushing 172.30.133.153:5000/instantapps/ruby-sample image ... 144 | I0703 10:02:01.730922 1 sti.go:103] Successfully pushed 172.30.133.153:5000/instantapps/ruby-sample 145 | 146 | ---- 147 | 148 | 149 | 150 | . *Action* While you wait for the build to complete, expose the *service* and create the route for the application. 151 | * *CAUTION* Don't skip this step!, if you don't *expose* the service, the application will *NOT be accessible from the outside* world. 152 | ** *Explain* that in this scenario, you decided to add another route to your application, so it is available under another URL. 153 | ** *Explain* that you are creating a route so that when a user resolves `myinstant.cloudapps-$GUID.oslab.opentlc.com`, you will "route" (actualy its more like "proxy") the user to one of the pods under the `frontend` service. 154 | + 155 | ---- 156 | [david@master00~]$ oc expose service frontend --name=myinst-route --hostname=myinst.cloudapps-$GUID.oslab.opentlc.com 157 | ---- 158 | 159 | 160 | 161 | . *Show* that the pods were all created, 2 for the *frontend* and 1 *database* backend. 162 | + 163 | ---- 164 | [david@master00~]$ oc get pods 165 | NAME READY REASON RESTARTS AGE 166 | database-1-3vjjb 1/1 Running 0 5m 167 | frontend-1-akq23 1/1 Running 0 25s 168 | frontend-1-yiivo 1/1 Running 0 24s 169 | ruby-sample-build-1-build 0/1 ExitCode:0 0 5m 170 | 171 | ---- 172 | 173 | . *Show* that the Services were all created, 1 for the *frontend* and 1 *database* backend service. 174 | + 175 | ---- 176 | [david@master00~]$ oc get services 177 | NAME LABELS SELECTOR IP(S) PORT(S) 178 | database template=application-template-stibuild name=database 172.30.176.104 5434/TCP 179 | frontend template=application-template-stibuild name=frontend 172.30.149.55 5432/TCP 180 | ---- 181 | 182 | 183 | 184 | === Complete the Demonstration 185 | 186 | . *Action* - Browse to: link:http://instantapp-demo.cloudapps-$GUID.oslab.opentlc.com[instantapp.cloudapps-$GUID.oslab.opentlc.com]. 187 | ** *Explain* what you did, and that this is a very common workflow for every development environment. 188 | ** *Point out* the following: 189 | *** You created a Ruby front end and a database backend. 190 | *** Using the template, both parts of the application environment can share values like usernames and passwords. 191 | *** You can randomize and generate values for each template. 192 | *** You created a route to direct to the front end service. 193 | -------------------------------------------------------------------------------- /Snippet_DeployTemplate_2tier/images/WebUI_CreateButton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sborenst/OpenShiftEnterprise3_Demo/68733b4147374b80674d3f3e1907a17cebe4ce87/Snippet_DeployTemplate_2tier/images/WebUI_CreateButton.png -------------------------------------------------------------------------------- /Snippet_DeployTemplate_2tier/images/WebUI_Login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sborenst/OpenShiftEnterprise3_Demo/68733b4147374b80674d3f3e1907a17cebe4ce87/Snippet_DeployTemplate_2tier/images/WebUI_Login.png -------------------------------------------------------------------------------- /Snippet_DeployTemplate_2tier/images/WebUI_SelectProject.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sborenst/OpenShiftEnterprise3_Demo/68733b4147374b80674d3f3e1907a17cebe4ce87/Snippet_DeployTemplate_2tier/images/WebUI_SelectProject.png -------------------------------------------------------------------------------- /Snippet_DeployTemplate_2tier/images/WebUI_TemplateInformation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sborenst/OpenShiftEnterprise3_Demo/68733b4147374b80674d3f3e1907a17cebe4ce87/Snippet_DeployTemplate_2tier/images/WebUI_TemplateInformation.png --------------------------------------------------------------------------------