Skip to content

Latest commit

 

History

History
372 lines (292 loc) · 16 KB

redhat-cloud-suite-devops-demo.adoc

File metadata and controls

372 lines (292 loc) · 16 KB

Red Hat Cloud Suite Modernize Develops and Operations

1. Overview

This demonstration covers running and discovering (CloudForms) a micro-services based application (JBoss EAP on OpenShift) utilizing persistent storage (OpenStack Cinder) using S2I services (OpenShift) to show Continuous Integration capabilities.

Goal
  • Review the currently deployed JBoss EAP application running on OpenShift

    • The web tier is built with JBoss EAP running on OpenShift.

  • Review the persistent storage mapping from OpenStack to OpenShift with a persistent volume claim configured for the sales-db pod

    • The sales database is built with a MySQL persistent pod, backed by a Cinder persistent volume from OpenStack which allows for sales transaction persistence if the pod is re-built

  • Update the JBoss EAP web application code and use OpenShift S2I capabilities to re-build and re-deploy the image demonstrating Continuous Integration capabilities

  • Use CloudForms to review the discovered container provider and details of running services

    • CloudForms provides visibility into the running container environment and underlying infrastructure

Prereqs
  • Users should have a basic understanding of OpenShift, OpenStack, CloudForms, and JBoss EAP.

1.1. Environment

The demo environment consists of the following systems:

Hostname

Internal IP

Description

workstation.example.com

192.168.0.5

Bastion Host

comp00.example.com

192.168.0.30

OpenStack Compute Node #1

comp01.example.com

192.168.0.31

OpenStack Compute Node #2

cf.example.com

192.168.0.100

CloudForms Appliance

ctrl.example.com

192.168.0.20

OpenStack Controller

openshift-master.example.com

192.168.1.250

OpenShift all-in-one

2. Provision Your Demo Environment

  1. Log in to https://rhpds.redhat.com with your OPENTLC SSO credentials.

  2. Go to Services → Catalogs → Service Catalogs.

  3. Under All Services → Red Hat Cloud Suite Demos, select Modernize Development and Operations Demo.

  4. On the right, click Order.

  5. Read all of the information on the resulting page, check the necessary box, and then click Submit.

Important
It takes about 30 minutes for your demo to load completely and become accessible, even if some of the systems are marked "Up." You will receive an email with information about how to access your demo environment. The email contains a list of hostnames, IP addresses, and your GUID; make note of them. Whenever you see GUID in the demo instructions, replace it with the GUID provided in the email. You can get real-time updates of your demo environment at: https://www.opentlc.com/rhpds-status
Tip
Be very mindful of the runtime of your demo environment! It may take you several hours to complete the demo, so you may have to extend the runtime. This is especially important in later steps, when you are building the VMs. For information on how to extend runtime and lifetime, see: https://www.opentlc.com/lifecycle

3. Getting Started

  1. Login into the OpenStack dahsboard and start both OpenShift instances:

    • Username: admin

    • Password: r3dh4t1!

    • Click on Project and Instances

    • Next to each instance click "Start Instance"

    • Click on Volumes and review the Cinder volume used for persistent storage <datagrid>

  1. Login to the CloudForms appliance:

    • Username: admin

    • Password: r3dh4t1!

4. Review the Environment

Red Hat Cloud Suite enables end users to create, deploy and update micro-services based applications.

OpenShift Enterprise Console: https://<IP_ADDRESS_OF_WORKSTATION>:8443/console

  1. Once the OpenShift environment is up and running login to the OSE console:

    • Username: admin

    • Password: r3dh4t1!

    • Select the JBoss project

    • Review the running pods associated with JBoss EAP

4.1. JBoss EAP Microservices Based Application

Consists of JBoss EAP 6 running a series of microservices to include (based on the following https://access.redhat.com/articles/2094731 ): * MySQL product database * MySQL sales database w/persistent storage * Product service * Sales service * Billing service * Presentation service

4.2. Persistent Storage with OpenStack Cinder

The envrionment is configured with persistent storage that maps a Cinder volume in OpenStack to a persistent volume in OpenShift. A persistent claim is then mapped to the volume and provides storage to the sales-db pod.

  1. On the OpenShift all-in-one instance (openshift-master.example.com) review the persistent volume and claim

    • From the cli:

oc get pv and oc get pvc
  • From the console under the Jboss project, navigate to Browse, Pods. Locate and click on the sales-db pod. Review the volumes attached.

5. Updates

By utilizing OpenShift it’s possible to streamline the deployment of new code changes through a Continuous Integration (CI) pipeline. For example, if a change is made in the product description or if new products are added, this code change can easily be committed and then updated via OpenShift S2I build capabilities.

5.1. Updating the Application

No one codes correctly all the time. On occasion, you may want to revert to a previous incarnation of your application to restart a programming task. Other times, you may want to move to a newer version.

In this section, you modify products.jsp for the web application and then rebuild.

The next sections require a GitHub account.

5.2. Fork Repository

If you have not done so already: from the Git web interface, click Fork in the upper right corner of the GitHub web UI to fork the Git repository https://github.com/RHsyseng/OpenShift3-MSA into your own account.

5.3. Change and Build

  1. Log into the ose-master node.

    • ssh -i .ssh/id_rsa <RHPDS_username>@workstation-<GUID>.rhpds.opentlc.com

    • su - <r3dh4t1!>

    • ssh ctrl

    • ssh -i openshift.pem [email protected]

    • su - <r3dh4t1!>

  2. Login to OpenShift and change to the JBoss project.

    • oc login

    • admin

    • r3dh4t1!

oc project jboss
  1. View the current buildconfig for your application:

    [root@openshift-all-in-one ~]# oc get buildconfig presentation -o yaml
  2. Verify that the output is similar to the following:

    apiVersion: v1
    kind: BuildConfig
    metadata:
      annotations:
        openshift.io/generated-by: OpenShiftNewApp
      creationTimestamp: 2016-04-14T23:56:30Z
      labels:
        app: presentation
      name: presentation
      namespace: jboss
      resourceVersion: "399512"
      selfLink: /oapi/v1/namespaces/jboss/buildconfigs/presentation
      uid: 82209605-029c-11e6-b8cb-fa163ec12457
    spec:
      output:
        to:
          kind: ImageStreamTag
          name: presentation:latest
      resources: {}
      source:
        contextDir: Presentation
        git:
          uri: https://github.com/RHsyseng/OpenShift3-MSA.git
        type: Git
      strategy:
        sourceStrategy:
          from:
            kind: ImageStreamTag
            name: jboss-eap64-openshift:latest
            namespace: openshift
        type: Source
      triggers:
      - github:
          secret: dPpSoxzzzguAa7cnHNTu
        type: GitHub
      - generic:
          secret: P2XnWtincLegzozRxs2H
        type: Generic
      - type: ConfigChange
      - imageChange:
          lastTriggeredImageID: registry.access.redhat.com/jboss-eap-6/eap64-openshift:latest
        type: ImageChange
    status:
      lastVersion: 4
  3. Observe that the current configuration points at the RHsyseng/OpenShift3-MSA repository.

    • Because you forked this repository earlier, you can now repoint your configuration.

5.4. Repoint Your Configuration

  1. Run oc edit to repoint the configuration.

    [root@openshift-all-in-one ~]#  oc edit bc presentation
    1. Change the uri reference to match the name of your GitHub repository, which is based in part on your GitHub username: https://github.com/GitHubUsername/RHsyseng/OpenShift3-MSA.

      Important
      Replace GitHubUsername with your actual GitHub username. For example, if your GitHub username is jeandeaux, the name of your GitHub repository is 'https://github.com/jeandeaux/OpenShift3-MSA.
    2. Save and exit vi by typing :wq.

      Note
      There are other ways to achieve this outcome, this way is used to cover the oc edit and the oc start-build commands.
  2. Run oc get buildconfig presentation -o yaml again. Notice that uri has been updated.

  3. Run oc get builds to check if the new build has started:

    [root@openshift-all-in-one ~]# oc get builds

    If the build has not started yet, you can start it yourself and then follow build-log:

    [root@openshift-all-in-one ~]# oc get bc
    NAME               TYPE      SOURCE
    presentation   Docker    https://github.com/YOURUSERNAME/OpenShift3-MSA
    
    [root@openshift-all-in-one ~]# oc start-build presentation
    presentation-5
    
    [root@openshift-all-in-one ~]# oc get builds -w
    NAME             TYPE      FROM      STATUS    STARTED                  DURATION
    presentation-5   Source    Git       Running   Less than a second ago
    presentation-5   Source    Git@4e02049   Running   15 seconds ago   15s
    presentation-5   Source    Git@4e02049   Complete   5 minutes ago   5m3s
    
    [root@openshift-all-in-one ~]# oc logs -f bc/presentation
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 2:56.796s
    [INFO] Finished at: Thu Apr 21 17:55:01 EDT 2016
    [INFO] Final Memory: 29M/805M
    [INFO] ------------------------------------------------------------------------
    Copying all war artifacts from /home/jboss/source/target directory into /opt/eap/standalone/deployments for later deployment...
    Copying all ear artifacts from /home/jboss/source/target directory into /opt/eap/standalone/deployments for later deployment...
    Copying all rar artifacts from /home/jboss/source/target directory into /opt/eap/standalone/deployments for later deployment...
    Copying all jar artifacts from /home/jboss/source/target directory into /opt/eap/standalone/deployments for later deployment...
    Copying all war artifacts from /home/jboss/source/deployments directory into /opt/eap/standalone/deployments for later deployment...
    '/home/jboss/source/deployments/ROOT.war' -> '/opt/eap/standalone/deployments/ROOT.war'
    Copying all ear artifacts from /home/jboss/source/deployments directory into /opt/eap/standalone/deployments for later deployment...
    Copying all rar artifacts from /home/jboss/source/deployments directory into /opt/eap/standalone/deployments for later deployment...
    Copying all jar artifacts from /home/jboss/source/deployments directory into /opt/eap/standalone/deployments for later deployment...
    .......
    Cropped Output
    .......

5.5. Application Update

The advantage of running OpenShift is the ability support continuous integration. Build and deploy often and early. For this demo we will change the deployed products pod to reflect a change in the web UI.

  1. Access the web UI for the JBoss EAP deployment

    • http://<IP_ADDRESS_OF_WORKSTATION>;

    • For products listed, under the price displays "Avaiability"

    • In your forked git repo for the demo, navigate to Presentation > src/main > webapp and edit products.jsp

    • Change "Available" to "In Stock" and commit the change

  2. Rebuild and redeploy the presentation pod from the OpenShift console

    • Login to the OpenShift console: https://<IP_ADDRESS_OF_WORKSTATION:8443/console

    • Select the JBoss project

    • Navigate to Browse > Builds

    • Select the presentation build and click "Start Build"

    • Progress of the build can be monitored from the cli on the OpenShift Master

[root@openshift-all-in-one ~]# oc logs -f bc/presentation
[INFO] Building war: /home/jboss/source/deployments/ROOT.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:59.491s
[INFO] Finished at: Fri Apr 22 11:49:22 EDT 2016
[INFO] Final Memory: 30M/834M
[INFO] ------------------------------------------------------------------------
Copying all war artifacts from /home/jboss/source/target directory into /opt/eap/standalone/deployments for later deployment...
Copying all ear artifacts from /home/jboss/source/target directory into /opt/eap/standalone/deployments for later deployment...
Copying all rar artifacts from /home/jboss/source/target directory into /opt/eap/standalone/deployments for later deployment...
Copying all jar artifacts from /home/jboss/source/target directory into /opt/eap/standalone/deployments for later deployment...
Copying all war artifacts from /home/jboss/source/deployments directory into /opt/eap/standalone/deployments for later deployment...
'/home/jboss/source/deployments/ROOT.war' -> '/opt/eap/standalone/deployments/ROOT.war'
Copying all ear artifacts from /home/jboss/source/deployments directory into /opt/eap/standalone/deployments for later deployment...
Copying all rar artifacts from /home/jboss/source/deployments directory into /opt/eap/standalone/deployments for later deployment...
Copying all jar artifacts from /home/jboss/source/deployments directory into /opt/eap/standalone/deployments for later deployment...
.......
Cropped Output
.......
  1. Verify changes

6. Visibility of Environment

CloudForms provides the first glimpses of what unified management of containers, virtual machines, and physical infrastructure will look like. In this section we will observe that the OpenShift environment has been added as a Container Provider in CloudForms and review the relational data associated with the environment.

6.1. Container provider

  1. Access the CloudForms appliance

    • Open a browser and navigate to the CloudForms appliance. The URL will be located in the e-mail received after ordering the catalog item in the RHPDS system https://<CFME_EXTERNAL_HOSTNAME>; admin/r3dh4t1!

    • Navigate to Containers > Providers and click the OSE provider listed

    • Click Configuratio > Refresh items and relationships

After a few minutes the Container Provider will refresh the environment info

6.2. Relating Containers and Infrastructure

  1. Explore the container provider environment

    • Click Projects > Jboss. Review the Relationships info

    • Click Routes. Notice the "presentation" route listed. This allows external connectivity to the running JBoss EAP web UI

    • Click Container Services. Select a service on the list and note the Pods and Nodes related under Relationships

    • Click Replicators. This tab represents replicas associated to the pods. If a pod fails OpenShift will automatically redeploy

    • Click Pods. This is a list of pods and status of each for the environment

    • Click Containers. Notice the sti-build items and assocaited pods. This provides the source to image CI capabilities demonstrated previously

    • Click Container Nodes. This displays the OpenShift nodes in the environment.

    • Click Image Registries. This is the local docker registry running on OpenShift and is where the JBoss EAP images reside

    • Click Container Images. This is a list of all container images located in the registry

    • Click Topology. This is a graphical representation of the environment. You can hover over items for a brief description

7. Extra credit

The JBoss EAP application provides order functionality in the web UI for products listed. Create a test user and purchase several products.

  1. Create a test user

  2. Purchase products

    • As the test user select several products from the web UI to purchase

    • Once you have selected the desired items click the cart/checkout icon in the upper right

    • Click Checkout at the bottom

    • Enter false credit card info. Make sure the expiration date for the credit card is a month/year into the future

    • Click Submit

    • The page will refresh back to the main web UI and in the upper right "Your order has been processed" will appear

    • Additionally you can logout os the test user and log back in to check order history to verify persistence