Deploy a sample currency exchange app to OpenShift using Red Hat Universal Base Image


This code pattern is part of the Bee Travels example project that focuses on deploying a Python currency exchange application to Red Hat® OpenShift® on IBM Cloud™, with OpenShift 4.3, using the Red Hat Universal Base Image.

The Universal Base Image is a base operating system image that has Red Hat Enterprise Linux (RHEL) at its core, which means you can construct an image with all the qualities you have come to use and love about RHEL. It is responsive, highly secure, and resilient. Plus, as its name suggests, you can universally use it for anything you want. You can build your images on any platform and then distribute it freely to run anywhere you want.

With the Universal Base Image, you can use familiar yum commands to install standard rpm repositories and packages. For example, easily set up Apache Web Server or stand up a versioned, language-specific environment like Python version 3.7.5. Also, you can build and run your images anywhere on any platform. For example, build and run on different operating systems like Mac, Linux, and Windows, all for free, without needing a paid Red Hat subscription.


You can try out the Universal Base Image with this code pattern and examples with Red Hat OpenShift on IBM Cloud.

Using this code pattern, you can learn the following skills:

  • Design and create a Python microservice with a REST interface that has a swagger test harness where you can manually inspect, discover, and run the various API endpoints.
  • Build a Docker image of the microservice using the Red Hat Universal Base Image
  • Deploy and run the microservice on Red Hat OpenShift on IBM Cloud, compatible with OpenShift 4.3.

You need to have the following code and tools to complete the steps in this code pattern:


Currency conversion microservice architecture flow diagram

  1. In the example currency conversion microservice, The client API consumer calls the microservice over the internet (http/s request).
  2. Python Flask process acts as a web server and accepts the REST request (for example, GET /convertCurrency/ZAR/USD/600.66).
  3. Code routing in Flask passes the request to a service module which in turn calls the External European Currency Exchange API.
  4. An exchange rate for ZAR is retrieved and stored. The value of 600.66 South African Rands (ZAR) is converted to US Dollars (USD).
  5. Flask then sends a response to the calling consumer with the dollar amount (in this case, $40.59).


To try out this code pattern, see the detailed technical steps in the file in the GitHub repository.

  1. Clone the GitHub repository locally.
  2. Build a Docker image and run it locally.
  3. Deploy to the IBM Red Hat OpenShift 4 cluster.