storigoe / php-s2i-openshift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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:

  • Age
  • Gender
  • 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:

Architecture

  1. 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.

Steps

Follow these steps to setup and run this code pattern on OpenShift. The steps are described in detail below.

  1. Prerequisites
  2. Fork the repo
  3. Deploy to OpenShift
  4. Update the gateway timeout settings

1. Prerequisites

2. Fork the repo

  1. Scroll to the top of this repo and press the Fork button.

  2. Select the account from the list that you would like to fork the repo to.

3. Deploy to OpenShift

  1. Provision an OpenShift Cluster.

NOTE: This step can take about 30 minutes

  1. Open the OpenShift web console.

  1. 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.

  1. Once in the project console, press Browse Catalog. Locate and choose PHP from the catalog.

  1. A new window should appear for setting up the configurations. When at Step 2: Configuration, open the Advanced Options

  1. Fill out the following and then press Create:
    • Name
    • Git Repository URL

    NOTE: This is in reference to the forked repo

    • Context Dir

    NOTE: The context directory for this application is /src

    • 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 apiBaseUrl and the value is the API Base URL of the Example Health JEE Application.

  1. 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:

  1. From the menu on the left of the console, go to Applications > Routes and select the route for this application.

  1. On the right side, press Actions > Edit YAML

  1. Add haproxy.router.openshift.io/timeout: 5m to the metadata > annotations of the YAML file.

  1. Save the YAML file and open the application from the provided URL.

License

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.

Apache License FAQ

About

License:Apache License 2.0


Languages

Language:CSS 55.2%Language:PHP 44.8%