├── .gitignore ├── .gitmodules ├── 0-Setting-up-client-tools.adoc ├── 0_toc.adoc ├── 1-Create-App-From-a-Docker-Image.adoc ├── 10-SCM-Web-Hooks.adoc ├── 11-Rollback-Applications.adoc ├── 12-Code-Promotion-Across-Environments.adoc ├── 13-Using-Persistent-Storage.adoc ├── 14-Using-a-Custom-S2I-Image.adoc ├── 15-Adding-Custom-S2I-Image-to-the-Project-Catalog.adoc ├── 16-Using-ConfigMap-to-Inject-Application-Configuration.adoc ├── 17-Dynamic-Configuration-Updates-using-ConfigMap.adoc ├── 18-Changing-code-on-the-fly.adoc ├── 19-Creating-a-Pipeline.adoc ├── 2-Create-App-Using-Docker-Build.adoc ├── 3-Using-Web-Console.adoc ├── 4-Creating-an-application-using-JBoss-EAP-builder-image.adoc ├── 5-Using-templates.adoc ├── 6-Scale-up-and-Scale-down-the-application-instances.adoc ├── 7-Binary-Deployment-of-a-war-file.adoc ├── 8-Using-SSL-In-your-Application.adoc ├── 9-Blue-Green-Deployments.adoc ├── Dockerfile ├── README.adoc ├── images ├── OpenShiftContainerPlatform_Logo.jpeg ├── OpenShift_Logo_Small.png ├── add-project.png ├── application_create_screen.jpeg ├── application_create_screen.png ├── bg-5050-split.png ├── bg-edit-route.png ├── bg-route-split-overview.png ├── bg-routes-page.png ├── bg-slipt-traffic.png ├── blue.png ├── blue_app.jpg ├── blue_app.png ├── blue_deployment.jpeg ├── blue_deployment.tiff ├── blue_green_active_green.png ├── blue_green_deployment.png ├── browse-catalog.png ├── build-menu.png ├── cakephp_confirm.jpeg ├── cakephp_confirm.png ├── cakephp_template.jpeg ├── cakephp_template.png ├── code_promotion_env.png ├── console_project_overview.jpeg ├── console_project_overview.png ├── create-route.png ├── create-storage.png ├── dbtest_build.png ├── dbtest_deployment_env.png ├── dbtest_service.jpeg ├── dbtest_service.png ├── dc_edit.jpg ├── dc_edit_raw.jpg ├── deploy-config.png ├── deploy-image.png ├── disable-triggers1.png ├── disable-triggers2.png ├── dockerfile-template.png ├── dotnet_mysql_create.png ├── dotnet_mysql_final.png ├── dotnet_mysql_route.png ├── dotnet_mysql_template.png ├── edit.png ├── empty_project_details.jpeg ├── empty_project_details.tiff ├── expand.png ├── github_add_webhook.jpg ├── github_add_webhook.png ├── github_show_url.jpg ├── github_show_url.png ├── green_app.jpg ├── green_app.png ├── green_deployment.png ├── idled_pods.jpeg ├── image-details.png ├── jboss_install8.jpg ├── jboss_install_1.png ├── jboss_install_10.jpg ├── jboss_install_11.jpg ├── jboss_install_12.jpg ├── jboss_install_13.jpg ├── jboss_install_2.png ├── jboss_install_3.png ├── jboss_install_4.png ├── jboss_install_5.png ├── jboss_install_6.jpg ├── jboss_install_6.png ├── jboss_install_6a.jpg ├── jboss_install_7.jpg ├── jboss_install_9.jpg ├── jboss_wizard_configuration.png ├── jboss_wizard_configuration2.png ├── ks-myjbossapp.jpg ├── ks-myjbossapp.png ├── list-uploaded-files.png ├── login.jpeg ├── login.png ├── mysql.png ├── mysql_deploymentconfig.png ├── mysql_ephemeral_creation.jpeg ├── mysql_ephemeral_creation.png ├── mysql_ephemeral_template.jpeg ├── mysql_ephemeral_template.png ├── mysql_pod_on_proj_details.jpeg ├── mysql_pod_on_proj_details.png ├── mysql_pod_on_proj_details.tiff ├── mysql_pod_on_proj_overview.jpeg ├── mysql_pod_on_proj_overview.png ├── mysql_secret_binding.png ├── mysql_service.jpeg ├── mysql_service.png ├── new-project-details.png ├── new-project.png ├── nexus_repo.png ├── overview.png ├── petstore binary deployment.jpeg ├── php-catalog.png ├── php.png ├── pipeine3.jpeg ├── pipeline1.jpeg ├── pipeline2.jpeg ├── pipeline3.jpeg ├── project_browse.jpeg ├── project_build_configuration.png ├── project_build_details.jpeg ├── project_build_details.png ├── project_details.jpeg ├── project_details.png ├── project_details.tiff ├── project_pod_details.jpg ├── project_pod_details.png ├── project_pods.jpg ├── project_pods.png ├── projects_list.jpeg ├── projects_list.png ├── return_to_proj_list.jpeg ├── scale_down.jpg ├── scale_up.jpg ├── scale_updown_overview.jpg ├── scale_updown_overview.png ├── scale_updown_overview_scaled.jpg ├── scale_updown_overview_scaled.png ├── search-jenkins.png ├── search.png ├── service_catalog.png ├── service_catalog2.png ├── storage-overview.png ├── template-add-to-project.png ├── terminal_view.jpg ├── terminal_view.png ├── topology_button.jpg ├── topology_details.jpg ├── topology_view.jpg ├── upload-app.png ├── version.png └── welcome.png ├── openshift ├── httpd.conf ├── run └── s2i │ └── bin │ ├── assemble │ └── run └── resources ├── 13_Using_JBoss_Development_Studio.adoc └── NUMBER_title_of_lab_with_underscores.adoc /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | images/.DS_Store 3 | labs-html 4 | labs-html/* 5 | labs-html.zip 6 | instructions/generated_content 7 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "instructions/config"] 2 | path = instructions/config 3 | url = git@github.com:redhat-gpe/OPEN_common_hyla.git 4 | -------------------------------------------------------------------------------- /0-Setting-up-client-tools.adoc: -------------------------------------------------------------------------------- 1 | [[setting-up-client-tools]] 2 | Setting up client tools 3 | ~~~~~~~~~~~~~~~~~~~~~~~ 4 | 5 | In this Lab we will look at how to install the OpenShift CLI tools. 6 | 7 | *Installing the Command-line Tools* 8 | 9 | After completing this section, you should be able to: 10 | 11 | * Locate the binaries for the OpenShift Container Platform command-line 12 | interface (OCP CLI) 13 | * Install the OCP CLI tools. 14 | * CLI basic configuration 15 | 16 | *Locating the binaries* 17 | 18 | The OCP CLI exposes commands for managing applications, as well as 19 | lower-level tools to interact with each component of a system. The 20 | binaries for Mac, Windows, and Linux are available for download from the 21 | Red Hat Customer Portal via the following methods: 22 | 23 | * Supported Binary from the Red Hat Portal: https://access.redhat.com/downloads/content/290 24 | * Upstream Origin Binary: https://github.com/openshift/origin/releases 25 | * Past releases: https://mirror.openshift.com/pub/openshift-v3/clients 26 | 27 | *Installing the CLI tools* 28 | 29 | The CLI is provided as compressed files that can be decompressed to any 30 | directory. In order to make it simple for any user to access the OCP 31 | CLI, it is recommended that it is made available in a directory mapped 32 | to the environment variable called `PATH` from the OS. More information 33 | can be found about installation process here: 34 | https://docs.openshift.com/container-platform/latest/cli_reference/get_started_cli.html 35 | 36 | 1. *OSX and Linux:* 37 | + 38 | 1.1. Copy the binary to the `/usr/local/bin` directory, or one of the 39 | paths listed in the `PATH` environment variable. 40 | 2. *Windows:* 41 | + 42 | 2.1. Use oc.exe to open an OpenShift shell. If you getting error from 43 | running oc, go to git-scm.com to download git bash for Windows (during 44 | installation you need to specify in the selection to integrate with the 45 | command prompt) 46 | + 47 | 2.2. Download and install Notepad++ and install the JSON plugin or use 48 | http://jsonlint.com/ to edit and validate JSON. 49 | + 50 | http://ammonsonline.com/formatted-json-in-notepad/ 51 | + 52 | 2.3. Configure your default editor to be Notepad++ 53 | 54 | *CLI basic configuration* 55 | 56 | The easiest way to initially setup the OpenShift CLI is to use the 57 | `oc login` command. It’ll interactively ask you a server URL, username 58 | and password. The information is automatically saved in a CLI 59 | configuration file that is then used for subsequent commands. 60 | 61 | To login to a remote server use: 62 | 63 | [source,shell] 64 | ---- 65 | $ oc login : 66 | ---- 67 | 68 | link:0_toc.adoc[Table Of Contents] 69 | -------------------------------------------------------------------------------- /0_toc.adoc: -------------------------------------------------------------------------------- 1 | [[openshift-v3-workshop-labs]] 2 | OpenShift V3 Workshop Labs 3 | -------------------------- 4 | 5 | [[lab-exercises-table-of-contents]] 6 | Lab Exercises Table of Contents 7 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 8 | 9 | * Lab 0. link:0-Setting-up-client-tools.adoc[Setting up client tools] 10 | * Lab 1. link:1-Create-App-From-a-Docker-Image.adoc[Creating an application from an existing Docker Image using CLI] 11 | * Lab 2. link:2-Create-App-Using-Docker-Build.adoc[Create an application using Docker Build Strategy using CLI] 12 | * Lab 3. link:3-Using-Web-Console.adoc[Using Web Console] 13 | * Lab 4. link:4-Creating-an-application-using-JBoss-EAP-builder-image.adoc[Creating an application using JBoss EAP builder image] 14 | * Lab 5. link:5-Using-templates.adoc[Creating an application with frontend and backend database using templates] 15 | * Lab 6. link:6-Scale-up-and-Scale-down-the-application-instances.adoc[Scale Up Scale Down and Idle the application instances] 16 | * Lab 7. link:7-Binary-Deployment-of-a-war-file.adoc[Binary deployment of a war file] 17 | * Lab 8. link:8-Using-SSL-In-your-Application.adoc[Using SSL In your Application] 18 | * Lab 9. link:9-Blue-Green-Deployments.adoc[Blue-Green Deployments] 19 | * Lab 10. link:10-SCM-Web-Hooks.adoc[SCM - Web Hooks] 20 | * Lab 11. link:11-Rollback-Applications.adoc[Rollback Applications] 21 | * Lab 12. link:12-Code-Promotion-Across-Environments.adoc[Code Promotion Across Environments] 22 | * Lab 13. link:13-Using-Persistent-Storage.adoc[Using Persistent Storage] 23 | * Lab 14. link:14-Using-a-Custom-S2I-Image.adoc[Using Custom S2I Image to deploy an Application] 24 | * Lab 15. link:15-Adding-Custom-S2I-Image-to-the-Project-Catalog.adoc[Adding Custom S2I Image to Project Catalog] 25 | * Lab 16. link:16-Using-ConfigMap-to-Inject-Application-Configuration.adoc[Using ConfigMap to add a Database Connection] 26 | * Lab 17. link:17-Dynamic-Configuration-Updates-using-ConfigMap.adoc[Dynamic Configuration updates using ConfigMap] 27 | * Lab 18. link:18-Changing-code-on-the-fly.adoc[Changing code on the fly] 28 | * Lab 19. link:19-Creating-a-Pipeline.adoc[Creating a CI/CD Pipeline] 29 | -------------------------------------------------------------------------------- /1-Create-App-From-a-Docker-Image.adoc: -------------------------------------------------------------------------------- 1 | [[create-an-app-from-a-docker-image]] 2 | Create an App from a Docker image 3 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | 5 | In this lab you will learn how to create a new project on OpenShift and 6 | how to create an application from an existing docker image. 7 | 8 | *Step 1: Add a new project from command line* 9 | 10 | *Note:* Please replace *UserName* with the username assigned to you in 11 | the commands below. 12 | 13 | .... 14 | $ oc new-project mycliproject-UserName --description="My CLI Project" --display-name="CLI Project" 15 | .... 16 | 17 | Upon project creation, OpenShift will automatically switch to the newly 18 | created project/namespace. If you wish to view the list of projects, run 19 | the following command: 20 | 21 | .... 22 | $ oc get projects 23 | .... 24 | 25 | If you have more than one project, you can switch to a different one by 26 | issuing `oc project `. Although you don’t want to do it 27 | now. 28 | 29 | You can also check the status of the project by running the following 30 | command. It says that the project is currently not running anything. 31 | 32 | .... 33 | $ oc status 34 | 35 | In project CLI Project (mycliproject-UserName) 36 | 37 | You have no services, deployment configs, or build configs. 38 | Run 'oc new-app' to create an application. 39 | .... 40 | 41 | *Step 2: Create an application from a Docker Image* 42 | 43 | Next we will create an application inside the above project using an 44 | existing docker image. We will be using a very simple docker image on 45 | dockerhub that just says 'Welcome to OpenShift V3. Let us just use 46 | that for this exercise. 47 | 48 | First create a new application using the docker image using the 49 | `oc new-app` command as shown below: 50 | 51 | .... 52 | $ oc new-app redhatworkshops/welcome-php --name=welcome 53 | 54 | --> Found Docker image f001b13 (8 months old) from Docker Hub for "redhatworkshops/welcome-php" 55 | 56 | * An image stream will be created as "welcome:latest" that will track this image 57 | * This image will be deployed in deployment config "welcome" 58 | * Port 8080/tcp will be load balanced by service "welcome" 59 | * Other containers can access this service through the hostname "welcome" 60 | * WARNING: Image "redhatworkshops/welcome-php" runs as the 'root' user which may not be permitted by your cluster administrator 61 | 62 | --> Creating resources with label app=welcome ... 63 | imagestream "welcome" created 64 | deploymentconfig "welcome" created 65 | service "welcome" created 66 | --> Success 67 | Run 'oc status' to view your app. 68 | .... 69 | 70 | The above command uses the docker image to deploy a docker container in 71 | a pod. If you quickly run `oc get pods` you will notice that a deployer 72 | pod runs and it starts an application pod as shown below. 73 | 74 | .... 75 | $ oc get pods 76 | 77 | NAME READY STATUS RESTARTS AGE 78 | welcome-1-deploy 1/1 Running 0 1m 79 | welcome-1-dkyyq 0/1 Pending 0 0s 80 | .... 81 | 82 | In the above example `welcome-1-deploy` is the deployer pod and the 83 | other one is the actual application pod. In a little while the deployer 84 | pod will succeed and the application pod will change for `Pending` to 85 | `Running` status. 86 | 87 | .... 88 | $ oc get pods 89 | 90 | NAME READY STATUS RESTARTS AGE 91 | welcome-1-dkyyq 1/1 Running 0 56s 92 | .... 93 | 94 | *Step 3: Add a Route for your application* 95 | 96 | OpenShift also spins up a service for this application. Run the 97 | following command to view the list of services in the project (you 98 | can also use `oc get svc` shorthand). 99 | 100 | .... 101 | $ oc get services 102 | 103 | NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE 104 | welcome 172.30.77.93 8080/TCP 2m 105 | .... 106 | 107 | You will notice the `welcome` service was created for this project. 108 | 109 | However, there is no route for this application yet. So you cannot 110 | access this application from outside. 111 | 112 | Now add a route to the service with the following command. `oc expose` 113 | command will allow you to expose your service to the world so that you 114 | can access it from the browser. 115 | 116 | *Note*: In this example, I am using a domain name of 117 | `apps.workshop.osecloud.com`. *Ask the instructor for the domain name suffix* for 118 | your setup an change it. 119 | 120 | .... 121 | $ oc expose service welcome --name=welcome 122 | 123 | NAME HOST/PORT PATH SERVICE LABELS 124 | welcome welcome.UserName.apps.workshop.osecloud.com welcome 125 | .... 126 | 127 | *Step 4: Try your application* 128 | 129 | Access the application: Now access the application using curl (looking 130 | for 200 status code) or from the browser and see the result 131 | 132 | .... 133 | $ oc get routes 134 | 135 | $ curl -Is 136 | .... 137 | 138 | Voila!! you created your first application using an existing docker 139 | image on OpenShift. 140 | 141 | *Step 4: Clean up* 142 | 143 | Run the `oc get all` command to view all the components that were 144 | created in your project. 145 | 146 | .... 147 | $ oc get all 148 | 149 | NAME TYPE SOURCE 150 | NAME TYPE STATUS POD 151 | NAME DOCKER REPO TAGS UPDATED 152 | welcome redhatworkshops/welcome-php latest 5 hours ago 153 | NAME TRIGGERS LATEST VERSION 154 | welcome ConfigChange, ImageChange 1 155 | CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS 156 | welcome-1 welcome redhatworkshops/welcome-php:latest deployment=welcome-1,deploymentconfig=welcome 1 157 | NAME HOST/PORT PATH SERVICE LABELS 158 | welcome welcome.apps.workshop.osecloud.com welcome 159 | NAME LABELS SELECTOR IP(S) PORT(S) 160 | welcome deploymentconfig=welcome 172.30.155.37 80/TCP 161 | NAME READY REASON RESTARTS AGE 162 | welcome-1-8d7nk 1/1 Running 0 4h 163 | .... 164 | 165 | Now you can delete all these components by running one command. 166 | 167 | .... 168 | $ oc delete all --all 169 | 170 | imagestream "welcome" deleted 171 | deploymentconfig "welcome" deleted 172 | route "welcome" deleted 173 | service "welcome" deleted 174 | pod "welcome-1-ynedb" deleted 175 | .... 176 | 177 | You will notice that it has deleted the imagestream for the application, 178 | the deploymentconfig, the service and the route. 179 | 180 | You can run `oc get all` again to make sure the project is empty. 181 | 182 | Congratulations!! You now know how to create a project, an application 183 | using an external docker image and navigate around. Get ready for more 184 | fun stuff! 185 | 186 | link:0_toc.adoc[Table Of Contents] 187 | -------------------------------------------------------------------------------- /10-SCM-Web-Hooks.adoc: -------------------------------------------------------------------------------- 1 | [[scm-web-hooks]] 2 | SCM Web Hooks 3 | ~~~~~~~~~~~~~ 4 | 5 | OpenShift offers several mechanisms to trigger the automatic deployment 6 | of applications. In this Lab, we will demonstrate the deployment of a 7 | very simple application via a GitHub Web Hook trigger. 8 | 9 | [[part-i]] 10 | Part I 11 | ~~~~~~ 12 | 13 | In Part I of the Lab we will: 14 | 15 | * Create a new project. 16 | * Deploy an application using a source to image strategy. 17 | * Create a route to expose the newly deployed application. 18 | 19 | *Step 1: Create new project* 20 | 21 | *Remember* to substitute the UserName 22 | 23 | .... 24 | $ oc new-project scm-web-hooks-UserName --display-name="Test WebHooks" 25 | .... 26 | 27 | *Step 2: Create new application* 28 | 29 | * Fork the github repository from the previous lab and use it for the following commands. 30 | 31 | *Remember* to substitute the UserName. 32 | 33 | .... 34 | $ oc new-app --image-stream=php --code=https://github.com/your_github_username/bluegreen.git --name=scm-web-hooks 35 | .... 36 | 37 | *Step 3: Look at some of the created resources* 38 | 39 | * Build configuration 40 | 41 | .... 42 | $ oc get bc 43 | .... 44 | 45 | * Deployment configuration 46 | 47 | .... 48 | $ oc get dc 49 | .... 50 | 51 | * Show created service 52 | 53 | .... 54 | $ oc get service 55 | .... 56 | 57 | * Show replication controller 58 | 59 | .... 60 | $ oc get rc 61 | .... 62 | 63 | * Show route 64 | 65 | .... 66 | $ oc get route 67 | .... 68 | 69 | Notice that there is no route created yet for this application. 70 | 71 | * Show the builds in progress (Running) 72 | 73 | .... 74 | $ oc get builds 75 | NAME TYPE STATUS POD 76 | scm-web-hooks-1 Source Running scm-web-hooks-1-build 77 | .... 78 | 79 | * Monitor the build 80 | 81 | .... 82 | $ oc logs build/scm-web-hooks-1 83 | .... 84 | 85 | The build should finish similar to: 86 | 87 | .... 88 | Pushing image 172.30.89.28:5000/scm-web-hooks-admin/scm-web-hooks:latest ... 89 | Pushed 0/5 layers, 2% complete 90 | Pushed 1/5 layers, 22% complete 91 | Pushed 2/5 layers, 44% complete 92 | Pushed 3/5 layers, 70% complete 93 | Pushed 3/5 layers, 100% complete 94 | Pushed 4/5 layers, 100% complete 95 | Pushed 5/5 layers, 100% complete 96 | Push successful 97 | .... 98 | 99 | *Step 4: Create a route* 100 | 101 | .... 102 | $ oc get service 103 | 104 | NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE 105 | scm-web-hooks 172.30.71.191 8080/TCP 4m 106 | .... 107 | 108 | *Remember* to substitute the UserName. 109 | 110 | .... 111 | $ oc expose service scm-web-hooks --hostname=scm-web-hooks.UserName.apps.workshop.osecloud.com 112 | NAME HOST/PORT PATH SERVICE LABELS TLS TERMINATION 113 | scm-web-hooks scm-web-hooks.UserName.apps.workshop.osecloud.com scm-web-hooks app=scm-web-hooks 114 | .... 115 | 116 | *Step 5: Test the application* 117 | 118 | * Use the newly created route, in the above case 119 | `scm-web-hooks.UserName.apps.workshop.osecloud.com` and paste it in your browser. 120 | * You should see: 121 | 122 | image::images/green_deployment.png[image] 123 | 124 | [[part-ii]] 125 | Part II 126 | ~~~~~~~ 127 | 128 | At this point you have an application with one single replica running 129 | inside a docker container in OpenShift. We used the source retrieved 130 | from the git repository and layered it using a builder or image stream 131 | strategy; in this particular case, the php image stream. 132 | 133 | In this part of the Lab we will: 134 | 135 | * Create a web hook for the recently deployed application. 136 | * Make a small change to the application. 137 | * Test to make sure the application was re-deployed. 138 | 139 | *Step 1: Retrieve the OpenShift Web Hook URL* 140 | 141 | * Navigate to the OpenShift Web console and login. 142 | * Select your *Test WebHooks* project, and click *Builds* and then 143 | *Builds*. 144 | * Click onto the build name from the list. You should have just one in 145 | this case. 146 | * Click *Configuration* tab to get list of *Triggers* for the GitHub 147 | link. 148 | * Copy the *GitHub webhook URL*. You will need this URL for next step. 149 | 150 | image::images/github_show_url.png[image] 151 | 152 | *Step 2: Configure GitHub repository Web Hook* 153 | 154 | * Login to your GitHub account. 155 | * Navigate to the forked repository you used to create the application. 156 | * Click on Settings. 157 | * Click on Webhooks. 158 | * Click on the *Add webhook* button. 159 | * Add the recently copied Web Hook URL from OpenShift. 160 | * Change the Content-type as ``application/json'' 161 | * Click on the *Disable SSL Verification* button. 162 | * Confirm by adding the *Add Webhook* button in green at the bottom of 163 | the page. 164 | 165 | image::images/github_add_webhook.jpg[image] 166 | 167 | *Step 3: Redeploy the application* 168 | 169 | * Edit in your GitHub account the `image.php` file. 170 | * One of the lines in line 9 or 10 should be commented out. Make a 171 | change so that the line that was previously commented out becomes active 172 | and pound the other one. 173 | * Commit the file. 174 | 175 | *Step 4: Monitor new deployment process* 176 | 177 | * After saving/committing the `image.php` file with the small change, 178 | you’ll notice in the OpenShift Web Console that a new build process has 179 | been automatically triggered. *You didn’t have to start a build 180 | yourself.* 181 | * Monitor the build process using: 182 | 183 | .... 184 | $ oc get builds 185 | 186 | $ oc logs build/the-new-build-process-name 187 | .... 188 | 189 | [[summary]] 190 | Summary 191 | ~~~~~~~ 192 | 193 | We have shown in this Lab how simple it is to configure automatic 194 | deployments of applications using OpenShift and GitHub Web Hook 195 | triggers. It should be noted that OpenShift also supports Generic Web 196 | Hooks. 197 | 198 | link:0_toc.adoc[Table Of Contents] 199 | -------------------------------------------------------------------------------- /11-Rollback-Applications.adoc: -------------------------------------------------------------------------------- 1 | [[rollback-applications]] 2 | Rollback Applications 3 | ~~~~~~~~~~~~~~~~~~~~~ 4 | 5 | In this lab we will see how we can rollback an application in OpenShift 6 | quickly without switching to an older version of the source code in SCM. 7 | 8 | In this Lab we will: 9 | 10 | * Use the same app we deployed in previous Web Hooks Lab. If you haven’t, please 11 | complete that Lab first. 12 | * Rollback the application using the OpenShift v3 command ``rollback''. 13 | 14 | *Step 1: Check application health status* 15 | 16 | * Run: 17 | 18 | .... 19 | $ oc get pods 20 | 21 | NAME READY STATUS RESTARTS AGE 22 | scm-web-hooks-1-build 0/1 Completed 0 1h 23 | scm-web-hooks-2-85bkw 1/1 Running 0 18m 24 | scm-web-hooks-2-build 0/1 Completed 0 19m 25 | .... 26 | 27 | * Inspecting the output of the above command we can see that we have a 28 | single replica of the previously deployed application running. 29 | * We can also see that previously two pods were used to build the 30 | application. OpenShift will create and docker deploy a pod per 31 | deployment. This tells us that we currently have two versions of the 32 | application. 33 | * You can also use: 34 | 35 | .... 36 | $ oc get dc 37 | 38 | NAME REVISION DESIRED CURRENT TRIGGERED BY 39 | scm-web-hooks 2 1 1 config,image(scm-web-hooks:latest) 40 | .... 41 | 42 | * The latest and active version for the application is *2* 43 | * If we display the application in the browser we see: 44 | 45 | image::images/blue_app.jpg[image] 46 | 47 | *Step 2: Rollback the application* 48 | 49 | * Using the previous command we ran to retrieve the deployment 50 | configuration, we will revert or rollback to version 1. 51 | 52 | .... 53 | $ oc rollback scm-web-hooks --to-version=1 54 | #3 rolled back to scm-web-hooks-1 55 | .... 56 | 57 | * If we re-run the command to list the build configurations, we now see: 58 | 59 | .... 60 | $ oc get dc 61 | 62 | NAME REVISION DESIRED CURRENT TRIGGERED BY 63 | scm-web-hooks 3 1 1 config,image(scm-web-hooks:latest) 64 | .... 65 | 66 | * So OpenShift has rolled back the application to version 1 and created 67 | a new build configuration. 68 | * Reloading the application now displays: 69 | 70 | image::images/green_app.jpg[image] 71 | 72 | link:0_toc.adoc[Table Of Contents] 73 | -------------------------------------------------------------------------------- /12-Code-Promotion-Across-Environments.adoc: -------------------------------------------------------------------------------- 1 | [[code-promotion-across-environments]] 2 | Code Promotion across Environments 3 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | 5 | In this lab we will learn how an application image binary can be 6 | promoted across the environments. As an example we will use development 7 | and QA environments as promotion to pre-prod and production will be very 8 | similar. 9 | 10 | In this example we are using projects as means of separation of 11 | environments (development, qa, production). 12 | 13 | *Step 1: Create two projects* 14 | 15 | Using the knowledge you gained from the past create two projects. 16 | 17 | Name the first project *development-UserName* 18 | 19 | .... 20 | $ oc new-project development-UserName 21 | .... 22 | 23 | Name the second *testing-UserName*. 24 | .... 25 | $ oc new-project testing-UserName 26 | .... 27 | 28 | Also *remember* to substitute the username! 29 | 30 | *Step 2: Provide ImagePuller Access to the QA Project from Development 31 | Project* 32 | 33 | The following command will allow the QA project to be able to pull the 34 | docker images from the Development project. 35 | 36 | .... 37 | $ oc policy add-role-to-group system:image-puller system:serviceaccounts:testing-UserName -n development-UserName 38 | .... 39 | 40 | *Step 3: Create an application in the development project* 41 | 42 | Switch over to the *development-UserName* project and deploy an 43 | application using the `php` s2i builder. You can use webconsole or 44 | command line. The command line option is shown below. 45 | 46 | *Bonus points:* Clone this application to your own github account and 47 | deploy it so that you can redeploy with changes later. 48 | 49 | .... 50 | oc project development-UserName 51 | oc new-app openshift/php~https://github.com/RedHatWorkshops/welcome-php 52 | .... 53 | 54 | *Step 4: Tag the docker image* 55 | 56 | Wait until the application gets built and deployed. Now if you check the 57 | imagestreams you will find the docker image for this application. 58 | 59 | Now find the imagestream name using the following command. `is` is the 60 | short form for `imageStream`. 61 | 62 | .... 63 | $ oc get is 64 | NAME DOCKER REPO TAGS UPDATED 65 | welcome-php docker-registry.default.svc:5000/development-UserName/welcome-php 66 | .... 67 | 68 | Now describe this image stream to get the full image id: 69 | 70 | .... 71 | $ oc describe is welcome-php 72 | Name: welcome-php 73 | Namespace: development-UserName 74 | Created: 7 minutes ago 75 | Labels: app=welcome-php 76 | Annotations: openshift.io/generated-by=OpenShiftNewApp 77 | openshift.io/image.dockerRepositoryCheck=2017-08-21T23:24:26Z 78 | Docker Pull Spec: docker-registry.default.svc:5000/development-UserName/welcome-php 79 | Unique Images: 1 80 | Tags: 1 81 | 82 | latest 83 | pushed image 84 | 85 | * docker-registry.default.svc:5000/development-UserName/welcome-php@sha256:157334d73dfc8dfdf733257b05c3fecaee236d36f69afa207395715fbe882abf 86 | 4 minutes ago 87 | 88 | .... 89 | 90 | In this case, the full image Id is 91 | 92 | .... 93 | docker-registry.default.svc:5000/development-UserName/welcome-php@sha256:157334d73dfc8dfdf733257b05c3fecaee236d36f69afa207395715fbe882abf 94 | 95 | .... 96 | 97 | Now let us assume that this docker image is good and is ready to promote 98 | to QA. Let us tag this docker image using the `oc tag` command. 99 | 100 | The format is 101 | 102 | .... 103 | oc tag FullImageId development-UserName/myapp:promote-qa 104 | .... 105 | 106 | Check the following commands and replace the values where needed: 107 | 108 | .... 109 | $ oc tag \ 110 | docker-registry.default.svc:5000/development-UserName/welcome-php@sha256:157334d73dfc8dfdf733257b05c3fecaee236d36f69afa207395715fbe882abf \ 111 | development-UserName/welcome-php:promote-qa 112 | 113 | Tag welcome-php:promote-qa set to docker-registry.default.svc:5000/development-UserName/welcome-php@sha256:157334d73dfc8dfdf733257b05c3fecaee236d36f69afa207395715fbe882abf. 114 | 115 | 116 | $ oc describe is welcome-php 117 | Name: welcome-php 118 | Namespace: development-UserName 119 | Created: 4 minutes ago 120 | Labels: app=welcome-php 121 | Annotations: openshift.io/generated-by=OpenShiftNewApp 122 | openshift.io/image.dockerRepositoryCheck=2017-08-21T23:24:26Z 123 | Docker Pull Spec: docker-registry.default.svc:5000/development-UserName/welcome-php 124 | Unique Images: 1 125 | Tags: 2 126 | 127 | latest 128 | pushed image 129 | 130 | * docker-registry.default.svc:5000/development-UserName/welcome-php@sha256:157334d73dfc8dfdf733257b05c3fecaee236d36f69afa207395715fbe882abf 131 | 2 minutes ago 132 | 133 | promote-qa 134 | tagged from docker-registry.default.svc:5000/development-UserName/welcome-php@sha256:157334d73dfc8dfdf733257b05c3fecaee236d36f69afa207395715fbe882abf 135 | 136 | * docker-registry.default.svc:5000/development-UserName/welcome-php@sha256:157334d73dfc8dfdf733257b05c3fecaee236d36f69afa207395715fbe882abf 137 | .... 138 | 139 | *Step 5: Deploy the application to QA* 140 | 141 | Now you can switch over to the QA project and deploy the docker image 142 | that we tagged in development. Also expose service to create route for 143 | this project and *remember* to substitute username. 144 | 145 | .... 146 | oc project testing-UserName 147 | oc new-app development-UserName/welcome-php:promote-qa 148 | oc expose service welcome-php 149 | .... 150 | 151 | Test this application in the QA project. Note that we deployed the 152 | docker image from the development project without rebuilding the code. 153 | 154 | *Bonus points*: Make changes to your git repo (to 155 | `index.php`) and deploy it to development first. 156 | Notice that your changes are seen only in development project. Repeat 157 | the changes a couple of times. Now find the latest imagestream and tag 158 | it as promote-qa. Watch out that the QA project gets redeployed when you 159 | update the new tag. 160 | 161 | Watch this 162 | https://blog.openshift.com/promoting-applications-across-environments[video] 163 | for complete understanding. 164 | 165 | Congratulations!! you now know how to promote your application across 166 | environments in OpenShift 3. 167 | 168 | link:0_toc.adoc[Table Of Contents] 169 | -------------------------------------------------------------------------------- /13-Using-Persistent-Storage.adoc: -------------------------------------------------------------------------------- 1 | [[using-persistent-storage]] 2 | Using Persistent Storage 3 | ~~~~~~~~~~~~~~~~~~~~~~~~ 4 | 5 | The purpose of this lab is to demonstrate how you can request storage 6 | from OpenShift and have it attach to your application. 7 | 8 | Containers, by design, are ephemeral. In short, if you want your application 9 | to store persistent data; you will need to attach to a backend storage system. 10 | 11 | In this Lab, we will be: 12 | 13 | * Deploying an application that takes uploads 14 | * Upload a File, and delete the pod 15 | * Attach persistant storage 16 | * Upload a File, and delete the pod 17 | 18 | *NOTE:* Storage provisioning must be setup by the Operations Team before proceeding. 19 | 20 | 21 | *Step 1: Deploy Application* 22 | 23 | Create a project called `storage-UserName` and deploy the application 24 | 25 | .... 26 | oc new-project storage-UserName --description="My Storage-project" --display-name="Storage Project" 27 | oc new-app php~https://github.com/RedHatWorkshops/openshift-php-upload-demo 28 | .... 29 | 30 | Once the application is deployed expose the route 31 | .... 32 | $ oc get svc 33 | NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE 34 | openshift-php-upload-demo 172.30.212.62 8080/TCP 2m 35 | 36 | $ oc expose svc openshift-php-upload-demo 37 | route "openshift-php-upload-demo" exposed 38 | .... 39 | 40 | Visit your application; it should look like this 41 | 42 | image::images/upload-app.png[image] 43 | 44 | *Step 2: Test with ephemeral storage* 45 | 46 | Pick a file to upload and upload it to the app. Once uploaded you can view 47 | a list of file when you click `List Uploaded Files`. It should look something 48 | like this 49 | 50 | image::images/list-uploaded-files.png[image] 51 | 52 | You can see where the uploaded files are if you use `oc rsh`. They are uploaded 53 | under `/opt/app-root/src/uploaded` 54 | 55 | .... 56 | $ oc get pods 57 | NAME READY STATUS RESTARTS AGE 58 | openshift-php-upload-demo-1-build 0/1 Completed 0 10m 59 | openshift-php-upload-demo-1-rdktr 1/1 Running 0 5m 60 | 61 | $ oc rsh openshift-php-upload-demo-1-rdktr 62 | sh-4.2$ ls -1 /opt/app-root/src/uploaded 63 | shadowman.png 64 | sh-4.2$ exit 65 | .... 66 | 67 | Delete this pod. 68 | 69 | .... 70 | $ oc delete pod openshift-php-upload-demo-1-rdktr 71 | pod "openshift-php-upload-demo-1-rdktr" deleted 72 | .... 73 | 74 | Now login to your new pod that got spun up. Your data is gone! 75 | .... 76 | $ oc get pods 77 | NAME READY STATUS RESTARTS AGE 78 | openshift-php-upload-demo-1-build 0/1 Completed 0 13m 79 | openshift-php-upload-demo-1-wnv4r 1/1 Running 0 38s 80 | 81 | $ oc rsh openshift-php-upload-demo-1-wnv4r 82 | sh-4.2$ ls -1 /opt/app-root/src/uploaded 83 | sh-4.2$ exit 84 | .... 85 | 86 | 87 | *Step 3: Requesting Storage* 88 | 89 | In OpenShift, Storage is abstracted out to where one simply "requests" storage 90 | and it's up to the backend adminsitrator to provide the solution 91 | 92 | On the webconsole on the left side navigation click on "Storage". It will bing 93 | you to the storage overview page. 94 | 95 | image::images/storage-overview.png[image] 96 | 97 | On the right hand side; click the "Create Storage" button. This will take you 98 | to the "Create Storage" page. 99 | 100 | image::images/create-storage.png[image] 101 | 102 | Here you need to enter the following 103 | 104 | ---- 105 | * Storage Class: 106 | * Name: myclaim 107 | * Access Mode: Shared Access (RWX) 108 | * Size: 1 GiB 109 | ---- 110 | 111 | The `Storage Class` will be given to you by your instructor. The `Name` must be 112 | unique to the project namespace. The `Access Mode` means "how many apps can access 113 | this storage". For block storage you'd choose `Singe User (RWO)`; in this instance 114 | we are choosing `Shared Access (RWX)` (for File based storage like NFS). The `Size` 115 | is set to `1 GB` just for testing. 116 | 117 | Once you click on "Create" it'll go from a `Pending` stage to `Bound`. You can see 118 | this on the command-line as well by checking your `pvc` (Which stands for Persistant 119 | Volume Claim) 120 | 121 | .... 122 | $ oc get pvc 123 | NAME STATUS VOLUME CAPACITY ACCESSMODES AGE 124 | myclaim Bound pvc-071ee3ef-86d2-11e7-aec4-52540019c877 1Gi RWX 27s 125 | .... 126 | 127 | Get yourself familair with the configuration 128 | .... 129 | $ oc get pvc myclaim -o yaml 130 | apiVersion: v1 131 | kind: PersistentVolumeClaim 132 | metadata: 133 | annotations: 134 | pv.kubernetes.io/bind-completed: "yes" 135 | pv.kubernetes.io/bound-by-controller: "yes" 136 | volume.beta.kubernetes.io/storage-class: glusterfs-storage 137 | volume.beta.kubernetes.io/storage-provisioner: kubernetes.io/glusterfs 138 | creationTimestamp: 2017-08-22T00:37:07Z 139 | name: myclaim 140 | namespace: storage-UserName 141 | resourceVersion: "48898" 142 | selfLink: /api/v1/namespaces/testing-user00/persistentvolumeclaims/myclaim 143 | uid: 071ee3ef-86d2-11e7-aec4-52540019c877 144 | spec: 145 | accessModes: 146 | - ReadWriteMany 147 | resources: 148 | requests: 149 | storage: 1Gi 150 | volumeName: pvc-071ee3ef-86d2-11e7-aec4-52540019c877 151 | status: 152 | accessModes: 153 | - ReadWriteMany 154 | capacity: 155 | storage: 1Gi 156 | phase: Bound 157 | .... 158 | 159 | We will now bind this storage to the application's path of where it is 160 | storing the files. This is under `/opt/app-root/src/uploaded`. You need 161 | to add the volume to the `deploymentConfig` of `openshift-php-upload-demo`. 162 | 163 | .... 164 | $ oc volume dc/openshift-php-upload-demo --add -t pvc --claim-name=myclaim --mount-path=/opt/app-root/src/uploaded 165 | info: Generated volume name: volume-c7jtb 166 | deploymentconfig "openshift-php-upload-demo" updated 167 | .... 168 | 169 | *Step 3: Testing Configuration* 170 | 171 | This will trigger a new deployment. Login to your pod to see the mount. 172 | 173 | .... 174 | $ oc get pods 175 | NAME READY STATUS RESTARTS AGE 176 | openshift-php-upload-demo-1-build 0/1 Completed 0 1h 177 | openshift-php-upload-demo-8-16dzg 1/1 Running 0 1m 178 | 179 | $ oc rsh openshift-php-upload-demo-8-16dzg 180 | sh-4.2$ df -h /opt/app-root/src/uploaded/ 181 | Filesystem Size Used Avail Use% Mounted on 182 | 172.16.1.11:vol_464dc941ae641d2693b1382cc221a0b5 1016M 33M 983M 4% /opt/app-root/src/uploaded 183 | .... 184 | 185 | Upload a file like before. Once uploaded; delete the pod 186 | 187 | .... 188 | $ oc get pods 189 | NAME READY STATUS RESTARTS AGE 190 | openshift-php-upload-demo-1-build 0/1 Completed 0 1h 191 | openshift-php-upload-demo-8-16dzg 1/1 Running 0 2m 192 | 193 | $ oc delete pod openshift-php-upload-demo-8-16dzg 194 | pod "openshift-php-upload-demo-8-16dzg" deleted 195 | .... 196 | 197 | Log into the newly spunup pod and verify that your file is still there! 198 | 199 | .... 200 | $ oc get pods 201 | NAME READY STATUS RESTARTS AGE 202 | openshift-php-upload-demo-1-build 0/1 Completed 0 1h 203 | openshift-php-upload-demo-8-4brh0 1/1 Running 0 58s 204 | 205 | $ oc rsh openshift-php-upload-demo-8-4brh0 206 | sh-4.2$ ls -1 /opt/app-root/src/uploaded/ 207 | shadowman.png 208 | .... 209 | 210 | [[summary]] 211 | Summary 212 | ^^^^^^^ 213 | 214 | In this lab you learned how to request, attach, and test persistant storage. 215 | 216 | link:0_toc.adoc[Table Of Contents] 217 | -------------------------------------------------------------------------------- /14-Using-a-Custom-S2I-Image.adoc: -------------------------------------------------------------------------------- 1 | [[using-a-custom-s2i-image]] 2 | Using Custom S2I Image to deploy a SpringBoot Application 3 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | 5 | In this exercise we will deploy a SpringBoot application using a custom 6 | source to image builder image. You will learn how to use an s2i image that 7 | is not on openshift to build your application. 8 | 9 | *Step 1:* Using the knowledge you gained from the earlier labs create a 10 | new project with name `spring-UserName`. *Remember* to substitute the 11 | `UserName` with your userid. 12 | 13 | *Step 2:* Create a new application using SpringBoot S2I Builder image. 14 | Here we will deploy sample code from a git repository 15 | https://github.com/RedHatWorkshops/spring-sample-app. Please take time 16 | to understand the code; it is pretty simple. 17 | 18 | You may want to clone this into your git repository and deploy that, if 19 | you want to make changes and test. 20 | 21 | *Note:* We are using an S2I builder image from docker directly. This S2I 22 | builder image was created using this Dockerfile. 23 | link:[https://github.com/codecentric/springboot-maven3-centos/blob/master/Dockerfile] 24 | 25 | .... 26 | $ oc new-app veermuchandi/spring-mvn-base~https://github.com/RedHatWorkshops/spring-sample-app --name=bootapp 27 | --> Found Docker image c3ddd9e (7 days old) from Docker Hub for "veermuchandi/spring-mvn-base" 28 | 29 | Spring Boot Maven 3 30 | ------------------- 31 | Platform for building and running Spring Boot applications 32 | 33 | Tags: builder, java, java8, maven, maven3, springboot 34 | 35 | * An image stream will be created as "spring-mvn-base:latest" that will track the source image 36 | * A source build using source code from https://github.com/RedHatWorkshops/spring-sample-app will be created 37 | * The resulting image will be pushed to image stream "bootapp:latest" 38 | * Every time "spring-mvn-base:latest" changes a new build will be triggered 39 | * This image will be deployed in deployment config "bootapp" 40 | * Port 8080/tcp will be load balanced by service "bootapp" 41 | * Other containers can access this service through the hostname "bootapp" 42 | 43 | --> Creating resources with label app=bootapp ... 44 | imagestream "spring-mvn-base" created 45 | imagestream "bootapp" created 46 | buildconfig "bootapp" created 47 | deploymentconfig "bootapp" created 48 | service "bootapp" created 49 | --> Success 50 | Build scheduled, use 'oc logs -f bc/bootapp' to track its progress. 51 | Run 'oc status' to view your app. 52 | .... 53 | 54 | Expose Service to create a route 55 | 56 | .... 57 | $ oc expose service bootapp 58 | route "bootapp" exposed 59 | .... 60 | 61 | Check the route 62 | 63 | .... 64 | $ oc get route 65 | NAME HOST/PORT PATH SERVICES PORT TERMINATION 66 | bootapp bootapp-spring-UserName.apps.workshop.osecloud.com bootapp 8080-tcp 67 | .... 68 | 69 | Wait for your application to be built and deployed. Using the knowlege 70 | you gained from the previous labs, check your build logs by running 71 | `oc logs -f ` 72 | 73 | *Step 3* 74 | 75 | Test your application by using the hostname assigned in the route. 76 | 77 | Congratulations!! You are now running a SpringBoot application on 78 | OpenShift. 79 | 80 | link:0_toc.adoc[Table Of Contents] 81 | -------------------------------------------------------------------------------- /15-Adding-Custom-S2I-Image-to-the-Project-Catalog.adoc: -------------------------------------------------------------------------------- 1 | [[adding-custom-s2i-image-to-the-project-catalog]] 2 | Adding Custom S2I Image to the Project Catalog 3 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | 5 | In the last lab to 6 | link:14-Using-a-Custom-S2I-Image.adoc[Using Custom S2I Image], we used 7 | the S2I image directly from a docker registry 8 | that is outside OpenShift environment. This custom S2I image was not in 9 | openshift catalog. In this lab, we will learn how to add the Spring Boot image 10 | to the project catalog so that you can deploy the application directly 11 | from your screen. 12 | 13 | *Step 1:* Clean up the project that you created in the last lab. 14 | 15 | Ensure you are in the right project by running `oc project` command. If 16 | not, change your project by running `oc project spring-UserName`, 17 | *replacing* the UserName with your own userid. 18 | 19 | Clean up the contents of this project: 20 | 21 | .... 22 | oc delete all --all 23 | .... 24 | 25 | Verify that all the contents are gone by running `oc get all` 26 | 27 | *Step 2:* Add the Spring Boot image stream. 28 | 29 | We will use the image stream from the file 30 | link:[https://github.com/VeerMuchandi/openshift-springboot/blob/master/springboot-imagestream.json]. 31 | Please go through the contents of this file. 32 | 33 | .... 34 | { 35 | "kind": "ImageStream", 36 | "apiVersion": "v1", 37 | "metadata": { 38 | "name": "springboot" 39 | }, 40 | "spec": { 41 | "tags": [ 42 | { 43 | "name": "latest", 44 | "annotations": { 45 | "description": "Spring Boot S2I Image CentOS based", 46 | "iconClass": "icon-jboss", 47 | "tags": "builder,springboot,java,maven", 48 | "supports": "springboot,java:8,maven", 49 | "version": "1.0" 50 | }, 51 | "from": { 52 | "kind": "DockerImage", 53 | "name": "docker.io/veermuchandi/spring-mvn-base:latest" 54 | } 55 | } 56 | ] 57 | } 58 | } 59 | .... 60 | 61 | Notice, that this json points to the Spring Boot S2I builder Image on 62 | docker hub. Also note the tags used in this imagestream. The tag 63 | `builder` will display this in the catalog. 64 | 65 | You have two ways to add this to the catalog. 1. Add from command line 66 | 2. Add using the web console 67 | 68 | ''''' 69 | 70 | To add using CLI run the `oc create` command as under - 71 | 72 | .... 73 | $ oc create -f https://raw.githubusercontent.com/VeerMuchandi/openshift-springboot/master/springboot-imagestream.json 74 | imagestream "springboot" created 75 | .... 76 | 77 | Check by running `oc get is` 78 | 79 | You can also search your spring boot image by running the following 80 | command 81 | 82 | .... 83 | $ oc new-app --search springboot 84 | Image streams (oc new-app --image-stream= [--code=]) 85 | ----- 86 | springboot 87 | Project: springtest2 88 | Tags: latest 89 | .... 90 | 91 | ''''' 92 | 93 | To add using the web console, select `Add to Project`, and then 94 | `Import YAML/JSON` tab on the top. Then you can copy paste the above 95 | imagestream contents into the text box and press `Create` button. 96 | 97 | *Step 3* 98 | 99 | 100 | Now use that S2I image to deploy your sample spring boot application 101 | link:[https://github.com/RedHatWorkshops/spring-sample-app] on OpenShift 102 | using your experience from the previous labs. 103 | 104 | .... 105 | oc new-app springboot~https://github.com/RedHatWorkshops/spring-sample-app.git --name bootapp 106 | .... 107 | 108 | Congratulations!! you have learnt to make an image stream available in 109 | your project. 110 | 111 | *If you got a question in mind* - _Well how can I make this image 112 | available for everyone?_ Pat yourself on your back.. or ask your 113 | colleague to do it ;). You are thinking right. All you need to do is 114 | tell your openshift cluster administrator. + 115 | *Answer* The cluster administrator will add the image to the `openshift` 116 | project and everyone will start seeing it. 117 | 118 | link:0_toc.adoc[Table Of Contents] 119 | -------------------------------------------------------------------------------- /16-Using-ConfigMap-to-Inject-Application-Configuration.adoc: -------------------------------------------------------------------------------- 1 | [[using-configmap-to-inject-application-configuration]] 2 | Using ConfigMap to add a Backend Database configuration to the application 3 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | 5 | In this exercise we will add a backend database to the previous deployed 6 | SpringBoot application using ConfigMaps. 7 | 8 | If you already created the SpringBoot application in the previous lab 9 | link:14-Using-a-Custom-S2I-Image.adoc[deploy a spring 10 | boot application], just test one more thing (you may have to create a route for this service). Try your application url 11 | with `/dbtest` 12 | (http://bootapp-spring-UserName.apps.workshop.osecloud.com/dbtest 13 | *substitute* UserName) extension and it should list you some data from 14 | the HSQLDB configured within the same app. 15 | 16 | Let’s take a moment to understand how this application is connecting to 17 | the HSQLDB. Look at the `application.properties` file in the code 18 | https://github.com/RedHatWorkshops/spring-sample-app/blob/master/application.properties 19 | and we have configured these spring datasource variables to use hsqldb. 20 | 21 | .... 22 | spring.datasource.platform=hsqldb 23 | spring.datasource.url= jdbc:hsqldb:file:/opt/app-root/src/mydb;shutdown=true 24 | spring.datasource.username=user 25 | spring.datasource.password=password 26 | .... 27 | 28 | Of course, 29 | https://github.com/RedHatWorkshops/spring-sample-app/blob/master/pom.xml 30 | has the required dependencies. So springboot is able to create the in 31 | memory database. 32 | 33 | Where is the data coming from? See these two files: 34 | 35 | * https://github.com/RedHatWorkshops/spring-sample-app/blob/master/src/main/resources/schema-hsqldb.sql 36 | is creating the schema 37 | * https://github.com/RedHatWorkshops/spring-sample-app/blob/master/src/main/resources/data-hsqldb.sql 38 | is adding data. 39 | 40 | This is the data displayed when you invoke dbtest endpoint. Pretty 41 | straight forward.. isn’t it!! 42 | 43 | In this lab, we will deploy the same as a 2-tier application by adding a 44 | MySQL database running as a separate pod. 45 | 46 | *Step 1: Add a MySQL database to this project* 47 | 48 | Based on what you learnt in the previous labs, you know what to do!! 49 | 50 | Make sure you are in the `spring-UserName` project where your springboot 51 | application is running. Click on `Add to project` on your webconsole, 52 | select `MySQL Ephemeral` from the catalog and deploy it. When you are 53 | deploying this database you will have to choose the following values: 54 | 55 | *Database Service Name:* mysql + 56 | *MySQL Connection Username:* user + 57 | *MySQL Connection Password:* password + 58 | *MySQL Database Name:* sampledb 59 | 60 | _Feel free to use your own values, but make a note of the same_ (write 61 | down..we will need these) 62 | 63 | Click on the `Create` button and within a few min or two your MySQL 64 | database pod should be up and running. 65 | 66 | *Step 2: Configuring database connection params* 67 | 68 | The simplest way is to edit `application.properties` file to the values 69 | you noted in the last step i.e. 70 | 71 | .... 72 | spring.datasource.platform=mysql 73 | spring.datasource.url= jdbc:mysql://mysql.spring-UserName:3306/sampledb?useSSL=false 74 | spring.datasource.username=user 75 | spring.datasource.password=password 76 | .... 77 | 78 | But wait, that requires you to rebuild he code and deploy. 79 | 80 | So, is there another way?.. *Yes* Let’s use a `ConfigMap`. 81 | 82 | ConfigMaps allow you to keep the configuration artifacts decoupled from 83 | the image content. More details 84 | https://docs.openshift.com/container-platform/3.3/dev_guide/configmaps.html[here]. 85 | We will see use them here and understand their _flexibility_ in the next 86 | lab. 87 | 88 | Lets go to CLI. 89 | 90 | Change to `spring-UserName` project 91 | 92 | .... 93 | oc project spring-UserName 94 | .... 95 | 96 | Create a new file with name `application.properties` with the following 97 | content. 98 | 99 | .... 100 | spring.datasource.platform=mysql 101 | spring.datasource.url= jdbc:mysql://mysql.spring-UserName:3306/sampledb?useSSL=false 102 | spring.datasource.username=user 103 | spring.datasource.password=password 104 | .... 105 | 106 | You need to make sure that you substitute the correct values you noted 107 | in the last step when you wre creating the service. *Be extra-careful.. 108 | read instructions below.* 109 | 110 | Specifically note the datasource url. It is in the following format: 111 | 112 | `spring.datasource.url = jdbc:<>://<>:<>/<>?useSSL=false` 113 | 114 | You can replace `service-host` by the IP address of your MySQL service 115 | or the Service name. In the above example, I am using the service name 116 | for example `mysql.spring-user01`. Here `mysql` is the name of the 117 | service and `spring-user01` is the project name. This is a fully 118 | qualified way to let your application do service discovery in OpenShift 119 | (it uses SkyDNS). 120 | 121 | Now let’s create a ConfigMap with name `app-props` by running 122 | 123 | .... 124 | $ oc create configmap app-props --from-file=application.properties 125 | configmap "app-props" created 126 | .... 127 | 128 | Try a couple of more commands 129 | 130 | .... 131 | $ oc describe configmap app-props 132 | Name: app-props 133 | Namespace: spring-UserName 134 | Labels: 135 | Annotations: 136 | 137 | Data 138 | ==== 139 | application.properties: 328 bytes 140 | .... 141 | 142 | If you made a mistake you can always edit the ConfigMap using 143 | 144 | .... 145 | oc edit configmap app-props 146 | .... 147 | 148 | So far, we have created a ConfigMap in the project but your springboot 149 | application does not know how to use it. 150 | 151 | *Step 3: Edit Deployment Configuration* 152 | 153 | Now we will mount the ConfigMap so that the springboot application can 154 | use it. You can either edit from CLI or from WebConsole. 155 | 156 | * If using WebConsole, navigate to 157 | `Applications`->`Deployments`->`bootapp`. The screen should show 158 | Deployment Configuration details for the `bootapp` application. On the 159 | right top, choose `Actions` dropdown and `Edit YAML`. 160 | * If you are doing from CLI, you can run `oc edit dc bootapp` 161 | 162 | Scroll down to container spec, that looks like this: 163 | 164 | .... 165 | spec: 166 | containers: 167 | - 168 | name: bootapp 169 | image: '172.30.85.130:5000/spring-veer/bootapp@sha256:79e188d712e1209b933870c7d064423af281f16b371fb5e5911dfb09a6867776' 170 | ports: 171 | - 172 | containerPort: 8080 173 | protocol: TCP 174 | resources: 175 | terminationMessagePath: /dev/termination-log 176 | imagePullPolicy: Always 177 | restartPolicy: Always 178 | terminationGracePeriodSeconds: 30 179 | dnsPolicy: ClusterFirst 180 | securityContext: 181 | .... 182 | 183 | Note there could be multiple `spec`s in your DC. 184 | 185 | We will now add a volume that points to our ConfigMap right under 186 | `spec`. It is explained here 187 | https://docs.openshift.com/container-platform/3.3/dev_guide/configmaps.html#configmaps-use-case-consuming-in-volumes 188 | 189 | .... 190 | spec: 191 | volumes: 192 | - name: app-props-volume 193 | configMap: 194 | name: app-props 195 | .... 196 | 197 | *Be super-careful with indentation* 198 | 199 | We will now add `volumeMount` to mount the `volume` that we just added 200 | into the pod. It should be right under the container `name:` as shown 201 | below. 202 | 203 | .... 204 | containers: 205 | - 206 | name: bootapp 207 | volumeMounts: 208 | - name: app-props-volume 209 | mountPath: /opt/app-root/src/config 210 | .... 211 | 212 | *Be super-careful with indentation* 213 | 214 | After the changes, the `template` section in the dc, should now look 215 | like this 216 | 217 | .... 218 | template: 219 | metadata: 220 | creationTimestamp: null 221 | labels: 222 | app: bootapp 223 | deploymentconfig: bootapp 224 | spec: 225 | volumes: 226 | - name: app-props-volume 227 | configMap: 228 | name: app-props 229 | containers: 230 | - 231 | name: bootapp 232 | volumeMounts: 233 | - name: app-props-volume 234 | mountPath: /opt/app-root/src/config 235 | image: '172.30.85.130:5000/spring-veer/bootapp@sha256:79e188d712e1209b933870c7d064423af281f16b371fb5e5911dfb09a6867776' 236 | ports: 237 | - 238 | containerPort: 8080 239 | protocol: TCP 240 | resources: 241 | terminationMessagePath: /dev/termination-log 242 | imagePullPolicy: Always 243 | restartPolicy: Always 244 | terminationGracePeriodSeconds: 30 245 | dnsPolicy: ClusterFirst 246 | securityContext: 247 | .... 248 | 249 | Optional: you can run the following to do the update on the 250 | deploymentConfig: 251 | 252 | .... 253 | oc set volumes dc/bootapp --add -m /opt/app-root/src/config --configmap-name=app-props 254 | .... 255 | 256 | So what is this location `/opt/app-root/src/config`? 257 | 258 | If you get into the terminal of the pod (you should know how to do this 259 | by now!) and run `pwd`, it will show that the `home` directory is 260 | `/opt/app-root/src`. If you copy the `application.properties` file in 261 | the `config` folder, SpringBoot will pick that first. Hence we mounted 262 | the folder `/opt/app-root/src/config`. 263 | 264 | Save the changes and exit. If you now got the `Overview` page, you will 265 | see that the pod gets re-deployed. Yes, redeployed, not rebuilt (no S2I 266 | build process). 267 | 268 | *Step 4: Verify the changes* 269 | 270 | Once the deployment is complete + 271 | * click on the pod circle + 272 | * click on the pod name + 273 | * get into the `Terminal` tab + 274 | * verify that your `application.properties` are now available in the 275 | `config` folder 276 | 277 | .... 278 | sh-4.2$ ls config 279 | application.properties 280 | sh-4.2$ cat config/application.properties 281 | # replace your own values based on the database service you created 282 | # url = jdbc:mysql://<>:<>/<>?useSSL=false 283 | spring.datasource.platform=mysql 284 | spring.datasource.url= jdbc:mysql://mysql.spring-veer:3306/sampledb?useSSL=false 285 | spring.datasource.username=user 286 | spring.datasource.password=password 287 | .... 288 | 289 | Note the contents of this file are what you added to the ConfigMap. 290 | 291 | *Step 5: Test your application* 292 | 293 | Go back to the `Overview` page. Click on your application url which 294 | would be something like 295 | `http://bootapp-spring-UserName.apps.workshop.osecloud.com/` 296 | 297 | It will open a new tab and your running application will greet you 298 | 299 | `Hello from bootapp-2-06a4b` 300 | 301 | Now move back to your webconsole and watch the pod logs. You can also do 302 | this from CLI by running 303 | 304 | .... 305 | oc logs -f bootapp-2-06a4b 306 | .... 307 | 308 | Now access the application with the `/dbtest` extension - 309 | `http://bootapp-spring-UserName.apps.workshop.osecloud.com/dbtest` 310 | 311 | It should show the data from your MySQL database. 312 | 313 | .... 314 | Customers List 315 | 316 | 317 | CustomerId: 2 Customer Name: Joe Mysql Age: 88 318 | CustomerId: 3 Customer Name: Jack Mysql Age: 54 319 | CustomerId: 4 Customer Name: Ann Mysql Age: 32 320 | .... 321 | 322 | Where did this data come from? Look at * 323 | https://github.com/RedHatWorkshops/spring-sample-app/blob/master/src/main/resources/schema-mysql.sql 324 | was used to initialize the MySQL database * 325 | https://github.com/RedHatWorkshops/spring-sample-app/blob/master/src/main/resources/data-mysql.sql 326 | was used to populate data. I added `Mysql' as part of the names to make 327 | it easy ;) 328 | 329 | Also note that your logs show the connection url, just to verify which 330 | database you are connecting to. 331 | 332 | .... 333 | connection url: jdbc:mysql://mysql.spring-UserName:3306/sampledb?useSSL=false 334 | ..... 335 | 336 | *Bonus Points:* Log into the MySQL instance and verify the data in the 337 | customer table for extra points!! 338 | 339 | In this lab exercise, you have learnt how to set up a multi-tiered 340 | application and also to pass configuration information using ConfigMaps. 341 | In the next lab, we will learn to use ConfigMaps to dynamically update 342 | the configuration without restarting the pod!! 343 | 344 | link:0_toc.adoc[Table Of Contents] 345 | -------------------------------------------------------------------------------- /17-Dynamic-Configuration-Updates-using-ConfigMap.adoc: -------------------------------------------------------------------------------- 1 | [[dynamic-configuration-updates-using-configmap]] 2 | Dynamic configuration updates using ConfigMap 3 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | 5 | In this lab, we will learn how to dynamically update this configuration 6 | in a running pod. We will do this with an example by changing the 7 | database connection to use a PostgreSQL database. 8 | 9 | In the last 10 | link:16.%20Adding%20database%20to%20your%20Spring%20Boot%20Application.md[lab], 11 | we created a configuration to connect to the MySQL database by mounting 12 | `application.properties` file using ConfigMap. 13 | 14 | *Step 1: Create PostgreSQL Pod* 15 | 16 | Ensure you are in the `spring-UserName` project. *Substitute UserName 17 | with your own userid* 18 | 19 | Based on what you have learnt in the previous labs, create a new 20 | Postgresql database pod i.e. `Add to project`, search for `postgresql`, 21 | choose `postgresql-ephemeral`. You will need to key in the following 22 | values. 23 | 24 | *Database Service Name:* postgresql + 25 | *MySQL Connection Username:* user + 26 | *MySQL Connection Password:* password + 27 | *MySQL Database Name:* sampledb 28 | 29 | _Feel free to use your own values, but make a note of the same_ (write 30 | down..we will need these) 31 | 32 | *Step 2: Add data to the database* 33 | 34 | While the code has `schema-postgresql.sql` and `data-postgresql.sql` 35 | files, these scripts will only be executed if the pod restarts. Since we 36 | are going to use this database without restarting the bootapp pod, we 37 | will add the data manually. 38 | 39 | Select the `postgresql` pod and navigate to the `terminal`. 40 | 41 | Login to the database from CLI 42 | 43 | .... 44 | psql -h 127.0.0.1 -U $POSTGRESQL_USER -q -d $POSTGRESQL_DATABASE 45 | .... 46 | 47 | This will log you into the psql CLI. 48 | 49 | Now create the table using the script 50 | 51 | .... 52 | CREATE TABLE IF NOT EXISTS customer ( 53 | CUST_ID serial primary key, 54 | NAME varchar(100) NOT NULL, 55 | AGE integer NOT NULL); 56 | .... 57 | 58 | and then add some data as shown below. You can change the values if you 59 | wish. 60 | 61 | .... 62 | insert into customer (name,age) values ('Joe Psql', 88); 63 | insert into customer (name,age) values ('Jack Psql', 54); 64 | insert into customer (name,age) values ('Ann Psql', 32); 65 | .... 66 | 67 | These scripts are available here - 68 | https://github.com/RedHatWorkshops/spring-sample-app/blob/master/src/main/resources/schema-postgresql.sql 69 | 70 | https://github.com/RedHatWorkshops/spring-sample-app/blob/master/src/main/resources/data-postgresql.sql 71 | 72 | Here is how I added the data in the terminal 73 | 74 | .... 75 | sh-4.2$ psql -h 127.0.0.1 -U $POSTGRESQL_USER -q -d $POSTGRESQL_DATABASE 76 | sampledb=> CREATE TABLE IF NOT EXISTS customer ( 77 | sampledb(> CUST_ID serial primary key, 78 | sampledb(> NAME varchar(100) NOT NULL, 79 | sampledb(> AGE integer NOT NULL); 80 | sampledb=> insert into customer (name,age) values ('Joe Psql', 88); 81 | sampledb=> insert into customer (name,age) values ('Jack Psql', 54); 82 | sampledb=> insert into customer (name,age) values ('Ann Psql', 32); 83 | sampledb=> select * from customer; 84 | cust_id | name | age 85 | ---------+-----------+----- 86 | 1 | Joe Psql | 88 87 | 2 | Jack Psql | 54 88 | 3 | Ann Psql | 32 89 | (3 rows) 90 | 91 | sampledb=> \q 92 | .... 93 | 94 | *Step 3: Update ConfigMap* 95 | 96 | Now let us update the ConfigMap to change the `application.properties` 97 | to point to `postgresql` datasource. 98 | 99 | Using CLI run the following command after you ensure you are in the 100 | `spring-UserName` project 101 | 102 | .... 103 | $ oc edit configmap app-props 104 | .... 105 | 106 | Edit the datasource parameters as below 107 | 108 | .... 109 | spring.datasource.platform=postgresql 110 | spring.datasource.url= jdbc:postgresql://postgresql.spring-UserName:5432/sampledb 111 | spring.datasource.username=user 112 | spring.datasource.password=password 113 | .... 114 | 115 | *Do this slowly. Double check every parameter* 116 | 117 | Specifically note the `spring.datasource.url`. It is in the following 118 | format: 119 | 120 | `spring.datasource.url = jdbc:<>://<>:<>/<>` 121 | 122 | Here 123 | 124 | * databasetype is `postgresql` + 125 | * service-host can be ip-address of the service or the service name. 126 | Above, it is configured as service-name.projectname. This is the fully 127 | qualified service name discoverable by kubernetes. Kubernetes uses 128 | SkyDNS. + 129 | * service-port for postgresql is `5432` 130 | 131 | *Note* that this change does not redeploy the pod. You can check the pod 132 | details to see how long the pod has been running for. 133 | 134 | Now verify the `application.properties` inside the pod (Go to bootapp 135 | pod terminal on the Web Console or use oc rsh) . You will note that the 136 | `application.properties` file is now updated as a result of updating the 137 | ConfigMap. 138 | 139 | .... 140 | sh-4.2$ cat config/application.properties 141 | spring.datasource.platform=postgresql 142 | spring.datasource.url= jdbc:postgresql://postgresql.spring-veer:5432/sampledb 143 | spring.datasource.username=user 144 | spring.datasource.password=password 145 | .... 146 | 147 | *Step 4: Test the application connection* 148 | 149 | Click the application url now i.e 150 | `http://bootapp-spring-UserName.apps.workshop.osecloud.com/`. It will open 151 | a new tab and greets you 152 | 153 | .... 154 | Hello from bootapp-2-06a4b 155 | .... 156 | 157 | Also watch the pod logs either using web console or using CLI. For 158 | example `oc logs -f bootapp-2-06a4b` Watch out for connection url in the 159 | output. 160 | 161 | Now try the `/dbtest` endpoint i.e. 162 | `http://bootapp-spring-veer.apps.workshop.osecloud.com/dbtest`. 163 | 164 | *Note* that the output is still from the MySQLDB. 165 | 166 | .... 167 | Customers List 168 | 169 | 170 | CustomerId: 2 Customer Name: Joe Mysql Age: 88 171 | CustomerId: 3 Customer Name: Jack Mysql Age: 54 172 | CustomerId: 4 Customer Name: Ann Mysql Age: 32 173 | .... 174 | 175 | Also the pod logs show that connection url is 176 | 177 | .... 178 | connection url: jdbc:mysql://mysql.spring-veer:3306/sampledb?useSSL=false 179 | .... 180 | 181 | So even after the `application.properties` file is updated in the pod, 182 | it is not picked up. The reason is that springboot app caches the 183 | environment variables. This application has a `@RefreshScope` 184 | annotation. So we can invoke `/refresh` endpoint to refresh the cache. 185 | Run the following command from CLI to refresh the cache. 186 | 187 | .... 188 | $ curl -X POST http://bootapp-spring-veer.apps.workshop.osecloud.com/refresh 189 | ["spring.datasource.url","spring.datasource.platform"] 190 | .... 191 | 192 | Now note that the pod logs show that the application context is 193 | refreshed. 194 | 195 | .... 196 | 2016-11-18 04:25:35.601 INFO 10 --- [io-8080-exec-10] s.c.a.AnnotationConfigApplicationContext : Refreshing 197 | .... 198 | 199 | Now try the `/dbtest` endpoint again. Now the result will show the data 200 | from the postgresql database. 201 | 202 | .... 203 | Customers List 204 | 205 | 206 | CustomerId: 1 Customer Name: Joe Psql Age: 88 207 | CustomerId: 2 Customer Name: Jack Psql Age: 54 208 | CustomerId: 3 Customer Name: Ann Psql Age: 32 209 | .... 210 | 211 | Also note the logs will show the connection url as 212 | 213 | .... 214 | connection url: jdbc:postgresql://postgresql.spring-UserName:5432/sampledb 215 | .... 216 | 217 | *Note* in this exercise, the pod was never redeployed. The 218 | application.properties were dynamically updated. 219 | 220 | *Summary:* In this lab, we have learnt the ConfigMap’s flexibility and 221 | how it allows dynamic updates to the pod configuration. 222 | 223 | link:0_toc.adoc[Table Of Contents] 224 | -------------------------------------------------------------------------------- /18-Changing-code-on-the-fly.adoc: -------------------------------------------------------------------------------- 1 | [[changing-code-on-the-fly]] 2 | Changing code on the fly 3 | ~~~~~~~~~~~~~~~~~~~~~~~~ 4 | 5 | In this lab, we will learn how to make changes to the code on the local 6 | machine and immediately sync it with the code running in a pod. 7 | 8 | *Note:* This model of programming is useful for interpreted languages. 9 | 10 | *Prerequisite:* This lab assumes that you have git installed on your box 11 | 12 | *Step 1: Create a new project* + 13 | Create a new project on the OpenShift cluster with name 14 | `synccode-UserName`. *Note* Substitute the `UserName` with your `userId` 15 | 16 | *Step 2: Clone the git repository locally* Clone the following git 17 | repository to your workstation. 18 | https://github.com/VeerMuchandi/nodejs-hello using the command 19 | 20 | .... 21 | $ git clone https://github.com/VeerMuchandi/nodejs-hello 22 | .... 23 | 24 | This is a very simple nodejs application. Feel free to understand the 25 | code. 26 | 27 | *Step 3: Create the application* 28 | 29 | Change to the `nodejs-hello` folder. 30 | 31 | .... 32 | $ cd nodejs-hello 33 | .... 34 | 35 | Now let us create an application using this code. 36 | 37 | .... 38 | $ oc new-app . --image-stream=nodejs:4 39 | --> Found image 448a51d (11 weeks old) in image stream "nodejs" in project "openshift" under tag "4" for "nodejs" 40 | 41 | Node.js 4 42 | --------- 43 | Platform for building and running Node.js 4 applications 44 | 45 | Tags: builder, nodejs, nodejs4 46 | 47 | * The source repository appears to match: nodejs 48 | * A source build using source code from https://github.com/VeerMuchandi/nodejs-hello.git#master will be created 49 | * The resulting image will be pushed to image stream "nodejs-hello:latest" 50 | * Use 'start-build' to trigger a new build 51 | * This image will be deployed in deployment config "nodejs-hello" 52 | * Port 8080/tcp will be load balanced by service "nodejs-hello" 53 | * Other containers can access this service through the hostname "nodejs-hello" 54 | 55 | --> Creating resources with label app=nodejs-hello ... 56 | imagestream "nodejs-hello" created 57 | buildconfig "nodejs-hello" created 58 | deploymentconfig "nodejs-hello" created 59 | service "nodejs-hello" created 60 | --> Success 61 | Build scheduled, use 'oc logs -f bc/nodejs-hello' to track its progress. 62 | Run 'oc status' to view your app. 63 | .... 64 | 65 | Create a route 66 | 67 | .... 68 | $ oc expose service nodejs-hello 69 | route "nodejs-hello" exposed 70 | .... 71 | 72 | Wait for the build to complete and test the application 73 | 74 | .... 75 | $ oc get route 76 | NAME HOST/PORT PATH SERVICES PORT TERMINATION 77 | nodejs-hello nodejs-hello-rsync-UserName.apps.workshop.osecloud.com nodejs-hello 8080-tcp 78 | .... 79 | 80 | .... 81 | $ $ curl nodejs-hello-rsync-UserName.apps.workshop.osecloud.com 82 | Welcome to OpenShift!! My HostName is: nodejs-hello-1-8qigc 83 | .... 84 | 85 | *Step 4: Make code changes and sync with rsync* 86 | 87 | Let us now make a small change to the application on your workstation. 88 | 89 | Edit `server.js` file using your favorite text editor (I use vi). The 90 | code snippet below displays the welcome message 91 | 92 | .... 93 | app.get('/', function (req, res) { 94 | res.send('Welcome to OpenShift!! My HostName is: ' + os.hostname() + '\n'); 95 | }); 96 | .... 97 | 98 | Let us make a small change to insert a `\n` character after the welcome 99 | message so that the hostname is displayed on a different line. The 100 | edited code should look like this. 101 | 102 | .... 103 | app.get('/', function (req, res) { 104 | res.send('Welcome to OpenShift!! \n My HostName is: ' + os.hostname() + '\n'); 105 | }); 106 | .... 107 | 108 | Run `oc get pods` to get your application pod name as shown below: 109 | 110 | .... 111 | $ oc get pods 112 | NAME READY STATUS RESTARTS AGE 113 | nodejs-hello-1-8qigc 1/1 Running 0 8m 114 | nodejs-hello-1-build 0/1 Completed 0 9m 115 | .... 116 | 117 | Use `oc rsync` to sync the code from the local workstation to the pod as 118 | shown below 119 | 120 | .... 121 | $ oc rsync . nodejs-hello-1-8qigc:/opt/app-root/src --no-perms=true --exclude=.git 122 | building file list ... done 123 | 124 | sent 89 bytes received 20 bytes 2.29 bytes/sec 125 | total size is 805 speedup is 7.39 126 | .... 127 | 128 | The command above will copy the code from the local machine to the pod. 129 | Note that + 130 | * `/opt/app-root/src` is the default home location on the pod + 131 | * `--exclude=.git` will omit the hidden git folder 132 | 133 | Now test the application again. This time it should show the output in 134 | two lines as below: 135 | 136 | .... 137 | $ curl nodejs-hello-rsync-veer.apps.workshop.osecloud.com 138 | Welcome to OpenShift!! 139 | My HostName is: nodejs-hello-1-8qigc 140 | .... 141 | 142 | Note that pod did not restart, we did not have to check into git repo 143 | and rebuild the image. The changes moved from your workstation directly 144 | to the pod. 145 | 146 | Developers can use this mechanism to quickly test the changes on the 147 | fly. When ready they can commit the changes to the source control 148 | repository. 149 | 150 | You can repeat a few more changes and enjoy the rsync!!! 151 | 152 | link:0_toc.adoc[Table Of Contents] 153 | -------------------------------------------------------------------------------- /19-Creating-a-Pipeline.adoc: -------------------------------------------------------------------------------- 1 | [[creating-a-pipeline]] 2 | Creating a Pipeline 3 | ~~~~~~~~~~~~~~~~~~~ 4 | 5 | In this lab, we will learn to create a build pipeline on OpenShift. This 6 | pipeline will be setup using Jenkins running as an application pod on 7 | OpenShift. The pipeline running on Jenkins will trigger builds and 8 | deployments on OpenShift. 9 | 10 | *Prerequisites:* 11 | 12 | * You need a github account if you want to make changes and test the pipeline kick-off. 13 | * You will be using the projects you created in the "Promoting Applications" lab. 14 | 15 | *Step 1:* Create a new project Create a new project with name 16 | `pipeline-UserName`. _Substitute UserName with your own user name._ 17 | 18 | *Step 2:* Deploy your CI/CD tool (Jenkins) 19 | 20 | Click on `Add to Project` on the Web console, and navigate to 21 | `Import YAML / JSON` tab. 22 | 23 | In the text box with heading 24 | `Upload file by dragging & dropping, selecting it, or pasting from the clipboard`, 25 | copy and paste the Build Configuration the following Build Configuration 26 | and press on `Create`. 27 | 28 | .... 29 | apiVersion: v1 30 | kind: BuildConfig 31 | metadata: 32 | name: myfirstpipeline 33 | labels: 34 | name: myfirstpipeline 35 | annotations: 36 | pipeline.alpha.openshift.io/uses: '[{"name": "myphp", "namespace": "", "kind": "DeploymentConfig"}]' 37 | spec: 38 | triggers: 39 | - 40 | type: GitHub 41 | github: 42 | secret: secret101 43 | - 44 | type: Generic 45 | generic: 46 | secret: secret101 47 | runPolicy: Serial 48 | source: 49 | type: None 50 | strategy: 51 | type: JenkinsPipeline 52 | jenkinsPipelineStrategy: 53 | jenkinsfile: "node() {\nstage 'build'\nopenshiftBuild(buildConfig: 'myphp', showBuildLogs: 'true')\nstage 'deploy'\nopenshiftDeploy(deploymentConfig: 'myphp')\nopenshiftScale(deploymentConfig: 'myphp',replicaCount: '2')\n}" 54 | output: 55 | resources: 56 | postCommit: 57 | .... 58 | 59 | Note that the build configuration uses `JenkinsPipelineStrategy`. Also 60 | the `spec.strategy.jenkinsPipelineStrategy.jenkinsfile` is the actual 61 | pipeline that runs. We will discuss that in the next step. 62 | 63 | This will spin up a Jenkins pod. Give it a few minutes as it takes time 64 | to download and deploy jenkins. You will also see the URL assigned to 65 | your Jenkins. It would be something like 66 | `https://jenkins-pipeline-UserName.apps.workshop.osecloud.com` 67 | 68 | If you click on that URL, you will be taken to Jenkins Console. *Note:* 69 | The browser may complain that the URL is insecure. Click on advanced and 70 | proceed to url. 71 | 72 | At the next step, choose `Login with OpenShift` and enter your openshift 73 | credentials to login. 74 | 75 | On the next screen, allow all `Requested Permissions` 76 | 77 | Now you will be taken to Jenkins console (that is running on OpenShift). 78 | 79 | *Step 3:* Updating the pipeline 80 | 81 | Using left menu on the Web Console, select `Builds`->`Pipelines`. You 82 | will see that `myfirstpipeline` is created. Click on that. 83 | 84 | Since we haven’t run the pipeline yet, the `History` tab shows nothing. 85 | If you click on the `Configuration` tab, you will see the build 86 | configuration details. 87 | 88 | *Note* There are webhook urls on this page. We will come back to this 89 | and use after a couple of steps. 90 | 91 | On the top right hand side click on `Actions` -> `Edit`. This will bring 92 | you to the editing page. Replace the current content with the following. 93 | 94 | .... 95 | node('maven') { 96 | stage 'buildInDevelopment' 97 | openshiftBuild(namespace: 'development-UserName', buildConfig: 'welcome-php', showBuildLogs: 'true') 98 | stage 'deployInDevelopment' 99 | openshiftDeploy(namespace: 'development-UserName', deploymentConfig: 'welcome-php') 100 | openshiftScale(namespace: 'development-UserName', deploymentConfig: 'welcome-php',replicaCount: '2') 101 | stage 'deployInTesting' 102 | input 'Promote Dev Image to Testing?' 103 | openshiftTag(namespace: 'development-UserName', sourceStream: 'welcome-php', sourceTag: 'latest', destinationStream: 'welcome-php', destinationTag: 'promote-qa') 104 | openshiftDeploy(namespace: 'testing-UserName', deploymentConfig: 'welcome-php', ) 105 | openshiftScale(namespace: 'testing-UserName', deploymentConfig: 'welcome-php',replicaCount: '3') 106 | } 107 | .... 108 | 109 | And click `Save`. (Make sure you change the values according to your configuration) 110 | 111 | Review these `Jenkinsfile` changes on this page. 112 | * It has two stages `build` and `deploy` 113 | * In the build stage the `openshiftBuild` plugin is used to trigger a build named `welcome-php` 114 | * In the deploy stage the `openshiftDeploy` plugin invokes a deployment configuration `welcome-php` and then invokes `openshiftScale` plugin to scale up the same deployment configuration to 2 replicas. 115 | 116 | *Step 4:* Permissions and Configuration Changes 117 | 118 | The Jenkins user in the jenkins project you created needs 119 | to have access to the projects `development-UserName` and 120 | `testing-UserName`. Just for testing; we will give jenkins 121 | full access to these projects. 122 | 123 | .... 124 | oc project jenkins-UserName 125 | oc adm policy add-role-to-user admin system:serviceaccount:pipeline-UserName:jenkins -n testing-UserName 126 | oc adm policy add-role-to-user admin system:serviceaccount:pipeline-UserName:jenkins -n development-UserName 127 | .... 128 | 129 | For reference the syntax is: `system:serviceaccount:PROJECTNAME:SERVICEACCOUNT` 130 | 131 | Next, we will edit the `development-UserName` project to disable 132 | the deployment triggers. 133 | 134 | Using the left-side navigation; go to `Application` -> `Deployments`. On the overview 135 | page click on your build to see your deployment history page. 136 | 137 | Click on the `Actions` -> `Edit` on the upper right hand side to go into 138 | the `Configuration` page for your deployment. 139 | 140 | Untick the following boxes: 141 | 142 | * `Automatically start a new deployment when the image changes` 143 | * `Automatically start a new deployment when the deployment configuration changes` 144 | 145 | Click "Save" and in the end, the config should look like this. 146 | 147 | image::images/disable-triggers1.png[image] 148 | 149 | 150 | 151 | Do the same steps for the `testing-UserName` project. It should 152 | look similar. 153 | 154 | image::images/disable-triggers2.png[image] 155 | 156 | 157 | *Step 5:* Start pipeline 158 | Change Project to pipeline-Username 159 | Build --> Pipelines 160 | Now click on the `Start Pipeline` button to start the pipeline. 161 | 162 | image::images/pipeline2.jpeg[image] 163 | 164 | Notice the pipeline starts and `build` and `deploy` stages are executed. 165 | 166 | image::images/pipeine3.jpeg[image] 167 | 168 | Click on the `View log` link for the pipeline. It’ll take you to Jenkins 169 | and show the logs. 170 | 171 | In a couple of minutes, the `build` and `deploy` will complete, and your 172 | application will be deployed and scaled to 2 replicas. Now use the 173 | application to notice that the `blue` box is displayed. 174 | 175 | *Step 6:* Configure webhook and trigger with changes (optional) 176 | 177 | Navigate back to the `configuration` tab for the pipeline as explained 178 | in Step 3. Copy the value for `Github webhook` url 179 | Since development-User uses git repo from https://github.com/RedHatWorkshops/welcome-php), 180 | you will need to fork this repo and update the development configure to use the forked repo. 181 | 182 | Based on what you learn in the past, go to your github repository that 183 | you cloned and set up a webhook pointing to this URL. 184 | 185 | *Tips* 186 | 187 | * Navigate to `Settings` -> `Webhooks` on your project in github 188 | * Set the `Payload URL` to `Github Webhook` URL noted above 189 | * Make sure the `Content Type` is set to `application/json` 190 | * Press on `Disable SSL` 191 | * Press on `Add Webhook` 192 | 193 | Now edit the one of the file in your repo and `Commit` changes. 194 | Pipeline build will be triggered. 195 | 196 | Come back and watch the Web Console, you will notice that a new build 197 | has just started. Once the build completes, you will also see the 198 | rolling deployment of the pods. 199 | 200 | *Bonus Points*: Watch the videos here 201 | https://blog.openshift.com/create-build-pipelines-openshift-3-3/ and 202 | understand how to create a pipeline that goes across multiple projects. 203 | 204 | Congratulations!! In this lab, you have learnt how to set up and run 205 | your own CI/CD pipeline on OpenShift. 206 | 207 | link:0_toc.adoc[Table Of Contents] 208 | -------------------------------------------------------------------------------- /2-Create-App-Using-Docker-Build.adoc: -------------------------------------------------------------------------------- 1 | [[create-an-app-using-docker-build]] 2 | Create an App using Docker build 3 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | 5 | In this exercise we will learn how to create an application from a 6 | Dockerfile. OpenShift takes Dockerfile as an input and generates your 7 | application docker image for you. 8 | 9 | *Step 1: Create a project or use an existing project* 10 | 11 | If you want to, you can create a new project based on what you have 12 | learned in the previous lab. Since we already have a project we will use 13 | it. Run the following command to make sure. *Remember* to substitute 14 | UserName with your username. 15 | 16 | .... 17 | $ oc project mycliproject-UserName 18 | .... 19 | 20 | *Step 2: Create an application that uses docker file* 21 | 22 | This time we will use a project that has a Dockerfile in a source code 23 | repository. We will use a simple project on github 24 | (https://github.com/RedHatWorkshops/time). The `rhel` folder from this github 25 | project is built starting with rhel7 as the base image which is 26 | described in Dockerfile. Look at the Dockerfile for this project. It 27 | starts off with `registry.access.redhat.com/rhel7` image. It copies the 28 | source code which is a simple `init.sh` file and exposes port `8080`. 29 | Look at the `init.sh` that just displays the current datetime. There is 30 | also a PHP version of the same project available in the php folder if 31 | you like to use that. The php version does exactly the same it has a 32 | `time.php` file that displays the time. 33 | 34 | *Docker Build*: When OpenShift finds a Dockerfile in the source, it uses 35 | this Dockerfile as the basis to create a docker image for your 36 | application. This strategy is called `Docker Build` strategy on 37 | OpenShift. We’ll see more about it when we look at the build 38 | configuration a couple of steps down the line. Once OpenShift builds the 39 | application’s docker image, it stores that in a local docker registry. 40 | Later it uses this image to deploy an application that runs in a pod. 41 | 42 | Now let’s create an application using this approach. We will run 43 | `oc new-app` command by supplying the git uri as the parameter. 44 | 45 | .... 46 | $ oc new-app https://github.com/RedHatWorkshops/time --context-dir=rhel 47 | 48 | --> Found Docker image 1d309a6 (6 weeks old) from registry.access.redhat.com for "registry.access.redhat.com/rhel7" 49 | 50 | * An image stream will be created as "rhel7:latest" that will track the source image 51 | * A Docker build using source code from https://github.com/RedHatWorkshops/time will be created 52 | * The resulting image will be pushed to image stream "time:latest" 53 | * Every time "rhel7:latest" changes a new build will be triggered 54 | * This image will be deployed in deployment config "time" 55 | * Port 8080 will be load balanced by service "time" 56 | * Other containers can access this service through the hostname "time" 57 | * WARNING: Image "registry.access.redhat.com/rhel7" runs as the 'root' user which may not be permitted by your cluster administrator 58 | 59 | --> Creating resources with label app=time ... 60 | imagestream "rhel7" created 61 | imagestream "time" created 62 | buildconfig "time" created 63 | deploymentconfig "time" created 64 | service "time" created 65 | --> Success 66 | Build scheduled, use 'oc logs -f bc/time' to track its progress. 67 | Run 'oc status' to view your app. 68 | .... 69 | 70 | You’ll notice that OpenShift created a few things at this point. You 71 | will find a buildconfig, deploymentconfig, service and imagestreams in 72 | the above list. The application is not running yet. It needs to be built 73 | and deployed. Within a minute or so, you will see that OpenShift starts 74 | the build. 75 | 76 | *Step 3: Build* 77 | 78 | In the meanwhile lets have a look at the buildconfig by running the 79 | command shown below. 80 | 81 | .... 82 | $ oc get bc time -o json 83 | 84 | { 85 | "kind": "BuildConfig", 86 | "apiVersion": "v1", 87 | "metadata": { 88 | "name": "time", 89 | "namespace": "mycliproject-user10", 90 | "selfLink": "/oapi/v1/namespaces/mycliproject-admin/buildconfigs/time", 91 | "uid": "ac4beccd-9569-11e6-ad4c-000d3af733e4", 92 | "resourceVersion": "134692", 93 | "creationTimestamp": "2016-10-18T19:32:57Z", 94 | "labels": { 95 | "app": "time" 96 | }, 97 | "annotations": { 98 | "openshift.io/generated-by": "OpenShiftNewApp" 99 | } 100 | }, 101 | "spec": { 102 | "triggers": [ 103 | { 104 | "type": "GitHub", 105 | "github": { 106 | "secret": "1pOQJ1G5tr6M70CQ5779" 107 | } 108 | }, 109 | { 110 | "type": "Generic", 111 | "generic": { 112 | "secret": "Bge9C-De7rm9PPDG_EQR" 113 | } 114 | }, 115 | { 116 | "type": "ConfigChange" 117 | }, 118 | { 119 | "type": "ImageChange", 120 | "imageChange": { 121 | "lastTriggeredImageID": "registry.access.redhat.com/rhel7@sha256:eac2421be7a6844a5c83b8f394d1f5f121b18fa4e455c5f09be940e0384a1d97" 122 | } 123 | } 124 | ], 125 | "runPolicy": "Serial", 126 | "source": { 127 | "type": "Git", 128 | "git": { 129 | "uri": "https://github.com/RedHatWorkshops/time" 130 | }, 131 | "contextDir": "rhel" 132 | }, 133 | "strategy": { 134 | "type": "Docker", 135 | "dockerStrategy": { 136 | "from": { 137 | "kind": "ImageStreamTag", 138 | "name": "rhel7:latest" 139 | } 140 | } 141 | }, 142 | "output": { 143 | "to": { 144 | "kind": "ImageStreamTag", 145 | "name": "time:latest" 146 | } 147 | }, 148 | "resources": {}, 149 | "postCommit": {} 150 | }, 151 | "status": { 152 | "lastVersion": 1 153 | } 154 | } 155 | .... 156 | 157 | Note the name of the buildconfig in metadata is set to `time`, the git 158 | uri pointing to the value you gave while creating the application. Also 159 | note the Strategy.type set to `Docker`. This indicates that the build 160 | will use the instructions in this Dockerfile to do the docker build. 161 | 162 | Build starts in a minute or so. You can view the list of builds using 163 | `oc get builds` command. You can also start the build using 164 | `oc start-build time` where ``time'' is the name we noticed in the 165 | buildconfig. 166 | 167 | .... 168 | $ oc get builds 169 | NAME TYPE FROM STATUS STARTED DURATION 170 | time-1 Docker Git@1ec2d66 Complete 19 minutes ago 1m13s 171 | .... 172 | 173 | Note the name of the build that is running i.e. time-1. We will use that 174 | name to look at the build logs. Run the command as shown below to look 175 | at the build logs. This will run for a few mins. At the end you will 176 | notice that the docker image is successfully created and it will start 177 | pushing this to OpenShift’s internal docker registry. 178 | 179 | .... 180 | $ oc logs build/time-1 181 | 182 | 183 | Successfully built 492e4a3bf772 184 | Pushing image docker-registry.default.svc:5000/mycliproject-user02/time:latest ... 185 | Pushed 0/5 layers, 60% complete 186 | Pushed 1/5 layers, 60% complete 187 | Pushed 2/5 layers, 63% complete 188 | Pushed 3/5 layers, 62% complete 189 | Pushed 4/5 layers, 80% complete 190 | Pushed 5/5 layers, 100% complete 191 | Push successful 192 | .... 193 | 194 | In the above log note how the image is pushed to the local docker 195 | registry. The registry is running at `docker-registry.default.svc` at port `5000`. 196 | 197 | *_Step 4: Deployment_* 198 | 199 | Once the image is pushed to the docker registry, OpenShift will trigger 200 | a deploy process. Let us also quickly look at the deployment 201 | configuration by running the following command. Note dc represents 202 | deploymentconfig. 203 | 204 | .... 205 | $ oc get dc -o json 206 | 207 | { 208 | "apiVersion": "v1", 209 | "items": [ 210 | { 211 | "apiVersion": "v1", 212 | "kind": "DeploymentConfig", 213 | "metadata": { 214 | "annotations": { 215 | "openshift.io/generated-by": "OpenShiftNewApp" 216 | }, 217 | "creationTimestamp": "2018-01-15T18:07:34Z", 218 | "generation": 2, 219 | "labels": { 220 | "app": "time" 221 | }, 222 | "name": "time", 223 | "namespace": "mycliproject-user02", 224 | "resourceVersion": "37867345", 225 | "selfLink": "/oapi/v1/namespaces/mycliproject-user02/deploymentconfigs/time", 226 | "uid": "f63997bb-fa1e-11e7-9e8e-06d3bdd62498" 227 | }, 228 | "spec": { 229 | "replicas": 1, 230 | "revisionHistoryLimit": 10, 231 | "selector": { 232 | "app": "time", 233 | "deploymentconfig": "time" 234 | }, 235 | "strategy": { 236 | "activeDeadlineSeconds": 21600, 237 | "resources": {}, 238 | "rollingParams": { 239 | "intervalSeconds": 1, 240 | "maxSurge": "25%", 241 | "maxUnavailable": "25%", 242 | "timeoutSeconds": 600, 243 | "updatePeriodSeconds": 1 244 | }, 245 | "type": "Rolling" 246 | }, 247 | "template": { 248 | "metadata": { 249 | "annotations": { 250 | "openshift.io/generated-by": "OpenShiftNewApp" 251 | }, 252 | "creationTimestamp": null, 253 | "labels": { 254 | "app": "time", 255 | "deploymentconfig": "time" 256 | } 257 | }, 258 | "spec": { 259 | "containers": [ 260 | { 261 | "image": "docker-registry.default.svc:5000/mycliproject-user02/time@sha256:a8f34cc98aba4a68d3566f3ea387295f7a2945347ffc7794246cd8a89b556706", 262 | "imagePullPolicy": "Always", 263 | "name": "time", 264 | "ports": [ 265 | { 266 | "containerPort": 8080, 267 | "protocol": "TCP" 268 | } 269 | ], 270 | "resources": {}, 271 | "terminationMessagePath": "/dev/termination-log", 272 | "terminationMessagePolicy": "File" 273 | } 274 | ], 275 | "dnsPolicy": "ClusterFirst", 276 | "restartPolicy": "Always", 277 | "schedulerName": "default-scheduler", 278 | "securityContext": {}, 279 | "terminationGracePeriodSeconds": 30 280 | } 281 | }, 282 | "test": false, 283 | "triggers": [ 284 | { 285 | "type": "ConfigChange" 286 | }, 287 | { 288 | "imageChangeParams": { 289 | "automatic": true, 290 | "containerNames": [ 291 | "time" 292 | ], 293 | "from": { 294 | "kind": "ImageStreamTag", 295 | "name": "time:latest", 296 | "namespace": "mycliproject-user02" 297 | }, 298 | "lastTriggeredImage": "docker-registry.default.svc:5000/mycliproject-user02/time@sha256:a8f34cc98aba4a68d3566f3ea387295f7a2945347ffc7794246cd8a89b556706" 299 | }, 300 | "type": "ImageChange" 301 | } 302 | ] 303 | }, 304 | "status": { 305 | "availableReplicas": 1, 306 | "conditions": [ 307 | { 308 | "lastTransitionTime": "2018-01-15T18:08:51Z", 309 | "lastUpdateTime": "2018-01-15T18:08:51Z", 310 | "message": "Deployment config has minimum availability.", 311 | "status": "True", 312 | "type": "Available" 313 | }, 314 | { 315 | "lastTransitionTime": "2018-01-15T18:08:49Z", 316 | "lastUpdateTime": "2018-01-15T18:08:52Z", 317 | "message": "replication controller \"time-1\" successfully rolled out", 318 | "reason": "NewReplicationControllerAvailable", 319 | "status": "True", 320 | "type": "Progressing" 321 | } 322 | ], 323 | "details": { 324 | "causes": [ 325 | { 326 | "type": "ConfigChange" 327 | } 328 | ], 329 | "message": "config change" 330 | }, 331 | "latestVersion": 1, 332 | "observedGeneration": 2, 333 | "readyReplicas": 1, 334 | "replicas": 1, 335 | "unavailableReplicas": 0, 336 | "updatedReplicas": 1 337 | } 338 | } 339 | ], 340 | "kind": "List", 341 | "metadata": { 342 | "resourceVersion": "", 343 | "selfLink": "" 344 | } 345 | } 346 | .... 347 | 348 | Note where the image is picked from. It shows that the deployment picks 349 | the image from the local registry (same ip address and port as in 350 | buildconfig) and the image tag is same as what we built earlier. This 351 | means the deployment step deploys the application image what was built 352 | earlier during the build step. 353 | 354 | If you get the list of pods, you’ll notice that the application gets 355 | deployed quickly and starts running in its own pod. 356 | 357 | .... 358 | $ oc get pods 359 | 360 | NAME READY STATUS RESTARTS AGE 361 | time-1-build 0/1 Completed 0 2h 362 | time-1-rqa7c 1/1 Running 0 2h 363 | .... 364 | 365 | *Step 5: Adding route* 366 | 367 | This step is very much the same as what we did in the previous exercise. 368 | We will check the service and add a route to expose that service. 369 | 370 | .... 371 | $ oc get services 372 | 373 | NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE 374 | time 172.30.xx.82 8080/TCP 2h 375 | .... 376 | 377 | Here we expose the service as a route. 378 | 379 | .... 380 | $ oc expose service time 381 | 382 | NAME HOST/PORT PATH SERVICE LABELS TLS TERMINATION 383 | time time app=time 384 | .... 385 | 386 | And then we check the route exposed. 387 | 388 | .... 389 | $ oc get routes 390 | 391 | NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD 392 | time time-mycliproject-UserName.apps.workshop.osecloud.com time 8080-tcp None 393 | .... 394 | 395 | *Note:* Unlike in the previous lab, this time we did not use `--hostname` 396 | parameter while exposing the service to create a route. OpenShift 397 | automatically assigned the project name extension to the route name. 398 | 399 | *Step 6: Run the application* 400 | 401 | Now run the application by using the route you provided in the previous 402 | step. You can use either curl or your browser. The application displays 403 | time. *If you don’t provide time.php extension, it displays apache’s 404 | default index page.* 405 | 406 | .... 407 | $ curl time-mycliproject-UserName.apps.workshop.osecloud.com 408 | Wednesday 1st of July 2015 01:12:20 AM 409 | .... 410 | 411 | Congratulations!! In this exercise you have learnt how to create, build 412 | and deploy an application using OpenShift’s `Docker Build strategy`. 413 | 414 | link:0_toc.adoc[Table Of Contents] 415 | -------------------------------------------------------------------------------- /3-Using-Web-Console.adoc: -------------------------------------------------------------------------------- 1 | [[using-web-console]] 2 | Using Web Console 3 | ~~~~~~~~~~~~~~~~~ 4 | 5 | In this lab exercise, we will review the OpenShift Web Console. 6 | 7 | Type in the master public URL provided by your instructor in a browser. 8 | Use `:`. You will be directed to an OpenShift 9 | login page. 10 | 11 | *Note*: Your browser may complain about the server’s security 12 | certificates not trusted by your computer. You can agree to proceed to 13 | the master URL. 14 | 15 | image::images/login.png[image] 16 | 17 | 18 | Key in the username and password provided by the instructor. You will now 19 | see the Service Catalog. Your created project will be listed on the right 20 | 21 | image::images/service_catalog.png[image] 22 | 23 | 24 | Click on "View All" on the right. You will see the list of projects now. 25 | Note the project you created in the last lab exercise is shown here. 26 | 27 | image::images/projects_list.png[image] 28 | 29 | Also note the *Create Project* button which allows you to create a new 30 | project from Web Console. 31 | 32 | Now click on the CLI Project to view the details. OpenShift takes you by 33 | default to the *Overview* page and shows you a graphic representation of 34 | the application that is deployed here. You can see that a single pod is 35 | running and is front ended by a service. Note the route that you 36 | configured for this service is also shown. You will also see the *Add to 37 | Project* button on the top. This can be used to create new application 38 | from Web Console inside this project. 39 | 40 | image::images/project_details.png[image] 41 | 42 | Select *Builds* under *Builds* tab, you will see all the build 43 | configurations. Click onto each build configuration and select the 44 | *Configuration* tab, we will be able to view all the build details. 45 | 46 | image::images/project_build_details.png[image] 47 | 48 | Select *Pods* under *Applications* tab, you will find a running pod that 49 | is running your application image. Note that it also tells you the node 50 | on which the pod is running and other details about this pod. You will 51 | also see the build pod that had succeeded. 52 | 53 | image::images/project_pods.png[image] 54 | 55 | Click onto running pod, it shows the details on the pod. In addition, 56 | metrics, logs and terminal also available for monitoring. 57 | 58 | image::images/project_pod_details.png[image] 59 | 60 | Click on *Terminal* tab, you will be able to access the pod from web 61 | console. 62 | 63 | image::images/terminal_view.png[image] 64 | 65 | If you click onto the *Metrics* tab under Pod and get an error viewing 66 | metrics on the browser, please do the following: 67 | 68 | 1. Open https://hawkular.<>/hawkular/metrics from a new tab on the same 69 | broswer 70 | 2. Click ``Advanced'' link 71 | 3. Click ``Proceed to hawkular.<> (unsafe)'' 72 | 4. Refresh the browser where you login at OpenShift console. 73 | 74 | Click *Builds* on left menu and select *Builds*. Select the build name 75 | *time* and then click on *Configuration* tab. Note there are webhook 76 | URLs. We will use them in a later lab exercise. You can start a build 77 | from the Web Console by pressing the *Start Build* button in the right 78 | top corner. It also gives you a command to start the build from CLI. 79 | 80 | image::images/project_build_configuration.png[image] 81 | 82 | * Select *Services* under *Applications* tab, you will find the service 83 | created for your application. Click onto one of the services, it shows 84 | all the details about the service along with the option to expose it as 85 | a route. 86 | * Select *Routes* under *Applications* tab, you will see all the routes 87 | in the project. Click onto a route, it shows all the details for this 88 | route. 89 | * Select *Deployments* under *Applications* tab, you will see all the 90 | deployments. Click onto a deployment, it shows all the details of the 91 | deployment. By pressing the *Deploy* button, you will be able to start a 92 | deployment from the web console. 93 | * Select *Monitoring* tab, you will see all the events for the project. 94 | Also latest events grouped by resource type. 95 | * Select *Images* under *Builds* tab, it shows the list of image streams 96 | for the project. Click onto the specific image stream, it shows more 97 | details about the image stream. 98 | 99 | Click on the *Resources* tab on the left to see that it would display 100 | the Quotas and Other Resources, if they exist. We will deal with them in 101 | a different lab exercise. 102 | 103 | [[extra-credits]] 104 | Extra Credits 105 | ^^^^^^^^^^^^^ 106 | 107 | Repeat lab 1 108 | link:1.%20Create%20App%20From%20a%20Docker%20Image.md[creating an 109 | application from an existing Docker Image using CLI] using OpenShift Web 110 | Console. 111 | 112 | Spend a few minutes and familiarize using Web Console. 113 | 114 | link:0_toc.adoc[Table Of Contents] 115 | -------------------------------------------------------------------------------- /4-Creating-an-application-using-JBoss-EAP-builder-image.adoc: -------------------------------------------------------------------------------- 1 | [[creating-an-application-using-jboss-eap-builder-image]] 2 | Creating an application using JBoss EAP builder image 3 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | 5 | In this exercise we will learn how to create an application using source 6 | code and the JBoss EAP builder image. 7 | 8 | *Step 1: Create a project or use an existing project* 9 | 10 | If you want to, you can create a new project based on what you have 11 | learned in previous labs. Or you can create a new project for JBoss 12 | Applications. 13 | 14 | *Remember* to replace the username before running the command. 15 | 16 | .... 17 | $ oc new-project myjbossapp-UserName --display-name="My JBoss Applications" --description="A place for my JBoss EAP Applications" 18 | .... 19 | 20 | *Step 2: Create an application that uses the JBoss EAP builder image* 21 | 22 | We will be using a sample application called `Kitchensink` (found 23 | https://github.com/RedHatWorkshops/kitchensink[here]). Taking that 24 | source-code; we will use the JBoss ImageStream (or the builder image) to 25 | assemble our application. 26 | 27 | Open the browser and select your new project *My JBoss Applications*. 28 | 29 | Click into *Browse Catalog* button. 30 | 31 | In the search text box type `EAP 6.4` and select `JBoss EAP 6.4 (no https)`. 32 | 33 | Click Next 34 | 35 | .... 36 | In the Add to Project box select the created "My JBoss Applications" Project 37 | Add to Project: select your project name if it is not show 38 | 39 | Application Name: ks 40 | 41 | Git Repository URL: https://github.com/RedHatWorkshops/kitchensink 42 | 43 | Git Reference: master 44 | 45 | Context Directory: / 46 | 47 | Maven mirror URL: {{NEXUS_URL}} 48 | .... 49 | 50 | *REMEMBER:* Check with your instructor the proper URL for the Nexus 51 | repository. 52 | 53 | image::images/jboss_wizard_configuration.png[image] 54 | image::images/jboss_wizard_configuration2.png[image] 55 | 56 | Click Next 57 | Select `Create a secret in ... to be used later` 58 | Click on *Create* and then on *Continue to the project overview*. 59 | 60 | *Step 3: Build* 61 | 62 | Give it some seconds and you will see OpenShift starts the build process 63 | for you. You can view the list of builds using `oc get builds` command. 64 | 65 | .... 66 | $ oc get builds 67 | 68 | NAME TYPE FROM STATUS STARTED DURATION 69 | ks-1 Source Git@50ea6f4 Complete 2 minutes ago 24s 70 | .... 71 | 72 | Note the name of the build that is running i.e. `ks-1`. We will use that 73 | name to look at the build logs. Run the command as shown below to look 74 | at the build logs. This will run for a few mins. At the end you will 75 | notice that the docker image is successfully created and it will start 76 | pushing this to OpenShift’s internal docker registry. 77 | 78 | .... 79 | $oc get pods 80 | NAME READY STATUS RESTARTS AGE 81 | ks-1-build 1/1 Running 0 11m 82 | .... 83 | 84 | We can check the logs by executing the following command: 85 | 86 | .... 87 | $ oc logs pod/ks-1-build 88 | 89 | 90 | [INFO] 91 | [INFO] ------------------------------------------------------------------------ 92 | [INFO] Building JBoss AS Quickstarts: kitchensink 7.1.1-SNAPSHOT 93 | [INFO] ------------------------------------------------------------------------ 94 | 95 | [INFO] Packaging webapp 96 | [INFO] Assembling webapp [jboss-kitchensink] in [/home/jboss/source/target/jboss-kitchensink] 97 | [INFO] Processing war project 98 | [INFO] Copying webapp resources [/home/jboss/source/src/main/webapp] 99 | [INFO] Webapp assembled in [24 msecs] 100 | [INFO] Building war: /home/jboss/source/deployments/ROOT.war 101 | [INFO] ------------------------------------------------------------------------ 102 | [INFO] BUILD SUCCESS 103 | [INFO] ------------------------------------------------------------------------ 104 | [INFO] Total time: 7.123s 105 | [INFO] Finished at: Thu Oct 06 02:15:38 EDT 2016 106 | [INFO] Final Memory: 19M/129M 107 | [INFO] ------------------------------------------------------------------------ 108 | Copying all war artifacts from /home/jboss/source/target directory into /opt/eap/standalone/deployments for later deployment... 109 | Copying all ear artifacts from /home/jboss/source/target directory into /opt/eap/standalone/deployments for later deployment... 110 | Copying all rar artifacts from /home/jboss/source/target directory into /opt/eap/standalone/deployments for later deployment... 111 | Copying all jar artifacts from /home/jboss/source/target directory into /opt/eap/standalone/deployments for later deployment... 112 | Copying all war artifacts from /home/jboss/source/deployments directory into /opt/eap/standalone/deployments for later deployment... 113 | '/home/jboss/source/deployments/ROOT.war' -> '/opt/eap/standalone/deployments/ROOT.war' 114 | Copying all ear artifacts from /home/jboss/source/deployments directory into /opt/eap/standalone/deployments for later deployment... 115 | Copying all rar artifacts from /home/jboss/source/deployments directory into /opt/eap/standalone/deployments for later deployment... 116 | Copying all jar artifacts from /home/jboss/source/deployments directory into /opt/eap/standalone/deployments for later deployment... 117 | 118 | Pushing image 172.30.89.28:5000/myjbossapp-admin/ks:latest ... 119 | Pushed 0/6 layers, 2% complete 120 | Pushed 1/6 layers, 22% complete 121 | Pushed 2/6 layers, 47% complete 122 | Pushed 3/6 layers, 73% complete 123 | Pushed 4/6 layers, 82% complete 124 | Pushed 5/6 layers, 98% complete 125 | Pushed 6/6 layers, 100% complete 126 | Push successful 127 | .... 128 | 129 | You will notice that in the logs that not only does it copy your source 130 | code to the builder image, but it also does a `maven` build to compile 131 | your code as well. Also, in the above log, note how the image is pushed 132 | to the local docker registry. The registry is running at `docker-registry.default.svc` 133 | at port `5000`. 134 | 135 | *Step 4: Deployment* 136 | 137 | Once the image is pushed to the docker registry, OpenShift will trigger 138 | a deploy process. Let us also quickly look at the deployment 139 | configuration by running the following command. Note `dc` represents 140 | `deploymentconfig`. 141 | 142 | .... 143 | $ oc get dc ks -o json 144 | 145 | { 146 | "kind": "DeploymentConfig", 147 | "apiVersion": "v1", 148 | "metadata": { 149 | "name": "ks", 150 | "namespace": "myjbossapp-admin", 151 | "selfLink": "/oapi/v1/namespaces/myjbossapp-admin/deploymentconfigs/ks", 152 | "uid": "eb474e40-8b8a-11e6-ba5b-080027782cf7", 153 | "resourceVersion": "32872", 154 | "generation": 2, 155 | "creationTimestamp": "2016-10-06T06:05:45Z", 156 | "labels": { 157 | "app": "ks" 158 | }, 159 | "annotations": { 160 | "openshift.io/generated-by": "OpenShiftNewApp" 161 | } 162 | }, 163 | "spec": { 164 | "strategy": { 165 | "type": "Rolling", 166 | "rollingParams": { 167 | "updatePeriodSeconds": 1, 168 | "intervalSeconds": 1, 169 | "timeoutSeconds": 600, 170 | "maxUnavailable": "25%", 171 | "maxSurge": "25%" 172 | }, 173 | "resources": {} 174 | }, 175 | "triggers": [ 176 | { 177 | "type": "ConfigChange" 178 | }, 179 | { 180 | "type": "ImageChange", 181 | "imageChangeParams": { 182 | "automatic": true, 183 | "containerNames": [ 184 | "ks" 185 | ], 186 | "from": { 187 | "kind": "ImageStreamTag", 188 | "namespace": "myjbossapp-admin", 189 | "name": "ks:latest" 190 | }, 191 | "lastTriggeredImage": "172.30.89.28:5000/myjbossapp-admin/ks@sha256:156db8530725a535f9b7ab7b696fab2e3c9c27c7fa0db0ea91bec87ed52b4193" 192 | } 193 | } 194 | ], 195 | "replicas": 1, 196 | "test": false, 197 | "selector": { 198 | "app": "ks", 199 | "deploymentconfig": "ks" 200 | }, 201 | "template": { 202 | "metadata": { 203 | "creationTimestamp": null, 204 | "labels": { 205 | "app": "ks", 206 | "deploymentconfig": "ks" 207 | }, 208 | "annotations": { 209 | "openshift.io/container.ks.image.entrypoint": "[\"/opt/eap/bin/openshift-launch.sh\"]", 210 | "openshift.io/generated-by": "OpenShiftNewApp" 211 | } 212 | }, 213 | "spec": { 214 | "containers": [ 215 | { 216 | "name": "ks", 217 | "image": "172.30.89.28:5000/myjbossapp-admin/ks@sha256:156db8530725a535f9b7ab7b696fab2e3c9c27c7fa0db0ea91bec87ed52b4193", 218 | "ports": [ 219 | { 220 | "containerPort": 8080, 221 | "protocol": "TCP" 222 | }, 223 | { 224 | "containerPort": 8443, 225 | "protocol": "TCP" 226 | }, 227 | { 228 | "containerPort": 8778, 229 | "protocol": "TCP" 230 | } 231 | ], 232 | "resources": {}, 233 | "terminationMessagePath": "/dev/termination-log", 234 | "imagePullPolicy": "Always" 235 | } 236 | ], 237 | "restartPolicy": "Always", 238 | "terminationGracePeriodSeconds": 30, 239 | "dnsPolicy": "ClusterFirst", 240 | "securityContext": {} 241 | } 242 | } 243 | }, 244 | "status": { 245 | "latestVersion": 1, 246 | "observedGeneration": 2, 247 | "replicas": 1, 248 | "updatedReplicas": 1, 249 | "availableReplicas": 1, 250 | "details": { 251 | "message": "caused by an image change", 252 | "causes": [ 253 | { 254 | "type": "ImageChange", 255 | "imageTrigger": { 256 | "from": { 257 | "kind": "ImageStreamTag", 258 | "namespace": "myjbossapp-admin", 259 | "name": "ks:latest" 260 | } 261 | } 262 | } 263 | ] 264 | } 265 | } 266 | } 267 | .... 268 | 269 | Note where the image is picked from. It shows that the deployment picks 270 | the image from the local registry (same ip address and port as in 271 | buildconfig) and the image tag is the same as what we built earlier. 272 | This means the deployment step deploys the application image what was 273 | built earlier during the build step. 274 | 275 | If you get the list of pods, you’ll notice that the application gets 276 | deployed quickly and starts running in its own pod. 277 | 278 | .... 279 | $ oc get pods 280 | 281 | NAME READY STATUS RESTARTS AGE 282 | ks-1-build 0/1 Completed 0 26m 283 | ks-1-ey7m2 1/1 Running 0 12m 284 | .... 285 | 286 | *Step 5: Adding route* 287 | 288 | This step is very much the same as what we did in previous exercises. We 289 | will check the service and add a route to expose that service. 290 | 291 | .... 292 | $ oc get service ks 293 | 294 | NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE 295 | ks 172.30.201.90 8080/TCP,8443/TCP,8778/TCP 21m 296 | .... 297 | 298 | Route should be already created. 299 | 300 | .... 301 | $ oc get routes 302 | 303 | NAME HOST/PORT PATH SERVICES PORT TERMINATION 304 | ks ks-myjbossapp-Username.apps.workshop.osecloud.com ks 8080-tcp 305 | .... 306 | 307 | If route does not show, we expose the service `ks` via the command 308 | below. 309 | 310 | .... 311 | $ oc expose service ks 312 | 313 | route "ks" exposed 314 | .... 315 | 316 | And now we can check the route uri. 317 | 318 | *Step 6: Run the application* 319 | 320 | Now access the application by using the route you got in the previous 321 | step. You can use either curl or your browser. 322 | 323 | .... 324 | $ curl ks-myjbossapp-UserName.apps.workshop.osecloud.com 325 | 326 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | .... 350 | 351 | Go to https://ks-myjbossapp-Username.apps.workshop.osecloud.com via your browser. 352 | Please replace your username with yours. 353 | 354 | image::images/ks-myjbossapp.png[image] 355 | 356 | Congratulations! In this exercise you have learned how to create, build 357 | and deploy a JBoss EAP application using OpenShift’s JBoss EAP Builder 358 | Image. 359 | 360 | link:0_toc.adoc[Table Of Contents] 361 | -------------------------------------------------------------------------------- /5-Using-templates.adoc: -------------------------------------------------------------------------------- 1 | [[using-templates]] 2 | Using Templates 3 | ~~~~~~~~~~~~~~~ 4 | 5 | In this lab exercise we will learn how to use OpenShift Web Console to 6 | spin up a MySQL database using templates. We will then add a frontend 7 | PHP application that accesses this database using the service exposed by 8 | the database. We will provide a route (a URL) to access the frontend 9 | application from a browser. 10 | 11 | *Step 1: Create a Project* 12 | 13 | Based on the experience gained from the previous exercise, log into the 14 | OpenShift Web Console. You will see the list of Projects. 15 | 16 | Using the *Create Project* button, create a new project. We will call it 17 | *consoleproject-UserName*. Replace by your username to make this project 18 | unique. Type in a *Display Name* and *Description* of your choice. 19 | 20 | Press the *Create* button to complete the project creation from the Web 21 | Console. This will accomplish the same job as `oc new-project` from CLI. 22 | 23 | *Step 2: Create a MYSQL database using the template* 24 | 25 | Click on *Add to Project -> Browse Catolog* button and you will be taken to select an 26 | image or template. You will see the application create screen as shown 27 | below: 28 | 29 | image::images/service_catalog2.png[image] 30 | 31 | Click on *Databases* tab. Find *MySQL* then *MySQL (Ephemeral)* 32 | template from the list and click *Select*. You will also notice *MySQL 33 | (Persistent)* template. But we will address that in a different lab 34 | exercise. 35 | 36 | image::images/mysql_ephemeral_template.png[image] 37 | 38 | You will be taken to the mysql ephemeral creation screen. Click *Next* 39 | parameters and edit the values to use the following values: 40 | 41 | .... 42 | Add to Project: consoleproject-UserName 43 | Database Service Name: mysql 44 | MySQL Connection Username: pricelist 45 | MySQL Connection Password: pricelist 46 | MySQL root user Password: pricelist 47 | MySQL Database Name: pricelist 48 | .... 49 | 50 | image::images/mysql_ephemeral_creation.png[image] 51 | 52 | Click the *Next* button. 53 | 54 | Click the checkbox to create the secret 55 | 56 | image::images/mysql_secret_binding.png[image] 57 | 58 | Click *Create* 59 | 60 | Click *Continue to project overview*. 61 | 62 | It will take you back to the project overview page and soon you will see 63 | an image of a running pod. 64 | 65 | image::images/mysql_pod_on_proj_overview.png[image] 66 | 67 | Please wait for the Bindings to complete. It may take few minutes. 68 | 69 | While we are waiting we can add a lable to the mysql deployment 70 | Run the following on the command line: 71 | **** 72 | oc label dc mysql app=pricelist 73 | **** 74 | 75 | *Step 3: Add a PHP frontend to talk to this database* 76 | 77 | In this step we will add a PHP frontend application that talks to 78 | recently created database. The code is available on github at 79 | 80 | https://github.com/RedHatWorkshops/php-pricelist 81 | 82 | Browse through the code in this repository. If you take a look at the 83 | link:https://raw.githubusercontent.com/RedHatWorkshops/php-pricelist/master/config/database.php[database configuration] file (`config/database.php`) you will see that 84 | it reads the values from environment varables. 85 | 86 | To add a frontend again click on *Add to Project -> Browse Catalog* 87 | This will take you to the Service Catalog. 88 | Select Languages -> PHP -> PHP 89 | 90 | Click *Next* 91 | 92 | **** 93 | Add to Project: consoleproject-UserName (this should be the same project as MySQL Ephemeral) 94 | Application Name: pricelist 95 | Git Repository: https://github.com/RedHatWorkshops/php-pricelist 96 | 97 | image::images/php.png[image] 98 | 99 | 100 | Click onto the link `Advanced Options` 101 | Go to Deployment Configuration section and enter the 102 | following environment variables: 103 | 104 | image::images/dbtest_deployment_env.png[image] 105 | 106 | In the Labels section add the following label if its not there: 107 | 108 | .... 109 | * app=pricelist 110 | .... 111 | 112 | Click *Create* to add this frontend application to talk to the database. 113 | 114 | image::images/cakephp_confirm.png[image] 115 | 116 | Click *Continue to product overview*. 117 | 118 | You will be taken back to the Project Overview page and you will start 119 | seeing that a new service is now available and exposed as a route. Since 120 | you labeled both frontend web and backend db as `app=pricelist` it will 121 | show as one application 122 | 123 | You will also notice that a build starts running very soon. Once the 124 | build completes, the application image created from the source code will 125 | be uploaded to the docker repository. 126 | 127 | image::images/console_project_overview.png[image] 128 | 129 | You can check the build logs using the following command: 130 | 131 | .... 132 | $ oc logs build/pricelist-1 133 | Cloning "https://github.com/RedHatWorkshops/php-pricelist" ... 134 | Commit: 2aa50442e8432c48beedc1503cd3d05dcb834515 (Added db connection) 135 | Author: Christian Hernandez 136 | Date: Thu Jun 29 10:52:43 2017 -0700 137 | ---> Installing application source... 138 | Pushing image docker-registry.default.svc:5000/consoleproject-christian/pricelist:latest ... 139 | Pushed 0/6 layers, 2% complete 140 | Pushed 1/6 layers, 26% complete 141 | Pushed 2/6 layers, 42% complete 142 | Pushed 3/6 layers, 56% complete 143 | Pushed 4/6 layers, 75% complete 144 | Pushed 5/6 layers, 97% complete 145 | Pushed 6/6 layers, 100% complete 146 | Push successful 147 | .... 148 | 149 | Once the build completes, OpenShift initiates a deploy process. Once the 150 | deployment is complete, the frontend pod starts running. You will find 151 | the running pod when you navigate to *Applications->Pods* on the Web 152 | console. 153 | 154 | Now use `curl` to run the database `bootstrap` script 155 | .... 156 | $ oc project 157 | Using project "consoleproject-Username" on server "{{CONSOLE_ADDRESS}}". 158 | 159 | $ curl -k http://$(oc get route/pricelist -o jsonpath='{.spec.host}')/create_database.php 160 | Array 161 | ( 162 | [0] => 00000 163 | [1] => 164 | [2] => 165 | ) 166 | 167 | .... 168 | 169 | Go ahead and open your application. The URL will be displayed by `oc get route` 170 | 171 | .... 172 | $ oc get route 173 | NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD 174 | pricelist pricelist-consoleproject-Username.apps.workshop.osecloud.com pricelist 8080-tcp None 175 | .... 176 | 177 | When you open your application, click on the "Create Record" button and create a record. 178 | Once you added a record, click on "Read Records". The page should look 179 | like this. 180 | 181 | image::images/application_create_screen.png[image] 182 | 183 | You can verify this by logging into the database using `oc rsh` 184 | 185 | .... 186 | $ oc get pods 187 | NAME READY STATUS RESTARTS AGE 188 | mysql-1-rxnlp 1/1 Running 0 25m 189 | pricelist-1-build 0/1 Completed 0 13m 190 | pricelist-1-z55t2 1/1 Running 0 12m 191 | .... 192 | 193 | Here you'll notice that the database pod is called `mysql-1-rxnlp`. Login 194 | to this pod using `oc rsh` 195 | 196 | .... 197 | $ oc rsh mysql-1-rxnlp 198 | sh-4.2$ 199 | .... 200 | 201 | Run `mysql -u root pricelist` to login and run the query. 202 | .... 203 | sh-4.2$ mysql -u root pricelist 204 | Welcome to the MySQL monitor. Commands end with ; or \g. 205 | Your MySQL connection id is 326 206 | Server version: 5.7.16 MySQL Community Server (GPL) 207 | 208 | Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. 209 | 210 | Oracle is a registered trademark of Oracle Corporation and/or its 211 | affiliates. Other names may be trademarks of their respective 212 | owners. 213 | 214 | Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 215 | 216 | mysql> SELECT * FROM products; 217 | +----+-----------+----------------------------------------------+-------+-------------+---------------------+---------------------+ 218 | | id | name | description | price | category_id | created | modified | 219 | +----+-----------+----------------------------------------------+-------+-------------+---------------------+---------------------+ 220 | | 14 | OpenShift | Build, deploy, and manage your applications! | 5000 | 4 | 2017-08-21 22:06:28 | 2017-08-21 22:06:28 | 221 | +----+-----------+----------------------------------------------+-------+-------------+---------------------+---------------------+ 222 | 1 row in set (0.00 sec) 223 | 224 | mysql> \q 225 | .... 226 | 227 | In this lab exercise you have seen a complete web application deployed 228 | using OpenShift templates in two parts. First we deployed the MySQL 229 | database. We added data manually by getting into the pod. Then we added 230 | the frontend code that was built using the OpenShift S2I process. You 231 | configured this frontend application to access the database using a 232 | service, in this case, the ``mysql'' service. The frontend is made 233 | accessible using a route for which you gave a URL. 234 | 235 | link:https://github.com/RedHatWorkshops/openshiftv3-workshop/blob/master/0_toc.adoc[Table Of Contents] 236 | -------------------------------------------------------------------------------- /6-Scale-up-and-Scale-down-the-application-instances.adoc: -------------------------------------------------------------------------------- 1 | [[scale-up-and-scale-down-and-idle-the-application-instances]] 2 | Scale up and Scale down and Idle the application instances 3 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | 5 | In this exercise we will learn how to scale our application. OpenShift 6 | has the capability to scale your application and make sure that many 7 | instances are always running. 8 | 9 | *Step 1: Switch to an existing project* 10 | 11 | For this exercise, we will be using an already running application. We 12 | will be using the `mycliproject-UserName` that you created in the 13 | previous labs. Make sure you are switched to that project by using the 14 | `oc project` command and *remember* to substitute UserName. 15 | 16 | .... 17 | $ oc project mycliproject-UserName 18 | .... 19 | 20 | *Step 2: View the deployment config* 21 | 22 | Take a look at the `deploymentConfig` (or `dc`) of the `time` 23 | application 24 | 25 | .... 26 | $ oc get deploymentConfig/time -o yaml 27 | 28 | apiVersion: v1 29 | kind: DeploymentConfig 30 | metadata: 31 | annotations: 32 | openshift.io/generated-by: OpenShiftNewApp 33 | creationTimestamp: 2016-10-06T05:47:52Z 34 | generation: 2 35 | labels: 36 | app: time 37 | name: time 38 | namespace: mycliproject-admin 39 | resourceVersion: "32084" 40 | selfLink: /oapi/v1/namespaces/mycliproject-admin/deploymentconfigs/time 41 | uid: 6bb299e0-8b88-11e6-ba5b-080027782cf7 42 | spec: 43 | replicas: 1 44 | selector: 45 | app: time 46 | deploymentconfig: time 47 | strategy: 48 | resources: {} 49 | rollingParams: 50 | intervalSeconds: 1 51 | maxSurge: 25% 52 | maxUnavailable: 25% 53 | timeoutSeconds: 600 54 | updatePeriodSeconds: 1 55 | type: Rolling 56 | template: 57 | metadata: 58 | annotations: 59 | openshift.io/container.time.image.entrypoint: '["sh"]' 60 | openshift.io/generated-by: OpenShiftNewApp 61 | creationTimestamp: null 62 | labels: 63 | app: time 64 | deploymentconfig: time 65 | spec: 66 | containers: 67 | - image: 172.30.89.28:5000/mycliproject-admin/time@sha256:c490ea632c5362be3a3985285c623e674e58b876e70d9e3f94a151785b2ee87c 68 | imagePullPolicy: Always 69 | name: time 70 | ports: 71 | - containerPort: 8080 72 | protocol: TCP 73 | resources: {} 74 | terminationMessagePath: /dev/termination-log 75 | dnsPolicy: ClusterFirst 76 | restartPolicy: Always 77 | securityContext: {} 78 | terminationGracePeriodSeconds: 30 79 | test: false 80 | triggers: 81 | - type: ConfigChange 82 | - imageChangeParams: 83 | automatic: true 84 | containerNames: 85 | - time 86 | from: 87 | kind: ImageStreamTag 88 | name: time:latest 89 | namespace: mycliproject-admin 90 | lastTriggeredImage: 172.30.89.28:5000/mycliproject-admin/time@sha256:c490ea632c5362be3a3985285c623e674e58b876e70d9e3f94a151785b2ee87c 91 | type: ImageChange 92 | status: 93 | availableReplicas: 1 94 | details: 95 | causes: 96 | - imageTrigger: 97 | from: 98 | kind: ImageStreamTag 99 | name: time:latest 100 | namespace: mycliproject-admin 101 | type: ImageChange 102 | message: caused by an image change 103 | latestVersion: 1 104 | observedGeneration: 2 105 | replicas: 1 106 | updatedReplicas: 1 107 | .... 108 | 109 | Note that the `replicas:` is set to `1`. This tells OpenShift that when 110 | this application deploys, make sure that there is 1 instance. 111 | 112 | The `replicationController` mirrors this configuration initially; the 113 | `replicationController` (or `rc`) will ensure that there is always the 114 | set number of instances always running. 115 | 116 | To view the `rc` for your application first get the current pod running. 117 | 118 | .... 119 | oc get pods 120 | 121 | NAME READY STATUS RESTARTS AGE 122 | time-1-45jtc 1/1 Running 0 2h 123 | time-1-build 0/1 Completed 0 2h 124 | .... 125 | 126 | This shows that the build `time-1` is running in pod `45jtc`. Let us 127 | view the `rc` on this build. 128 | 129 | .... 130 | $ oc get rc/time-1 131 | 132 | NAME DESIRED CURRENT AGE 133 | time-1 1 1 2h 134 | .... 135 | 136 | *Note:* You can change the number of replicas in `DeploymentConfig` or 137 | the `ReplicationController`. 138 | 139 | However note that if you change the `deploymentConfig` it applies to 140 | your application. This means, even if you delete the current replication 141 | controller, the new one that gets created will be assigned the REPLICAS 142 | value based on what is set for DC. If you change it on the Replication 143 | Controller, the application will scale up. But if you happen to delete 144 | the current replication controller for some reason, you will loose that 145 | setting. 146 | 147 | *Step 3: Scale Application* 148 | 149 | To scale your application we will edit the `deploymentConfig` to 3. 150 | 151 | Open your browser to the Overview page and note you only have one 152 | instance running. 153 | 154 | image::images/scale_updown_overview.png[image] 155 | 156 | Now scale your application using the `oc scale` command (remembering to 157 | specify the `dc`) 158 | 159 | .... 160 | $ oc scale --replicas=3 dc/time 161 | deploymentconfig "time" scaled 162 | .... 163 | 164 | If you look at the web console and you will see that there are 3 165 | instances running now 166 | image::images/scale_updown_overview_scaled.png[image] 167 | 168 | *Note:* You can also scale up and down from the web console by going to 169 | the project overview page and clicking twice on 170 | image::scale_up.jpg[image] right next to the pod count circle to 171 | add 2 more pods. 172 | 173 | On the command line, see how many pods you are running now: 174 | 175 | .... 176 | $ oc get pods 177 | 178 | NAME READY STATUS RESTARTS AGE 179 | time-1-33wyq 1/1 Running 0 10m 180 | time-1-45jtc 1/1 Running 0 2h 181 | time-1-5ekuk 1/1 Running 0 10m 182 | time-1-build 0/1 Completed 0 2h 183 | .... 184 | 185 | You now have 3 instances of `time-1` running (each with a different 186 | pod-id). If you check the `rc` of the `time-1` build you will see that 187 | it has been updated by the `dc`. 188 | 189 | .... 190 | $ oc get rc/time-1 191 | 192 | NAME DESIRED CURRENT AGE 193 | time-1 3 3 3h 194 | .... 195 | 196 | *Step 4: Idling the application* 197 | 198 | Run the following command to find the available endpoints 199 | 200 | .... 201 | $ oc get endpoints 202 | NAME ENDPOINTS AGE 203 | time 10.128.0.33:8080,10.129.0.30:8080,10.129.2.27:8080 15m 204 | .... 205 | 206 | Note that the name of the endpoints is `time` and there are three ips 207 | addresses for the three pods. 208 | 209 | Run the `oc idle endpoints/time` command to idle the application 210 | 211 | .... 212 | $ oc idle endpoints/time 213 | Marked service mycliproject-veer/time to unidle resource DeploymentConfig mycliproject-veer/time (unidle to 3 replicas) 214 | Idled DeploymentConfig mycliproject-veer/time (dry run) 215 | .... 216 | 217 | Go back to the webconsole. You will notice that the pods show up as 218 | idled. 219 | 220 | image::images/idled_pods.jpeg[image] 221 | 222 | At this point the application is idled, the pods are not running and no 223 | resources are being used by the application. This doesn’t mean that the 224 | application is deleted. The current state is just saved.. that’s all. 225 | 226 | *Step 6: Reactivate your application* Now click on the application route 227 | URL or access the application via curl. 228 | 229 | Note that it takes a little while for the application to respond. This 230 | is because pods are spinning up again. You can notice that in the web 231 | console. 232 | 233 | In a little while the output comes up and your application would be up 234 | with 3 pods. 235 | 236 | So, as soon as the user accesses the application, it comes up!!! 237 | 238 | *Step 7: Scaling Down* 239 | 240 | Scaling down is the same procedure as scaling up. Use the `oc scale` 241 | command on the `time` application `dc` setting. 242 | 243 | .... 244 | oc scale --replicas=1 dc/time 245 | 246 | deploymentconfig "time" scaled 247 | .... 248 | 249 | Alternately, you can go to project overview page and click on 250 | image::scale_down.jpg[image] twice to remove 2 running pods. 251 | 252 | Congratulations!! In this exercise you have learned about scaling and 253 | how to scale up/down your application on OpenShift! 254 | 255 | link:0_toc.adoc[Table Of Contents] 256 | -------------------------------------------------------------------------------- /7-Binary-Deployment-of-a-war-file.adoc: -------------------------------------------------------------------------------- 1 | [[binary-deployment-of-a-war-file]] 2 | Binary Deployment of a war file 3 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | 5 | In the past you have seen how OpenShift can take your existing java 6 | code, build it and deploy the resultant docker image as an application. 7 | OpenShift S2I process includes an assemble script that copies the source 8 | code from a git repository, invokes a maven build, places the resultant 9 | war file in the deployments folder, builds a new application image and 10 | pushes that image into the registry. 11 | 12 | But how about if you want OpenShift to deploy a war file that you built 13 | yourself? 14 | 15 | In this exercise you will learn to deploy a war file. We will assume 16 | that you built your source code outside of OpenShift build process and 17 | want to download the WAR file on your workstation. 18 | 19 | *Step 1: Create project & folder structure* 20 | 21 | [source,sh] 22 | ---- 23 | oc new-project binarydeploy-UserName 24 | mkdir binarytest && cd binarytest 25 | mkdir deployments 26 | ---- 27 | 28 | FYI: 29 | 30 | You can also create a modules directory at the same level as 31 | ``deployments'' above and have additional modules there or configuration 32 | files. For example: 33 | 34 | .... 35 | mkdir modules 36 | cd modules 37 | mkdir cfg 38 | cd cfg 39 | touch config-1.cfg config-2.cfg 40 | .... 41 | 42 | *Step 1: Create war file* 43 | 44 | Create a war file and place it in deployments directory. 45 | 46 | As an example here we have a WAR file called `petstore.war` that we 47 | renamed to `ROOT.war` and placed in the deployments folder (you can 48 | download this example WAR file 49 | https://raw.githubusercontent.com/RedHatWorkshops/ps/master/deployments/ROOT.war[here]). 50 | 51 | .... 52 | $ ls -lR 53 | 54 | total 0 55 | drwxr-xr-x 3 veer staff 102 Jul 5 2015 deployments 56 | 57 | ./deployments: 58 | 59 | total 12024 60 | -rwxr-xr-x 1 veer staff 6155452 Jul 5 2015 ROOT.war 61 | .... 62 | 63 | *Step 2: Using builder image* 64 | 65 | Create a new build using the builder image of your choice. Here we are 66 | using JBoss EWS (tomcat 8) image. The flag `binary=true` indicates that 67 | this build will use the binary content instead of the url to the source 68 | code. 69 | 70 | Here I am naming my application as *myapp*. So all the artifacts will 71 | get the name *myapp*. 72 | 73 | .... 74 | $ oc new-build --image-stream=jboss-webserver30-tomcat8-openshift:1.3 --binary=true --name=myapp 75 | 76 | --> Found image 58272fb (11 weeks old) in image stream "jboss-webserver30-tomcat8-openshift" in project "openshift" under tag "latest" for "jboss-webserver30-tomcat8-openshift" 77 | 78 | JBoss Web Server 3.0 79 | -------------------- 80 | Platform for building and running web applications on JBoss Web Server 3.0 - Tomcat v8 81 | 82 | Tags: builder, java, tomcat8 83 | 84 | * A source build using binary input will be created 85 | * The resulting image will be pushed to image stream "myapp:latest" 86 | * Use 'start-build --from-dir=DIR|--from-repo=DIR|--from-file=FILE' to trigger a new build 87 | * WARNING: a binary build was created, you must specify one of --from-dir|--from-file|--from-repo when starting builds 88 | 89 | --> Creating resources with label build=myapp ... 90 | imagestream "myapp" created 91 | buildconfig "myapp" created 92 | --> Success 93 | .... 94 | 95 | *Step 3: Executing the build* 96 | 97 | Start the build by uploading the contents of your `deployments` 98 | directory. Make sure you are in the parent folder where you created the 99 | `deployments` folder inside previously. Remember the war file is in the 100 | `deployments` folder. The jboss-ews builder image knows to copy the 101 | contents of the `deployments` folder to the `deployments` directory and 102 | then builds the application image. 103 | 104 | .... 105 | $ oc start-build myapp --from-dir=. 106 | 107 | Uploading directory "." as binary input for the build ... 108 | build "myapp-1" started 109 | .... 110 | 111 | You can check the build logs by executing: 112 | 113 | .... 114 | $ oc logs myapp-1-build 115 | 116 | Receiving source from STDIN as archive ... 117 | 118 | Copying all deployments war artifacts from /home/jboss/source/deployments directory into /opt/webserver/webapps for later deployment... 119 | '/home/jboss/source/deployments/ROOT.war' -> '/opt/webserver/webapps/ROOT.war' 120 | 121 | Pushing image 172.30.89.28:5000/mycliproject-admin/myapp:latest ... 122 | Pushed 0/6 layers, 2% complete 123 | Pushed 1/6 layers, 18% complete 124 | Pushed 2/6 layers, 40% complete 125 | Pushed 3/6 layers, 54% complete 126 | Pushed 4/6 layers, 83% complete 127 | Pushed 5/6 layers, 93% complete 128 | Pushed 6/6 layers, 100% complete 129 | Push successful 130 | .... 131 | 132 | *Step 4: Create the application* 133 | 134 | Now create the application with the same name as what you gave for the 135 | build. 136 | 137 | Here we are using the name *myapp*, so that the rest of the objects such 138 | as deployment configuration and service are created with the same name 139 | and refer to the image-stream created earlier. 140 | 141 | .... 142 | $ oc new-app myapp --allow-missing-imagestream-tags 143 | 144 | --> Found image d4954db (4 minutes old) in image stream myapp under tag "latest" for "myapp" 145 | 146 | mycliproject-admin/myapp-1:cd51ae53 147 | ----------------------------------- 148 | Platform for building and running web applications on JBoss Web Server 3.0 - Tomcat v8 149 | 150 | Tags: builder, java, tomcat8 151 | 152 | * This image will be deployed in deployment config "myapp" 153 | * Ports 8080/tcp, 8443/tcp, 8778/tcp will be load balanced by service "myapp" 154 | * Other containers can access this service through the hostname "myapp" 155 | 156 | --> Creating resources with label app=myapp ... 157 | deploymentconfig "myapp" created 158 | service "myapp" created 159 | --> Success 160 | Run 'oc status' to view your app. 161 | .... 162 | 163 | Now, expose the service as a route to be able to use it from the 164 | browser. 165 | 166 | .... 167 | $ oc expose svc myapp 168 | route "myapp" exposed 169 | .... 170 | 171 | You can use the route to access the application using the URL. 172 | 173 | link:0_toc.adoc[Table Of Contents] 174 | -------------------------------------------------------------------------------- /8-Using-SSL-In-your-Application.adoc: -------------------------------------------------------------------------------- 1 | [[using-ssl-in-your-application]] 2 | Using SSL in your application 3 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | 5 | In this exercise you will set up your application to encrypt traffic 6 | with the OpenShift Wildcard certificate. 7 | 8 | *Step 1: Switch to an existing project* 9 | 10 | For this exercise, we will use an application that we created before. We 11 | will be using the *myjbossapp-UserName* that you created in the previous 12 | labs. Make sure you are switched to that project by using the *oc 13 | project* command. *Remember* to substitute UserName. 14 | 15 | .... 16 | $ oc project myjbossapp-UserName 17 | .... 18 | 19 | *Step 2: View the routing config* 20 | 21 | To view the routing config you will need to use the `oc get route` 22 | command 23 | 24 | .... 25 | $ oc get route/ks -o yaml 26 | 27 | apiVersion: v1 28 | kind: Route 29 | metadata: 30 | annotations: 31 | openshift.io/host.generated: "true" 32 | creationTimestamp: 2016-10-06T06:28:23Z 33 | labels: 34 | app: ks 35 | name: ks 36 | namespace: myjbossapp-admin 37 | resourceVersion: "33256" 38 | selfLink: /oapi/v1/namespaces/myjbossapp-admin/routes/ks 39 | uid: 14cf078c-8b8e-11e6-ba5b-080027782cf7 40 | spec: 41 | host: ks-myjbossapp-UserName.apps.workshop.osecloud.com 42 | port: 43 | targetPort: 8080-tcp 44 | to: 45 | kind: Service 46 | name: ks 47 | weight: 100 48 | status: 49 | ingress: 50 | - conditions: 51 | - lastTransitionTime: 2016-10-06T06:28:23Z 52 | status: "True" 53 | type: Admitted 54 | host: ks-myjbossapp-UserName.apps.workshop.osecloud.com 55 | routerName: router 56 | .... 57 | 58 | Note here that the `host:` is set to the FQDN that your application is 59 | running on. 60 | 61 | Currently the routing component of OpenShift 3 supports ports `80` and 62 | `443`. When you first create your route, the mapping of `80` to your pod 63 | is done automatically. There are a few things that need to be done in 64 | order to get the `443` mapping to work. 65 | 66 | *Step 3: TLS Edge Termination* 67 | 68 | OpenShift has a _wildcard_ SSL certificate that it can use for any 69 | application. We can use this SSL certificate to serve SSL from our 70 | application without having to generate a cert of our own (which is 71 | sometimes called SSL-offloading). 72 | 73 | Edit your routing configuration: 74 | 75 | .... 76 | oc edit route/ks 77 | .... 78 | 79 | You are going to add `tls: termination: edge` right below the `host:` 80 | section. It should look something like this. 81 | 82 | .... 83 | apiVersion: v1 84 | kind: Route 85 | metadata: 86 | annotations: 87 | openshift.io/host.generated: "true" 88 | creationTimestamp: 2015-12-22T03:56:30Z 89 | labels: 90 | app: ks 91 | name: ks 92 | namespace: myjbossapp-shchan 93 | resourceVersion: "2903142" 94 | selfLink: /oapi/v1/namespaces/myjbossapp-shchan/routes/ks 95 | uid: fba5d1e6-a85f-11e5-be21-fa163ec58dad 96 | spec: 97 | host: ks-myjbossapp-UserName.apps.workshop.osecloud.com 98 | tls: 99 | termination: edge 100 | port: 101 | targetPort: "8080" 102 | to: 103 | kind: Service 104 | name: ks 105 | status: {} 106 | .... 107 | 108 | *Step 4: Verify* 109 | 110 | Verify by visiting your page by using the `https://` URI 111 | 112 | Congratulations!! In this exercise you have learned about service SSL 113 | from your application 114 | 115 | link:0_toc.adoc[Table Of Contents] 116 | -------------------------------------------------------------------------------- /9-Blue-Green-Deployments.adoc: -------------------------------------------------------------------------------- 1 | [[blue-green-deployments]] 2 | Blue-Green Deployments 3 | ~~~~~~~~~~~~~~~~~~~~~~ 4 | 5 | The purpose of this short lab is to demonstrate how simple it is to 6 | implement Blue-Green Deployments in OpenShift v3. 7 | 8 | ---- 9 | Blue-green deployment is a release strategy that can be utilized by 10 | developers for deploying software in a production environment. Blue can 11 | be one particular production environment whereas green can define an 12 | identical production environment. Under blue-green deployment strategy, 13 | software developers are able to minimize downtime and reduce risk. 14 | https://en.wikipedia.org/wiki/User:Nuqing/Blue-green_deployment[1*] 15 | ---- 16 | 17 | In this Lab, we will be: 18 | 19 | * Deploying two versions of the same application. The first version will 20 | display a blue rectangle. 21 | * Create a FQDN that can be used to expose the applications. 22 | * We will first expose the first application. 23 | * We will also create another version of this application in the same 24 | project that displays a green rectangle. 25 | * We will then switch the FQDN to from the first application (blue) to 26 | the second application (green). 27 | 28 | image::images/blue_green_deployment.png[image] 29 | 30 | [[part-i]] 31 | Part I 32 | ^^^^^^ 33 | 34 | *Step 1: Create a new project* 35 | 36 | *Remember* to substitute the username 37 | 38 | .... 39 | $ oc new-project bluegreen-UserName --display-name="Blue Green Project" --description="Blue Green Project" 40 | .... 41 | 42 | *Step 2: List existing image builder or image streams* 43 | 44 | .... 45 | $ oc new-app -S --image-stream=php 46 | 47 | Image streams (oc new-app --image-stream= [--code=]) 48 | ----- 49 | php 50 | Project: openshift 51 | Tags: 5.5, 5.6, latest 52 | .... 53 | 54 | *Step 3: Create an application* 55 | 56 | We will be using a sample application that displays a blue or green 57 | rectangle. The sample app can be browsed at 58 | https://github.com/RedHatWorkshops/bluegreen 59 | 60 | We will be using an env var in order to change the color of the box; but 61 | in practice you would use a different branch for each version of the 62 | code. (E.g. v1 branch and v2 branch) 63 | 64 | .... 65 | $ oc new-app --image-stream=php --code=https://github.com/RedHatWorkshops/bluegreen --env COLOR=blue --name=blue 66 | .... 67 | 68 | *Step 4: Monitor the application build* 69 | 70 | .... 71 | $ oc get builds 72 | 73 | NAME TYPE FROM STATUS STARTED DURATION 74 | blue-1 Source Git@afdc492 Complete About a minute ago 1m8s 75 | .... 76 | 77 | Using the build name of the recently created application run: 78 | 79 | .... 80 | $ oc logs build/blue-1 81 | .... 82 | 83 | Once the build finishes you should see something similar to: 84 | 85 | .... 86 | ... 87 | ---> Installing application source... 88 | 89 | 90 | Pushing image 172.30.89.28:5000/bluegreen-admin/blue:latest ... 91 | Pushed 0/5 layers, 2% complete 92 | Pushed 1/5 layers, 24% complete 93 | Pushed 2/5 layers, 46% complete 94 | Pushed 3/5 layers, 68% complete 95 | Pushed 3/5 layers, 100% complete 96 | Pushed 4/5 layers, 100% complete 97 | Pushed 5/5 layers, 100% complete 98 | Push successful 99 | .... 100 | 101 | *Step 5: Check application deployment status* 102 | 103 | .... 104 | $ oc get pods 105 | 106 | NAME READY STATUS RESTARTS AGE 107 | blue-1-build 0/1 Completed 0 4m 108 | blue-1-ruyrt 1/1 Running 0 19s 109 | .... 110 | 111 | Notice that the build pod has exited and you now have a single instance 112 | of the application running under one single pod. 113 | 114 | This application displays a blue square. 115 | 116 | *Step 6: List the service* 117 | 118 | .... 119 | $ oc get service 120 | .... 121 | 122 | *Step 7: Create a route for the application* 123 | 124 | *Remember* to substitute the username. Expose the service: 125 | 126 | .... 127 | $ oc expose service blue --hostname=bluegreen.UserName.apps.workshop.osecloud.com --name=bluegreen 128 | .... 129 | 130 | *Step 8: Test the application* 131 | 132 | .... 133 | $ oc get route 134 | .... 135 | 136 | Copy the HOST/PORT and paste it in your browser. You should see 137 | something similar to: 138 | 139 | image::images/blue_deployment.jpeg[image] 140 | 141 | At this point you have deployed an application that displays for 142 | illustration purposes a blue rectangle for version 1. 143 | 144 | [[part-ii]] 145 | Part II 146 | ~~~~~~~ 147 | 148 | In this part, we will: 149 | 150 | * Deploy a new version of this application (Same one as before with a 151 | very small change) 152 | * Point the previously created FQDN (route) to the new service that will 153 | be created as part of the new application creation process. 154 | 155 | image::images/blue_green_active_green.png[image] 156 | 157 | *Step 1: Create new version of the application* 158 | 159 | Create a new application the same way as you did above in Part I. Make 160 | sure to name the application as `green' this time. 161 | 162 | .... 163 | $ oc new-app --image-stream=php --code=https://github.com/RedHatWorkshops/bluegreen --env COLOR=green --name=green 164 | .... 165 | 166 | * Wait until the application is built and deployed. You should now see 167 | two services if you run: 168 | 169 | .... 170 | $ oc get service 171 | 172 | NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE 173 | blue 172.30.2.161 8080/TCP 24m 174 | green 172.30.136.184 8080/TCP 1m 175 | .... 176 | 177 | * Edit the previously created route and change the `service` name (from 178 | `blue` to `green`), all the way at the bottom to the new service that 179 | was just created. You are essentially still using the FQDN you had 180 | previously created. However, that route will now point to a different 181 | (green) service. 182 | 183 | .... 184 | $ oc edit route bluegreen 185 | 186 | apiVersion: v1 187 | kind: Route 188 | metadata: 189 | creationTimestamp: 2015-12-22T19:16:28Z 190 | labels: 191 | app: green 192 | name: bluegreen 193 | namespace: bluegreen-UserName 194 | resourceVersion: "2969408" 195 | selfLink: /oapi/v1/namespaces/bluegreen-UserName/routes/bluegreen 196 | uid: 80829b59-a8e0-11e5-be21-fa163ec58dad 197 | spec: 198 | host: bluegreen.UserName.apps.workshop.osecloud.com 199 | port: 200 | targetPort: "8080" 201 | to: 202 | kind: Service 203 | name: green 204 | status: {} 205 | .... 206 | 207 | *Step 2: Test the application* 208 | 209 | .... 210 | $ oc get route 211 | .... 212 | 213 | * Copy the HOST/PORT and paste it in your browser. 214 | * You should now see the new version of the recently deployed 215 | application with a green rectangle. 216 | 217 | [[part-iii]] 218 | Part III 219 | ~~~~~~~ 220 | 221 | You can route traffic to both services. This is also known as "cannary in a colemine". 222 | 223 | *Step 1: Edit Your Route* 224 | Using the lefthand side navigation; click on *Applications -> Routes*. This will 225 | bring you to the `Route` overview page. 226 | 227 | image::images/bg-routes-page.png[image] 228 | 229 | Here, click on the `bluegreen` route. The page after will display the current configuration. 230 | On the upper right hand side, click on *Actions -> Edit*. You should see a page similar to 231 | this one. 232 | 233 | image::images/bg-edit-route.png[image] 234 | 235 | Next, tick on `Split traffic across multiple services` 236 | 237 | image::images/g-slipt-traffic.png[image] 238 | 239 | Here, set the weight to 50% on blue and 50% on green. This will make it to where half the 240 | traffic will go to the green application and half to the blue application. 241 | 242 | image::images/bg-5050-split.png[image] 243 | 244 | Once you click on *Save*; you should see this on the Route Overview page. 245 | 246 | image::images/bg-route-split-overview.png[image] 247 | 248 | *Step 2: Test Your Settings* 249 | 250 | If you try and visit your application; you'll notice it won't "switch" over 251 | to the other application. This is because the default behavior is: 252 | 253 | * Sticky Session on the Router 254 | * Session Cookie set on the router 255 | 256 | To get "true" round robin; annotate your route with the following 257 | 258 | .... 259 | oc annotate route/bluegreen haproxy.router.openshift.io/balance=roundrobin 260 | oc annotate route/bluegreen haproxy.router.openshift.io/disable_cookies=true 261 | .... 262 | 263 | 264 | 265 | [[summary]] 266 | Summary 267 | ~~~~~~~ 268 | 269 | * Blue-Green deployments can be easily accomplished in OpenShift v3. 270 | * We have shown multiple versions of an application; all running 271 | concurrently, each with a unique service. 272 | * All that is needed to expose any of the applications is to change the 273 | service being used by the route to publicly advertise the application. 274 | * You can split traffic accross two services 275 | 276 | link:0_toc.adoc[Table Of Contents] 277 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM centos:centos7 2 | 3 | # Install any required system packages. We need the Apache httpd web 4 | # server in this instance, plus the 'rsync' package so we can copy 5 | # files into the running container if necessary. 6 | 7 | RUN rpmkeys --import file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 && \ 8 | yum install -y centos-release-scl scl-utils && \ 9 | PACKAGES="httpd24 httpd24-httpd-devel httpd24-mod_auth_kerb httpd24-mod_ldap httpd24-mod_session rsync" && \ 10 | yum install -y --setopt=tsflags=nodocs --enablerepo=centosplus ${PACKAGES} && \ 11 | yum -y install --setopt=tsflags=nodocs --enablerepo=centosplus https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm && \ 12 | yum -y install --setopt=tsflags=nodocs --enablerepo=centosplus rubygem-asciidoctor && \ 13 | rpm -V ${PACKAGES} && \ 14 | yum clean all -y 15 | 16 | # Create a non root account called 'default' to be the owner of all the 17 | # files which the Apache httpd server will be hosting. This account 18 | # needs to be in group 'root' (gid=0) as that is the group that the 19 | # Apache httpd server would use if the container is later run with a 20 | # unique user ID not present in the host account database, using the 21 | # command 'docker run -u'. 22 | 23 | ENV HOME=/opt/app-root 24 | 25 | RUN mkdir -p ${HOME} && \ 26 | useradd -u 1001 -r -g 0 -d ${HOME} -s /sbin/nologin \ 27 | -c "Default Application User" default 28 | 29 | # Modify the default Apache configuration to listen on a non privileged 30 | # port of 8080 and log everything to stdout/stderr. Also include our own 31 | # configuration file so we can override other configuration. 32 | 33 | RUN mkdir -p ${HOME}/htdocs && \ 34 | sed -ri -e 's/^Listen 80$/Listen 8080/' \ 35 | -e 's%"logs/access_log"%"/proc/self/fd/1"%' \ 36 | -e 's%"logs/error_log"%"/proc/self/fd/2"%' \ 37 | /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf && \ 38 | echo "Include ${HOME}/httpd.conf" >> /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf 39 | 40 | COPY openshift/httpd.conf ${HOME}/httpd.conf 41 | 42 | EXPOSE 8080 43 | 44 | # Copy into place S2I builder scripts, the run script, and label the Docker 45 | # image so that the 's2i' program knows where to find them. 46 | 47 | COPY openshift/s2i ${HOME}/s2i 48 | COPY openshift/run ${HOME}/run 49 | 50 | LABEL io.k8s.description="S2I builder for hosting files with Apache HTTPD server" \ 51 | io.k8s.display-name="Apache HTTPD Server" \ 52 | io.openshift.expose-services="8080:http" \ 53 | io.openshift.tags="builder,httpd" \ 54 | io.openshift.s2i.scripts-url="image://${HOME}/s2i/bin" 55 | 56 | # Fixup all the directories under the account so they are group writable 57 | # to the 'root' group (gid=0) so they can be updated if necessary, such 58 | # as would occur if using 'oc rsync' to copy files into a container. 59 | 60 | ADD images /opt/app-root/htdocs/images 61 | ADD *.adoc /opt/app-root/htdocs/ 62 | RUN for i in $(ls -1 /opt/app-root/htdocs/*_*.adoc | grep -v 0_toc); do sed -i 's/0_toc.adoc/index.html/g' $i; done 63 | RUN sed -e 's/\.adoc/\.html/g' /opt/app-root/htdocs/0_toc.adoc > /opt/app-root/htdocs/index.adoc 64 | RUN asciidoctor /opt/app-root/htdocs/*.adoc -D /opt/app-root/htdocs/ 65 | RUN rm -rf /opt/app-root/htdocs/*.adoc 66 | 67 | RUN chown -R 1001:0 /opt/app-root && \ 68 | find ${HOME} -type d -exec chmod g+ws {} \; 69 | 70 | # Ensure container runs as non root account from its home directory. 71 | 72 | WORKDIR ${HOME} 73 | 74 | USER 1001 75 | 76 | # Set the Apache httpd server to be run when the container is run. 77 | 78 | CMD [ "/opt/app-root/run" ] 79 | -------------------------------------------------------------------------------- /README.adoc: -------------------------------------------------------------------------------- 1 | 0_toc.adoc -------------------------------------------------------------------------------- /images/OpenShiftContainerPlatform_Logo.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/OpenShiftContainerPlatform_Logo.jpeg -------------------------------------------------------------------------------- /images/OpenShift_Logo_Small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/OpenShift_Logo_Small.png -------------------------------------------------------------------------------- /images/add-project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/add-project.png -------------------------------------------------------------------------------- /images/application_create_screen.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/application_create_screen.jpeg -------------------------------------------------------------------------------- /images/application_create_screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/application_create_screen.png -------------------------------------------------------------------------------- /images/bg-5050-split.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/bg-5050-split.png -------------------------------------------------------------------------------- /images/bg-edit-route.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/bg-edit-route.png -------------------------------------------------------------------------------- /images/bg-route-split-overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/bg-route-split-overview.png -------------------------------------------------------------------------------- /images/bg-routes-page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/bg-routes-page.png -------------------------------------------------------------------------------- /images/bg-slipt-traffic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/bg-slipt-traffic.png -------------------------------------------------------------------------------- /images/blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/blue.png -------------------------------------------------------------------------------- /images/blue_app.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/blue_app.jpg -------------------------------------------------------------------------------- /images/blue_app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/blue_app.png -------------------------------------------------------------------------------- /images/blue_deployment.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/blue_deployment.jpeg -------------------------------------------------------------------------------- /images/blue_deployment.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/blue_deployment.tiff -------------------------------------------------------------------------------- /images/blue_green_active_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/blue_green_active_green.png -------------------------------------------------------------------------------- /images/blue_green_deployment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/blue_green_deployment.png -------------------------------------------------------------------------------- /images/browse-catalog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/browse-catalog.png -------------------------------------------------------------------------------- /images/build-menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/build-menu.png -------------------------------------------------------------------------------- /images/cakephp_confirm.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/cakephp_confirm.jpeg -------------------------------------------------------------------------------- /images/cakephp_confirm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/cakephp_confirm.png -------------------------------------------------------------------------------- /images/cakephp_template.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/cakephp_template.jpeg -------------------------------------------------------------------------------- /images/cakephp_template.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/cakephp_template.png -------------------------------------------------------------------------------- /images/code_promotion_env.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/code_promotion_env.png -------------------------------------------------------------------------------- /images/console_project_overview.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/console_project_overview.jpeg -------------------------------------------------------------------------------- /images/console_project_overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/console_project_overview.png -------------------------------------------------------------------------------- /images/create-route.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/create-route.png -------------------------------------------------------------------------------- /images/create-storage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/create-storage.png -------------------------------------------------------------------------------- /images/dbtest_build.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/dbtest_build.png -------------------------------------------------------------------------------- /images/dbtest_deployment_env.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/dbtest_deployment_env.png -------------------------------------------------------------------------------- /images/dbtest_service.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/dbtest_service.jpeg -------------------------------------------------------------------------------- /images/dbtest_service.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/dbtest_service.png -------------------------------------------------------------------------------- /images/dc_edit.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/dc_edit.jpg -------------------------------------------------------------------------------- /images/dc_edit_raw.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/dc_edit_raw.jpg -------------------------------------------------------------------------------- /images/deploy-config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/deploy-config.png -------------------------------------------------------------------------------- /images/deploy-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/deploy-image.png -------------------------------------------------------------------------------- /images/disable-triggers1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/disable-triggers1.png -------------------------------------------------------------------------------- /images/disable-triggers2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/disable-triggers2.png -------------------------------------------------------------------------------- /images/dockerfile-template.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/dockerfile-template.png -------------------------------------------------------------------------------- /images/dotnet_mysql_create.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/dotnet_mysql_create.png -------------------------------------------------------------------------------- /images/dotnet_mysql_final.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/dotnet_mysql_final.png -------------------------------------------------------------------------------- /images/dotnet_mysql_route.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/dotnet_mysql_route.png -------------------------------------------------------------------------------- /images/dotnet_mysql_template.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/dotnet_mysql_template.png -------------------------------------------------------------------------------- /images/edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/edit.png -------------------------------------------------------------------------------- /images/empty_project_details.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/empty_project_details.jpeg -------------------------------------------------------------------------------- /images/empty_project_details.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/empty_project_details.tiff -------------------------------------------------------------------------------- /images/expand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/expand.png -------------------------------------------------------------------------------- /images/github_add_webhook.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/github_add_webhook.jpg -------------------------------------------------------------------------------- /images/github_add_webhook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/github_add_webhook.png -------------------------------------------------------------------------------- /images/github_show_url.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/github_show_url.jpg -------------------------------------------------------------------------------- /images/github_show_url.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/github_show_url.png -------------------------------------------------------------------------------- /images/green_app.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/green_app.jpg -------------------------------------------------------------------------------- /images/green_app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/green_app.png -------------------------------------------------------------------------------- /images/green_deployment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/green_deployment.png -------------------------------------------------------------------------------- /images/idled_pods.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/idled_pods.jpeg -------------------------------------------------------------------------------- /images/image-details.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/image-details.png -------------------------------------------------------------------------------- /images/jboss_install8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/jboss_install8.jpg -------------------------------------------------------------------------------- /images/jboss_install_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/jboss_install_1.png -------------------------------------------------------------------------------- /images/jboss_install_10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/jboss_install_10.jpg -------------------------------------------------------------------------------- /images/jboss_install_11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/jboss_install_11.jpg -------------------------------------------------------------------------------- /images/jboss_install_12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/jboss_install_12.jpg -------------------------------------------------------------------------------- /images/jboss_install_13.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/jboss_install_13.jpg -------------------------------------------------------------------------------- /images/jboss_install_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/jboss_install_2.png -------------------------------------------------------------------------------- /images/jboss_install_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/jboss_install_3.png -------------------------------------------------------------------------------- /images/jboss_install_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/jboss_install_4.png -------------------------------------------------------------------------------- /images/jboss_install_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/jboss_install_5.png -------------------------------------------------------------------------------- /images/jboss_install_6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/jboss_install_6.jpg -------------------------------------------------------------------------------- /images/jboss_install_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/jboss_install_6.png -------------------------------------------------------------------------------- /images/jboss_install_6a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/jboss_install_6a.jpg -------------------------------------------------------------------------------- /images/jboss_install_7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/jboss_install_7.jpg -------------------------------------------------------------------------------- /images/jboss_install_9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/jboss_install_9.jpg -------------------------------------------------------------------------------- /images/jboss_wizard_configuration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/jboss_wizard_configuration.png -------------------------------------------------------------------------------- /images/jboss_wizard_configuration2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/jboss_wizard_configuration2.png -------------------------------------------------------------------------------- /images/ks-myjbossapp.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/ks-myjbossapp.jpg -------------------------------------------------------------------------------- /images/ks-myjbossapp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/ks-myjbossapp.png -------------------------------------------------------------------------------- /images/list-uploaded-files.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/list-uploaded-files.png -------------------------------------------------------------------------------- /images/login.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/login.jpeg -------------------------------------------------------------------------------- /images/login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/login.png -------------------------------------------------------------------------------- /images/mysql.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/mysql.png -------------------------------------------------------------------------------- /images/mysql_deploymentconfig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/mysql_deploymentconfig.png -------------------------------------------------------------------------------- /images/mysql_ephemeral_creation.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/mysql_ephemeral_creation.jpeg -------------------------------------------------------------------------------- /images/mysql_ephemeral_creation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/mysql_ephemeral_creation.png -------------------------------------------------------------------------------- /images/mysql_ephemeral_template.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/mysql_ephemeral_template.jpeg -------------------------------------------------------------------------------- /images/mysql_ephemeral_template.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/mysql_ephemeral_template.png -------------------------------------------------------------------------------- /images/mysql_pod_on_proj_details.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/mysql_pod_on_proj_details.jpeg -------------------------------------------------------------------------------- /images/mysql_pod_on_proj_details.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/mysql_pod_on_proj_details.png -------------------------------------------------------------------------------- /images/mysql_pod_on_proj_details.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/mysql_pod_on_proj_details.tiff -------------------------------------------------------------------------------- /images/mysql_pod_on_proj_overview.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/mysql_pod_on_proj_overview.jpeg -------------------------------------------------------------------------------- /images/mysql_pod_on_proj_overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/mysql_pod_on_proj_overview.png -------------------------------------------------------------------------------- /images/mysql_secret_binding.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/mysql_secret_binding.png -------------------------------------------------------------------------------- /images/mysql_service.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/mysql_service.jpeg -------------------------------------------------------------------------------- /images/mysql_service.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/mysql_service.png -------------------------------------------------------------------------------- /images/new-project-details.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/new-project-details.png -------------------------------------------------------------------------------- /images/new-project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/new-project.png -------------------------------------------------------------------------------- /images/nexus_repo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/nexus_repo.png -------------------------------------------------------------------------------- /images/overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/overview.png -------------------------------------------------------------------------------- /images/petstore binary deployment.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/petstore binary deployment.jpeg -------------------------------------------------------------------------------- /images/php-catalog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/php-catalog.png -------------------------------------------------------------------------------- /images/php.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/php.png -------------------------------------------------------------------------------- /images/pipeine3.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/pipeine3.jpeg -------------------------------------------------------------------------------- /images/pipeline1.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/pipeline1.jpeg -------------------------------------------------------------------------------- /images/pipeline2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/pipeline2.jpeg -------------------------------------------------------------------------------- /images/pipeline3.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/pipeline3.jpeg -------------------------------------------------------------------------------- /images/project_browse.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/project_browse.jpeg -------------------------------------------------------------------------------- /images/project_build_configuration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/project_build_configuration.png -------------------------------------------------------------------------------- /images/project_build_details.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/project_build_details.jpeg -------------------------------------------------------------------------------- /images/project_build_details.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/project_build_details.png -------------------------------------------------------------------------------- /images/project_details.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/project_details.jpeg -------------------------------------------------------------------------------- /images/project_details.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/project_details.png -------------------------------------------------------------------------------- /images/project_details.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/project_details.tiff -------------------------------------------------------------------------------- /images/project_pod_details.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/project_pod_details.jpg -------------------------------------------------------------------------------- /images/project_pod_details.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/project_pod_details.png -------------------------------------------------------------------------------- /images/project_pods.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/project_pods.jpg -------------------------------------------------------------------------------- /images/project_pods.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/project_pods.png -------------------------------------------------------------------------------- /images/projects_list.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/projects_list.jpeg -------------------------------------------------------------------------------- /images/projects_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/projects_list.png -------------------------------------------------------------------------------- /images/return_to_proj_list.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/return_to_proj_list.jpeg -------------------------------------------------------------------------------- /images/scale_down.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/scale_down.jpg -------------------------------------------------------------------------------- /images/scale_up.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/scale_up.jpg -------------------------------------------------------------------------------- /images/scale_updown_overview.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/scale_updown_overview.jpg -------------------------------------------------------------------------------- /images/scale_updown_overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/scale_updown_overview.png -------------------------------------------------------------------------------- /images/scale_updown_overview_scaled.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/scale_updown_overview_scaled.jpg -------------------------------------------------------------------------------- /images/scale_updown_overview_scaled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/scale_updown_overview_scaled.png -------------------------------------------------------------------------------- /images/search-jenkins.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/search-jenkins.png -------------------------------------------------------------------------------- /images/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/search.png -------------------------------------------------------------------------------- /images/service_catalog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/service_catalog.png -------------------------------------------------------------------------------- /images/service_catalog2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/service_catalog2.png -------------------------------------------------------------------------------- /images/storage-overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/storage-overview.png -------------------------------------------------------------------------------- /images/template-add-to-project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/template-add-to-project.png -------------------------------------------------------------------------------- /images/terminal_view.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/terminal_view.jpg -------------------------------------------------------------------------------- /images/terminal_view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/terminal_view.png -------------------------------------------------------------------------------- /images/topology_button.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/topology_button.jpg -------------------------------------------------------------------------------- /images/topology_details.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/topology_details.jpg -------------------------------------------------------------------------------- /images/topology_view.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/topology_view.jpg -------------------------------------------------------------------------------- /images/upload-app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/upload-app.png -------------------------------------------------------------------------------- /images/version.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/version.png -------------------------------------------------------------------------------- /images/welcome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RedHatWorkshops/openshiftv3-workshop/55f3935dc29e8c3d300e224e5f3603314ac4a891/images/welcome.png -------------------------------------------------------------------------------- /openshift/httpd.conf: -------------------------------------------------------------------------------- 1 | DefaultRuntimeDir ${HOME} 2 | 3 | PidFile ${HOME}/httpd.pid 4 | 5 | DocumentRoot /opt/app-root/htdocs 6 | 7 | 8 | AllowOverride FileInfo AuthConfig Limit Indexes 9 | Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec 10 | Require method GET POST OPTIONS 11 | 12 | -------------------------------------------------------------------------------- /openshift/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Enable SCL Apache HTTPD server package. 4 | 5 | source scl_source enable httpd24 6 | 7 | # Ensure we run the Apache HTTPD server as process ID 1 and in foreground. 8 | 9 | exec httpd -DFOREGROUND 10 | -------------------------------------------------------------------------------- /openshift/s2i/bin/assemble: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eo pipefail 4 | 5 | echo "---> Copying source files" 6 | 7 | rm -rf /tmp/src/.git* 8 | rm -rf /tmp/src/.s2i* 9 | 10 | cp -Rf /tmp/src/. /opt/app-root/htdocs/ 11 | 12 | rm -rf /tmp/src 13 | 14 | echo "---> Fix permissions on source files" 15 | 16 | chmod -Rf g+w /opt/app-root/htdocs || true 17 | -------------------------------------------------------------------------------- /openshift/s2i/bin/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eo pipefail 4 | 5 | exec ${HOME}/run 6 | -------------------------------------------------------------------------------- /resources/13_Using_JBoss_Development_Studio.adoc: -------------------------------------------------------------------------------- 1 | [[installing-the-jboss-developer-studio]] 2 | Installing the JBoss Developer Studio 3 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | 5 | In this exercise we will learn how to install JBDS and configure to 6 | access the OpenShift instance. 7 | 8 | *Step 1: Download and install JBoss Studio* 9 | 10 | * Download the latest JBoss Developer studio from: 11 | http://www.jboss.org/products/devstudio/download 12 | 13 | image:images/jboss_install_1.png[image] 14 | 15 | image:images/jboss_install_2.png[image] 16 | 17 | *Step 2: Install OpenShift Plugin* 18 | 19 | * Open JBoss Studio. 20 | * Navigate to JBoss Central and select ``Software/Update'' tab 21 | * Look for the OpenShift v3 tools 22 | * Select it and install. Accept license agreement. It may warn you about 23 | unsigned content. Ignore it. 24 | 25 | image:images/jboss_install_3.png[image] 26 | 27 | image:images/jboss_install_4.png[image] 28 | 29 | *Step 3: Configure OpenShift v3 Plugin* 30 | 31 | * At the bottom of your IDE, expand the OpenShift explorer panel. 32 | * Add a new connection. 33 | * From the ``Server type'' dropdown box, select OpenShift 3. 34 | * For the Server URL, ensure you add port 8443 if you are not using the 35 | default server FQDN. 36 | * Select the authentication mechanism. 37 | * Provide the username and password. 38 | * Click Finish 39 | 40 | image:images/jboss_install_5.png[image] 41 | 42 | image:images/jboss_install_6.jpg[image] 43 | image:images/jboss_install_6a.jpg[image] 44 | 45 | *Step 4: Verify your connection* 46 | 47 | * At this point, you will be able to see any existing projects for which 48 | the provider username and password have access to. 49 | * You can also see a number of types, such as deployment configurations, 50 | services routes, etc under OpenShift Explorer 51 | image:images/jboss_install_7.jpg[image] 52 | 53 | *Step 5: Create a OpenShift Application* 54 | 55 | * Go to JBoss Studio, right click on the OpenShift connection –> select 56 | New –> select project 57 | * Enter javatest as the new of the project. 58 | * From the JBoss Studio menu, Select File –> New –> OpenShift 59 | Application 60 | * Make sure the information is correct and enter username and password 61 | * Click next. 62 | 63 | image:images/jboss_install8.jpg[image] 64 | 65 | * Select the newly created project from the project dropdown list 66 | * Select the eap64-basic-s2i template from the list 67 | * Click Next 68 | 69 | image:images/jboss_install_9.jpg[image] 70 | 71 | * Select Parameters listed below and enter the values 72 | ** APPLICATION_DOMAIN:mytestapp-javatest-Username.apps.osecloud.com 73 | ** APPLICATION_NAME:mytestapp 74 | ** CONTEXT_DIR: 75 | ** SOURCE_REPOSITORY_REF: 76 | ** SOURCE_REPOSITORY_URL: https://github.com/RedHatWorkshops/kitchensink 77 | * Then, click edit to update the values of the parameters. 78 | * Click ok after update each parameter. 79 | * Click Next after updating all the parameters 80 | * Click Finish. 81 | 82 | image:images/jboss_install_10.jpg[image] 83 | 84 | * Click OK 85 | 86 | image:images/jboss_install_11.jpg[image] 87 | 88 | * Click Finish 89 | 90 | image:images/jboss_install_12.jpg[image] 91 | 92 | * Review the status under OpenShift Explorer 93 | 94 | image:images/jboss_install_13.jpg[image] 95 | 96 | link:0_toc.adoc[Table Of Contents] 97 | -------------------------------------------------------------------------------- /resources/NUMBER_title_of_lab_with_underscores.adoc: -------------------------------------------------------------------------------- 1 | [[main-heading-shortname]] 2 | Main Heading - Lab Name 3 | ~~~~~~~~~~~~~~~~~~~~~~ 4 | 5 | The purpose of this short lab is to demonstrate how... 6 | 7 | 8 | In this Lab, we will be: 9 | 10 | * Item x 11 | * Item x 12 | * Item x 13 | * Item x 14 | 15 | 16 | [[subheading-shortnames]] 17 | Subheading 18 | ^^^^^^^^^^ 19 | 20 | 21 | *Step 1: Discription* 22 | 23 | .... 24 | COMMANDS 25 | .... 26 | 27 | *Step 2: Discription* 28 | 29 | .... 30 | COMMANDS 31 | .... 32 | 33 | *Step X: Discription* 34 | 35 | .... 36 | COMMANDS 37 | .... 38 | 39 | image:images/image_name.png[image] 40 | 41 | [[subheading-shortnames]] 42 | Subheading 43 | ^^^^^^^^^^ 44 | 45 | *Step 1: Discription* 46 | 47 | .... 48 | COMMANDS 49 | .... 50 | 51 | *Step 2: Discription* 52 | 53 | .... 54 | COMMANDS 55 | .... 56 | 57 | *Step X: Discription* 58 | 59 | .... 60 | COMMANDS 61 | .... 62 | 63 | image:images/image_name.png[image] 64 | 65 | [[summary]] 66 | Summary 67 | ^^^^^^^ 68 | 69 | Summary goes here 70 | 71 | link:0_toc.adoc[Table Of Contents] 72 | --------------------------------------------------------------------------------