Skip to content

Python web-based container application to demonstrate application modernization

License

Notifications You must be signed in to change notification settings

jwcroppe/python-db-web

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Container-based Python App for Application Modernization

This is a sample container-based web application that connects to a MySQL 3.23 database (selected because it can be "yum" installed atop AIX 7.2 and returns some high-level fictitious employee data. The primary purpose of sample is to demnonstrate application modernization--i.e., transforming a monolithic application to leverage container technology for the web tier and keeping the database tier on an AIX LPAR. This allows users to leverage new technologies and development practices as well as harness all the inherent security and performance benefits of their Power Systems.

Note that while MySQL was used for this sample application, this same concept extends to any enterprise database, including Oracle, Db2, etc.

Prerequisites

This application assumes that you have already deployed the database tier on the IBM Power Virtual Server cloud. If you haven't, please follow these steps.

Building

The Dockerfile has been provided if you would like to build the container yourself, otherwise it is also available on Docker Hub here.

docker build -t python-db-web:latest .

Installation

There are a variety of ways in which this application can be run. You can run this as a standable application or as a container. The following environment variables can be set to alter behavior:

SSH_REMOTE_SERVER - remote endpoint address for the SSH tunnel
SSH_REMOTE_PORT - remote endpoint port for the SSH tunnel (default: 22)
SSH_REMOTE_USER_NAME - user name on the remote SSH server (default: root)
SSH_REMOTE_PASSWORD - password for the user on the remote SSH server (default: s3cur3Pa5sw0rd)
SSH_TUNNEL_LOCAL_PORT - local port to be used for the SSH tunnel (default: 3306)
FLASK_HOST - host name on the local server for the Flask server (default: 0.0.0.0)
FLASK_PORT - port on the local server for the Flask server (default: 5000)
ENTITY_NAME - name of the event to display when the page is rendered (default: IBM Systems Tech U Attendees)

Here are the steps to deploy this application as a Docker container:

docker pull jwcroppe/python-db-web
docker run -p 5000:5000 -e "SSH_REMOTE_SERVER=AIX_LPAR_IP" jwcroppe/python-db-web

Alternatively, here are the steps to deploy this application into a Red Hat OpenShift 3.x cluster:

oc login ... (the exact command will vary based on your OpenShift installation)
oc new-app -e SSH_REMOTE_SERVER=<AIX_LPAR_IP> jwcroppe/python-db-web
oc expose dc/python-db-web --port=32000 (feel free to alter the public port to your liking)

As a final step, you will need to create a service (NodePort) and route to the application to load the web interface via Red Hat OpenShift. Please read the OpenShift documentation for more detailed steps as you will need to edit the created "service" YAML to reflect the NodePort type.

About

Python web-based container application to demonstrate application modernization

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published