Skip to content

Latest commit

 

History

History
139 lines (106 loc) · 6.65 KB

File metadata and controls

139 lines (106 loc) · 6.65 KB

Application Modernization DevOps, Monolith to Container

<iframe width="100%" height="500" src="https://www.youtube-nocookie.com/embed/ss9joPm2M1U" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

This section will cover:

  • Application Modernization DevOps, Monolith to Container
  • Deploy the modernized Customer Order Services application in a WebSphere Liberty container to a Red Hat OpenShift cluster
  • The DevOps process is composed of Continuos Integration (CI) with OpenShift Pipelines (Tekton) and Continuos Deployment (CD) with GitOps engine ArgoCD
  1. Prerequisites

    oc new-project db2
    oc create -n db2 serviceaccount mysvcacct
    oc adm policy add-scc-to-user privileged system:serviceaccount:db2:mysvcacct
    oc apply -n db2 -f "http://$(oc get route -n tools gitea --template='{{.spec.host}}')/toolkit/appmod-liberty-toolkit/raw/master/db2/db2-dc.yaml"
    oc apply -n db2 -f "http://$(oc get route -n tools gitea --template='{{.spec.host}}')/toolkit/appmod-liberty-toolkit/raw/master/db2/db2-service.yaml"
  2. (Optional) Analyze the application using the following guide Modernizing runtimes with Liberty

    • Download Transformation Advisor
    • The results of a Data Collector is already provided provided download AppSrv01.zip{: target=_blank}
    • Upload the data collection into Transformation Advisor
    • Review the CustomerOrderServicesApp.ear analysis
    • The migration path files have been deployed to git for this lab.
  3. Instructor will provide the following info:

    • OpenShift Console URL (OCP_CONSOLE_URL)
    • The username and password for OpenShift and Git Server (default values are user1, user2, etc.. for users and password for password).
  4. Set TOOLKIT_USERNAME environment variable replace user1 with assigned usernames

    TOOLKIT_USERNAME=user1
  5. (Skip if using KubeAdmin or IBM Cloud) Login into OpenShift using oc

    • If you are using an IBM Cloud cluster login with your IBM account email and IAM API Key or Token, if using a cluster that was configured with the workshop scripts outside IBM Cloud then use user1 or respective assigned username, and the password is password
    oc login $OCP_URL -u $TOOLKIT_USERNAME -p password
  6. Set TOOLKIT_PROJECT environment variable replace project1 or projectx based on user id assigned

    TOOLKIT_PROJECT=project1
  7. Create a project/namespace using your project prefix, and -dev and suffix

    oc sync $TOOLKIT_PROJECT-dev
  8. Fork Inventory Sample Application Java

    • Open Developer Dashboard from the OpenShift Console
    • Select Starter Kits
    • Select Liberty AppMod (Java)
    • Click Fork
    • Login into GIT Sever using the provided username and password (ie user1 and password)
    • Click Fork Repository
  9. Setup environment variable GIT_URL for the git url using the value from previous step or as following

    GIT_REPO=appmod-liberty-toolkit
    GIT_URL=http://${TOOLKIT_USERNAME}:password@$(oc get route -n tools gitea --template='{{.spec.host}}')/${TOOLKIT_USERNAME}/${GIT_REPO}
    echo GIT_URL=${GIT_URL}
  10. Create a pipeline for the application

    oc pipeline --tekton \
    ${GIT_URL}#master \
    --pipeline ibm-appmod-liberty \
    -p scan-image=false \
    -p health-endpoint=/ \
    -p java-bin-path=CustomerOrderServicesApp/target
    • Notice above that the Toolkit pipeline CLI plugin accepts pipeline names and parameters
    • The endpoint to check that the external access is possible is /
    • The Java bin path is not located based on the root of the git repository and instead in CustomerOrderServicesApp/target
    • Every application would have custom values you can pass them to the pipeline as parameters.
  11. Verity that the Pipeline started using the URL printed by the command

  12. This is a good moment to take a break as the pipelines will take a few minutes.

  13. Verify that Pipeline Run completed successfully

  14. Review the Pipeline Tasks/Stages

    • Test
    • Open SonarQube from Console Link
    • Open Registry from Console Link
    • Open Artifactory from Console Link
  15. Review the Application in GitOps git repository. The pipeline step gitops is pushing the application manifest into the GitOps git repository

    • Open Git Ops from Console link
    • Navigate to project1/qa/project1/appmod-liberty-toolkit
    • Review the Helm Chart for the Application
  16. Register the Application in ArgoCD to deploy using GitOps

    • Select ArgoCD from the Console Link and login using OpenShift login
    • Click NEW APP
    • Application Name: ${TOOLKIT_PROJECT}-qa-websphere-liberty (ie project1-qa-websphere-liberty)
    • ArgoCD Project: default
    • Sync Policy: Automatic (Check prune resources and self heal)
    • Repository URL: http://gitea.tools:3000/toolkit/gitops.git
    • Revision: HEAD
    • Path: qa/${TOOLKIT_PROJECT}/appmod-liberty-toolkit (ie project1/qa/project1/appmod-liberty-toolkit)
    • Cluster: in-cluster
    • Namespace: ${TOOLKIT_PROJECT}-qa (ie. project1-qa)
    • Click CREATE
  17. Review the Applications in ArgoCD

    • Filter by Namespace ${TOOLKIT_PROJECT}-qa (ie project1-qa)
    • Review Application: ${TOOLKIT_PROJECT}-websphere-liberty (ie project1-websphere-liberty)
  18. Review the Application in OpenShift

    • Switch to Developer perspective
    • Select Topology from the menu
    • Switch to project ${TOOLKIT_PROJECT}-qa (ie project1-qa)
    • Click on the route url from the appmod-liberty-toolkit deployment, or the link on the circle.
    • Add /CustomerOrderServicesWeb to the end of the URL in the browser to access the application
    • Log in to the application with username: rbarcia and password: bl0wfish
  19. Now the Websphere application is ready, the development teams can make changes to git repository for the application, while the gitops git repository is owned by the operations team.

  20. Congratulations you finished this activity, continue with another lab in the workshop