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
Prerequisites
- The instructor should Setup Workshop Environment
- The student should Setup CLI and Terminal Shell
- An user with cluster-admin (ie kubeadmin) needs to deploy a DB2 instance to be shared by all the users
oc new-project db2oc create -n db2 serviceaccount mysvcacctoc adm policy add-scc-to-user privileged system:serviceaccount:db2:mysvcacctoc 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"(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.
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).
Set
TOOLKIT_USERNAME
environment variable. If you are participation in a workshop replaceuserdemo
with your assigned username (ex.user01
).TOOLKIT_USERNAME=userdemoLogin 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
- If using a cluster that was configured with the workshop scripts outside IBM Cloud then use respective assigned username (ex.
user01
), and the password ispassword
oc login $OCP_URL -u $TOOLKIT_USERNAME -p passwordSet
TOOLKIT_PROJECT
environment variable If you are participation in a workshop replaceprojectdemo
based on your assigned username (ex.project01
).TOOLKIT_PROJECT=projectdemoCreate a project/namespace using your project prefix, and
-dev
and suffixoc sync $TOOLKIT_PROJECT-devFork 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
andpassword
) - Click Fork Repository
Setup environment variable
GIT_URL
for the git url using the value from previous step or as followingGIT_REPO=appmod-liberty-toolkitGIT_URL=http://${TOOLKIT_USERNAME}:password@$(oc get route -n tools gogs --template='{{.spec.host}}')/${TOOLKIT_USERNAME}/${GIT_REPO}echo GIT_URL=${GIT_URL}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.
- Notice above that the Toolkit
Verity that the Pipeline started using the URL printed by the command
This is a good moment to take a break as the pipelines will take a few minutes.
Verify that Pipeline Run completed successfully
Review the Pipeline Tasks/Stages
- Test
- Open SonarQube from Console Link
- Open Registry from Console Link
- Open Artifactory from Console Link
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
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
Review the Applications in ArgoCD
- Filter by Namespace
${TOOLKIT_PROJECT}-qa
(ie project01-qa) - Review Application:
${TOOLKIT_PROJECT}-websphere-liberty
(ie project01-websphere-liberty)
- Filter by Namespace
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
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.
Congratulations you finished this activity, continue with another lab in the workshop