Difficulty: beginner
Estimated Time: 60 minutes

This is an extended tutorial for learning how to deploy applications to OpenShift. In the tutorial you will deploy an application called ParksMap.

ParksMap is a polyglot geo-spatial data visualization application built using the microservices architecture and is composed of a set of services which are developed using different programming language frameworks.

Application Architecture

The main service is a web application which has a server-side component in charge of aggregating the geo-spatial APIs provided by multiple independent backend services and a client-side component in Javascript that is responsible for visualizing the geo-spatial data on the map. The client-side component which runs in your browser communicates with the server-side via WebSockets protocol in order to update the map in real-time.

There will be a set of independent backend services deployed that will provide different mapping and geo-spatial information. The set of available backend services that provide geo-spatial information are:

  • WorldWide National Parks
  • Major League Baseball Stadiums in the US
  • International Airports
  • Earthquakes in New Zealand
  • Aussie Dunnies

The original source code for the applications are located here.

The server-side component of the ParksMap web application acts as a communication gateway to all the available backends. These backends will be dynamically discovered by using service discovery mechanisms provided by OpenShift which will be discussed in more details in the tutorial.

That is it for this workshop.

If you are interested in digging further into specific topics around using OpenShift, see the home page of our OpenShift interactive learning portal.

There are exercises for understanding the fundamentals of using OpenShift, but also how to deploy applications using Red Hat middleware products.

Finally, if you just want to play around, and perhaps try deploying your own application, you can use the playground environments.

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

Training Workshop

Step 1 of 10

Topic 1 - Exploring the CLI and Web Console

In this exercise you are going to login to the OpenShift cluster and create a project to work in.

Exercise: Login Using the Command Line

To access OpenShift from the command line you need the oc command line tool. In this environment that tool has already been installed for you and is accessible from the Terminal window to the right.

In order to login, run the following command:

oc login

In this interactive learning environment, whenever you see a command like that above which displays a carriage return icon to the right of the command, you can click on the command and it will be run for you in the Terminal window automatically. You can at any time also enter any command yourself direct into the terminal window.

Once you run the oc login command, you will be prompted for the username and password combination for your user account:

When prompted, enter the following username and password:

Username: developer

Password: developer

Once you have authenticated to the OpenShift server, you will see the following confirmation message:

Login successful.

You don't have any projects. You can try to create a new project, by running

    oc new-project <projectname>

Congratulations, you are now authenticated to the OpenShift server. The OpenShift master includes a built-in OAuth server. Developers and administrators obtain OAuth access tokens to authenticate themselves to the API. By default your authorization token will last for 24 hours.

Exercise: Creating a Project

Projects are a top level concept to help you organize your deployments. An OpenShift project allows a community of users (or a user) to organize and manage their content in isolation from other communities. Each project has its own resources, policies (who can or cannot perform actions), and constraints (quotas and limits on resources, etc). Projects act as a "wrapper" around all the application services and endpoints you (or your teams) are using for your work.

The first thing we want to do is create the project to work in. Create the myproject project by running:

oc new-project myproject

You will see the following confirmation message:

Now using project "myproject" on server "https://172.17.0.45:8443".

You can add applications to this project with the 'new-app' command. For example, try:

    oc new-app centos/ruby-22-centos7~https://github.com/openshift/ruby-ex.git

to build a new example application in Ruby.

Exercise: Login Using the Web Console

OpenShift ships with a web-based console that will allow users to perform various tasks via a browser. In this interactive learning environment, to the right of this description you should initially see a terminal window. To access the web console, click on the Dashboard button above the terminal window. You can switch back to the terminal by clicking on the Terminal button.

The actual URL of the web console for your environment is:

https://[[HOST_SUBDOMAIN]]-8443-[[KATACODA_HOST]].environments.katacoda.com

If you click on this you will also be taken to the Dashboard tab. If you want to view the web console in a separate browser tab or window, right click on the URL and select the menu option to open it.

The first screen you will see in the web console is the authentication screen.

Web Console Login

Enter in the following credentials:

Username: developer

Password: developer

and click on Log In.

In this interactive learning environment, whenever you see text like that above which has the copy icon to the right of the text, you can click on it and it will be automatically copied into your copy/paste buffer. You can then paste it into any web console fields or the terminal window.

After you have authenticated to the web console, you will be presented with a list of projects that your user has permission to work with. You will see something that looks like the following image:

List of Projects

Click on the myproject project. You will be taken to the project overview page which will list all of the routes, services, deployments, and pods that you have running as part of your project. There's nothing there now, but that's about to change.

Project Overview

We will be using a mix of command line tooling and the web console for this tutorial. Get ready!

Catch-up: When Things Go Wrong

The interactive learning environment you are using provides a time limited (max 1 hour) instance of OpenShift just for you. If you have network connection issues or accidentally kill your browser window, you will loose access to the environment you were using and it will be shutdown, loosing your progress. You could also simply run out of time and not finish all the exercises in time.

To cater for this eventuality, you will find a "catch-up" section at the end of certain sets of exercises. If you have to start over, go to each of the "catch-up" sections for the exercises you had already done, and run the commands listed. This will allow you to get quickly back to where you were up to so you can keep going. You will need to separately login in to the web console using the same credentials.

The "catch-up" commands for this initial set of exercises are below.

oc login --username developer --password developer

oc new-project myproject

ONLY run the "catch-up" commands if you had not already done a set of exercises.