How to deploy full-stack JavaScript applications in OpenShift

Red Hat OpenShift is a Kubernetes distribution that makes it easy to deploy and scale applications in the cloud. In this hands-on learning path, created by Don Schenck, you will learn how to deploy a full-stack JavaScript application in an OpenShift cluster.

Access the Developer Sandbox

It’s necessary to install utilities and command-line interfaces as well as create some online accounts before you create Node.js apps for OpenShift.

Prerequisites:

  • Terminal session on your computer.

In this lesson, you will:

  • Install software and create accounts in preparation for OpenShift app development.

Install Git

Install the Git command-line tool by following the appropriate link:

Install Podman

Install Podman by following the instructions on the Podman website.

Get your Developer Sandbox account

Establish your Developer Sandbox account by following the instructions on the Developer Sandbox page.

Install the oc CLI and log in to your Developer Sandbox cluster

To interact with your OpenShift cluster, you need the oc command-line tool. Thankfully, the OpenShift team made it easy for you to install it. To get oc for your operating system, click the question mark icon at the top right of the OpenShift screen. From the drop-down list that appears, select Command Line Tools, as shown in Figure 1. This option opens a page with the links required to install oc.

Red Hat OpenShift Dedicated dashboard showing command-line tools.
Figure 1: Command-line tools for OpenShift are provided by the oc command.

Command-line tools for OpenShift are provided by the oc command. Once the tool is installed, click the link for Copy Login Command from the same Command Line Tools page. A new window will open with the authentication screen. Select DevSandbox, then click the Display Tokens link on the next page.

On this new page, you can find a command that starts with oc login. Copy this whole line with the --token and --server parameters and paste it into your terminal:

oc login --token=sha256~%TOKEN% --server=https://%SERVER%:6443

Wrapping up

At this point, you have the git CLI installed on your machine, you have Podman installed and running, you have a Developer Sandbox account, you have the oc CLI installed, and you are logged into your sandbox cluster. As a bonus—this is completely optional—you can install Podman Desktop.

Previous resource
Overview: How to deploy full-stack JavaScript applications in OpenShift
Next resource
Run an application locally then build a container for the front end and deploy it to OpenShift