This code pattern shows how to modernize a Java EE application running on Open Liberty by transforming it into Kubernetes-based microservices. It demonstrates steps to create a container image of a RESTful application for a conceptual health records system connected to a MySQL database and deployed in an enterprise Kubernetes environment.
This sample code is part of a series of code patterns that focuses on a fictional health care company and demonstrates app modernization using the enterprise Kubernetes environment of Red Hat OpenShift on IBM Cloud™. You learn how to populate and access large amounts of data on a MySQL database using REST APIs from a Java EE application. In addition, you use OpenShift’s Source-to-Image toolkit by deploying both Node.js and PHP web applications that make RESTful calls to the APIs from the Java EE application and display the data from the MySQL database. To learn more about Source to Image, you can watch this video.
“Example Health” is a conceptual healthcare or health insurance company. It has been around a long time and has hundreds of thousands of patient records. The company’s health records look very similar to the health records of most insurance companies.
Originally, Example Health used a monolithic application structure for the health records application. The application structure was a full stack Java application running on WebSphere Application Server, connected to a DB2 database on System z.
Recently, Example Health decided to modernize the health records application and break it up into microservices. The development team decided to move to a SQL database connected to a Java EE application (as shown in this code pattern) running on Open Liberty for the business logic and a Node.js application for the patient application user interface. In addition, Example Health decided to deploy these applications on Red Hat OpenShift on IBM Cloud.
Since moving to OpenShift, Example Health has expanded to include new microservices that include a PHP application](/patterns/app-modernization-php-s2i-openshift/) for health records administrators and a Node.js analytics application.
When you use this code pattern, you understand how to transform a traditional Java application into microservices on the cloud.
- The user makes a call to one of the APIs for the Java EE application, which is behind the OpenShift application load balancer.
- The load balancer routes the call to the Open Liberty container running in a Kubernetes pod.
- The Java EE application queries the MySQL database running in the cloud to get the desired data.
- The MySQL database sends back the data to the Java EE application, where it is handled accordingly.
Ready to give it a try? Find detailed technical steps for this code pattern in the README.md file in the GitHub repository.
- Create a Red Hat OpenShift on IBM Cloud cluster.
- Provision a Compose for MySQL database.
- Create a Docker container image of a Java EE application.
- Push the container image to a Docker Hub repository.
- Change the image key in the
- Edit the secret values for your MySQL cloud deployment.
- Set database access parameters for an Open Liberty server.
- Deploy the application to the Red Hat OpenShift on IBM Cloud cluster.
- Expose the application to the internet.
- Populate the MySQL database with synthetic patient health records.