Skip to main contentCloud-Native Toolkit

Workshop - Application Modernization DevOps, Monolith to Container

  • Application Modernization DevOps, Monolith to Container.
  • The following steps will deploy the modernized Customer Order Services application in a WebSphere Liberty container to a Red Hat OpenShift cluster.
  • The DevOps process is composed of Continous Integration (CI) with OpenShift Pipelines (Tekton) and Continous 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 gogs --template='{{.spec.host}}')/toolkit/appmod-liberty-toolkit/raw/master/db2/db2-dc.yaml"
    oc apply -n db2 -f "http://$(oc get route -n tools gogs --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
    • 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 user01, user02, etc.. for users and password for password).
  4. Set TOOLKIT_USERNAME environment variable. If you are participation in a workshop replace userdemo with your assigned username (ex. user01).

    TOOLKIT_USERNAME=userdemo
  5. Login to OpenShift using oc

    • If using IBM Cloud cluster then login with your IBM account email and IAM API Key or Token by using the Copy Login Command Login
    • If using a cluster that was configured with the workshop scripts outside IBM Cloud then use respective assigned username (ex. user01), and the password is password
    oc login $OCP_URL -u $TOOLKIT_USERNAME -p password
  6. Set TOOLKIT_PROJECT environment variable If you are participation in a workshop replace projectdemo based on your assigned username (ex. project01).

    TOOLKIT_PROJECT=projectdemo
  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 userdemo 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 gogs --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 reposistory. The pipeline step gitops is pushing the application manifest into the GitOps git repository

    • Open Git Ops from Console link
    • Navigate to project01/qa/project01/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 project01-qa-websphere-liberty)
    • ArgoCD Project: default
    • Sync Policy: Automatic (Check prune resources and self heal)
    • Repository URL: http://gogs.tools:3000/toolkit/gitops.git
    • Revision: HEAD
    • Path: qa/${TOOLKIT_PROJECT}/appmod-liberty-toolkit (ie project01/qa/project01/appmod-liberty-toolkit)
    • Cluster: in-cluster
    • Namespace: ${TOOLKIT_PROJECT}-qa (ie. project01-qa)
    • Click CREATE
  17. Review the Applications in ArgoCD

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

    • Switch to Developer perspective
    • Select Topology from the menu
    • Switch to project ${TOOLKIT_PROJECT}-qa (ie project01-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