App Modernization with PHP Source to Image on OpenShift
This project is a conceptual PHP web application for a health records system, designed to showcase best in class integration of modern cloud technology running on OpenShift as a Source to Image (S2I) application.
Example Health Context
Example Health is a conceptual healthcare/insurance type company. It has been around a long time, and has 100s of thousands of patient records. Example's health records look very similar to the health records of most insurance companies.
Originally, Example Health used a monolithic application structure for their application. Their application structure was a full stack Java application running on WebSphere connected to a DB2 database on System z. Here's what the original architecture for Example Health looked like:
Recently, Example Health decided to modernize their application and break it up into microservices. They decided to move to a SQL database connected to a Java EE application running on Open Liberty for the business logic and a Node.js application for the Patient UI. In addition, Example Health also decided to bring these applications to OpenShift in the Cloud. The new current architecture for Example Health looks like this:
Since moving to OpenShift, Example Health has expanded to include new microservices that include an Admin application (the application found in this repo) and an Analytics application.
This Admin application is used for Administrators of Example Health to view all of the patients that are a part of Example Health along with some statistical breakdowns of the patients that include:
- Top three medications used
- Diabetes prevalence
- Asthma prevalence
Here's a view an administrator might see when they interact with the Example Health Admin Application:
- User opens PHP application in a browser.
- 2a: If no API URL is specified, the PHP application will populate the application with local data from JSON files.
- 2b: If an API URL is specified, the PHP application will populate the application with data from REST API calls of the Example Health JEE Application on Openshift.
Follow these steps to setup and run this code pattern on OpenShift. The steps are described in detail below.
- Sign up for an IBM Cloud account if you do not have one. You must have a Pay-As-You-Go or Subscription account to deploy this code pattern. See https://cloud.ibm.com/docs/account?topic=account-upgrading-account to upgrade your account.
2. Fork the repo
Scroll to the top of this repo and press the Fork button.
Select the account from the list that you would like to fork the repo to.
3. Deploy to OpenShift
- Provision an OpenShift Cluster.
NOTE: This step can take about 30 minutes
- Open the OpenShift web console.
- Create a new project by selecting Create Project in the top right corner. Give the project a name and press Create. Once the project is created, locate and open the project from your project list to get to the project console.
- Once in the project console, press Browse Catalog. Locate and choose PHP from the catalog.
- A new window should appear for setting up the configurations. When at Step 2: Configuration, open the Advanced Options
- Fill out the following and then press Create:
- Git Repository URL
NOTE: This is in reference to the forked repo
- Context Dir
NOTE: The context directory for this application is
- Build Configuration Environment Variables
NOTE: This is optional if you are planning on deploying and running the Example Health JEE Application on Openshift. The variable name is
apiBaseUrland the value is the API Base URL of the Example Health JEE Application.
- Continue to the project overview and open the dropdown to follow the progress of deploying the application in the logs. This should take a couple minutes. Once the deployment and build are finished, you can now access the application from the provided URL.
4. Update the gateway timeout settings
NOTE: This step is only necessary if you have set up the Example Health JEE Application on Openshift.
The default OpenShift timeout for the gateway is 30 seconds. This is too short for long running REST API calls. To increase the timeout time, do the following:
- From the menu on the left of the console, go to Applications > Routes and select the route for this application.
- On the right side, press Actions > Edit YAML
haproxy.router.openshift.io/timeout: 5mto the metadata > annotations of the YAML file.
- Save the YAML file and open the application from the provided URL.
This code pattern is licensed under the Apache License, Version 2. Separate third-party code objects invoked within this code pattern are licensed by their respective providers pursuant to their own separate licenses. Contributions are subject to the Developer Certificate of Origin, Version 1.1 and the Apache License, Version 2.