Difficulty: Beginner
Estimated Time: 10 minutes

#Echo App Tutorial

There are a number of different ways to create a new application in OpenShift. You could have the whole YAML specification of the OpenShift ImageStreams, Builds, Services and Routes that make up your application stored and versioned in a git repository and simply run “oc create -f ” to create everything that makes up your application in one go. This is the way that mature production apps will likely be deployed (with possible adjustments for environment-specific details). However, when defining a new application in OpenShift for the first time, you will be using the “oc new-app” command to create your application. OpenShift supports deployment of your application from an existing prebuilt Docker image or by using S2I (Source to Image) which will dynamically create a new container for you application by pulling your source code directly from git and overlaying it on top of an existing image. Templates can also be used to speed up deployment of commonly used application stacks.

To better illustrate the creation of applications in OpenShift, we have written a demo application called “Echo” which consists of three different components (or microservices!) each built using a different method. As this application is simple to conceptually understand, easy to deploy and actually shows interesting output and information from inside the containers, it is an excellent first application to learn about how OpenShift works as well as an application for testing new OpenShift clusters are functioning correctly. You can see what the finished app looks like at https://display.apps.teglab.uk.ml.com.

echo - a simple REST API written in Python using Flask and held in internal Bitbucket Git repository deployed using source-to-image (S2I) wall - a Mongo database with a persistent volume in which some of the REST calls will save their data and is deployed from an OpenShift template display - a very simple static HTML/JQuery page running under Apache and deployed directly from a pre-created Docker Image in a registry

Don’t stop now! The next scenario will only take about 10 minutes to complete.

Echo Example Project

Create Project

First we must create a project to house the different components that make up our application. After logging in to OpenShift, create a new project:

oc new-project echo --description="Echo Demonstration Application"

App