OpenShift in 30 mins

Openshift in 30 mins with a Node.JS application

Prerequisites

These steps presume you already have Docker installed. If you don’t, look at this quickstart docker guide, or install Docker from here. Before you proceed any further confirm you can run docker process commands by trying docker ps

Installing Openshift

Installing the oc cli tool

Download the Linux oc binary and place it in your path.

Bring your cluster up

Bring up your cluster for the first time by running:

If successful you should see output like the following:

clusterup-terminal-output

To bring up your cluster subsequently pass in the --use-existing-config flag to your oc cluster up command:

Troubleshooting

If you encounter any errors the error messages are generally helpful enough to diagnose and resolve the issue. Before delving too deeply, be sure to double-check your version of Docker, and that it is compatible with the version of OpenShift you are using.

Some issues that were encountered included:

OpenShift console

Once you have successfully brought your cluster up you should be able to access the OpenShift console through the url specified at the end of your oc cluster up log.

openshift-mainconsole

openshift-consoledashboard

Deploy your app to OpenShift

Deploy your app by executing:

If you don’t have an app, you can use the nodejs-hello example from google to test a deployment:

In the OpenShift console you should see your app spinning up in its pod.

To access your app, you will need to create an external-facing route to it. Do this through the cli with:

Or if you are using the nodejs-hello example from google:

You can also set up a route through the openshift console:

openshift-selectroute

openshift-createroute

Congratulations! You have now deployed your app on OpenShift and should be able to access your deployed app through the route you specified.

Bringing down your cluster

To bring down your cluster oc cluster down will take down your cluster.

Summary & further reading

Through the above steps you should have:

As seen above, Containerised apps can be deployed quite easily to an OpenShift cluster. Docker Hub can facilitate this process by providing a place to host your container images, and you may wish to create an account there (some steps to do so can be found here).

OpenShift also supports building and deploying your directly from source code, which may be covered in a subsequent document.

For further reading, check out the below links & also feel free to reach out to feedhenry-dev at redhat.com or the #feedhenry IRC channel if you need help.