Deploying ForgeRock Access Manager on OpenShift Online (Part 1)

Author:

Steffo Weber

Created at:

Feb 2018

Updated at:

Oct 2022

Summary

Instructions for deploying ForgeRock® Access Manager on OpenShift® Online using a browser-based console. This is the first of two articles.

This is the first of two articles on deploying ForgeRock® Access Manager or OpenAM (AM), on OpenShift® Online (OpenShift). This article will focus on the using browser-based console to perform the deployment. The second article will focus on using manifests and the oc command-line interface (CLI) tool, which are much faster and better for automation.

This article assumes that you have never accessed OpenShift before. We will use a Docker container to create an OpenShift application. The main steps are:

  1. Create an AM Docker image.

  2. Deploy the AM Docker image to create an OpenShift application.

Creating an AM Docker Image

To create an AM Docker image, you need a Dockerfile.

To do this, pull the content from GitHub (GitHub - steffow/openam-docker: OpenAM buildfile for Docker), and download the OpenAM WAR file.

Build and run the image as described in the Readme.

Next, commit/tag/push the image. To do this, follow these instructions: Push a Docker Image to a Personal Repository - Karl’s Code.

Deploying an AM Docker Image on OpenShift

If you do not already have an OpenShift account, you will need to set one up and sign up for a paid plan. Note that this procedure has been tested using a paid plan. We used 4 GB RAM and 4 GB disk; you should be able to run this with 2 GB (RAM and disk).

After you’ve logged in to the OpenShift administration console, select
Create Project. The Create Project dialog box displays. Enter Sample OpenAM Deployment in the Description text area and select Create:

https://backstage-community-prod.storage.googleapis.com/original/1X/8495a316ac00e90803c670927f9b9e73280ba833

Next, we need to deploy a Docker image. Note that due to licensing, a ready-made AM container is not available, so you need to download the WAR file and create the container using the aforementioned Dockerfiles. To do this, from the Add to Project menu, select Deploy Image. The Deploy Image dialog box displays:

https://backstage-community-prod.storage.googleapis.com/original/1X/448f8d06fb259893e150f2c8c0e951f13722942e

Enter an image name in the *Image Name text area. We used steffow/am-eval, which refers to Docker, and select Deploy:

https://backstage-community-prod.storage.googleapis.com/original/1X/37feeff8e5426190b33723f1ecd597578aeb9652

OpenShift populates the *Name text area, and displays an “am-eval image has been created” confirmation message:

https://backstage-community-prod.storage.googleapis.com/original/1X/efc1171ee46253b16f3f162ec2c3a5bdbe2e4815

OpenShift starts to create a new pod. The pod might crash, as we have not yet assigned additional memory to it. If the pod crashes, you’ll see a status message like the one below:

https://backstage-community-prod.storage.googleapis.com/original/1X/aac27788e7f268a2264d4ce772dcd564f09b3e0e

To increase memory, navigate to Deployments > am-eval. From the Actions menu, choose Pause rollouts. (As you will see in the second article, you can use the CLI in OpenShift to deploy in one step using the oc command). The rollout is paused:

https://backstage-community-prod.storage.googleapis.com/original/1X/3c075fc6a70a31f3e8bb4241e56bce46348ce469

Now you can edit the resource limits. From the Actions menu, select Edit Resource Limits. The Resource Limits: am-eval dialog box displays:

https://backstage-community-prod.storage.googleapis.com/original/1X/815bce102bf539fd09e82617540bd8da59594e54

Enter 2 in the Request field and in the Limit field, and select Save:

https://backstage-community-prod.storage.googleapis.com/original/1X/dccbe2ce650fb2c48f7f5cf82192d83a37d741f2

If you see a message like the one below, you will need to refresh the console. To do this, select Shift + Reload in your browser, repeat the previous step, and select Save:

https://backstage-community-prod.storage.googleapis.com/original/1X/1a98e2e248725418c14cef17aedd76283aa7569f

Resume rollouts by deselecting the Pause Rollouts for this deployment config check box and selecting Save. To verify that the pod is running and tp check for errors, select Applications > Pods > (select a pod). The am-eval-2-24vjs dialog box displays:

https://backstage-community-prod.storage.googleapis.com/original/1X/f4348dd1cf8534ea4bfabec3c84189496e86c29b

Next, we will make your application/pod accessible by creating a route. From the OpenAM menu, select Services:

https://backstage-community-prod.storage.googleapis.com/original/1X/54ab3b69da595b75108b4e8cbfd7f20900f84ad8

The am-eval dialog box displays. From the Actions menu, select Create route:

https://backstage-community-prod.storage.googleapis.com/original/1X/9d0e1b2b8efa68b7b2534f7101ec818152dad6a0

The Create Route dialog box displays. In the Path text area, enter the path name in which OpenAM is deployed:

https://backstage-community-prod.storage.googleapis.com/original/1X/fbb667dcd17f99130e4a3590580cfa489d945eea

The am-eval dialog box displays. In the Traffic area, select the URL:

https://backstage-community-prod.storage.googleapis.com/original/1X/57db7420b252f7af503f37c8f8a11c2b822304a2

On success, you will see the following. Does it look familiar?

https://backstage-community-prod.storage.googleapis.com/original/1X/867035a9e6e26176a230c1be326c9c8787f41c45

Select Create New Configuration. You will see a small “Directory is not empty” warning. You can safely ignore this, because Dockerfile created /home/forgerock/openam for you. We will use that later as a mount point for a persistent volume:

https://backstage-community-prod.storage.googleapis.com/original/1X/f44000ab866858b558004c7a37f2d1fc8c539941

Do not make changes to Configuration Directory (unless you modify the Dockerfile). Because the pod isn’t properly DNS-configured, the AM configurator cannot determine the port numbers and defaults them to -1.

Select Next. The Custom Configuration Option dialog box displays:

https://backstage-community-prod.storage.googleapis.com/original/1X/4ffbad8c7237b25ee72b403b6ee57f5c81339364

Enter the correct port numbers in the respective text areas and select the OK checkboxes that correspond to each port text area and select Next. Complete the installation and access AM using the service route (the same URL as above). A realm is created and the Realm Overview dialog box displays:

https://backstage-community-prod.storage.googleapis.com/original/1X/2014af21cb68b9b40c33ffef2d92c49c33157b3e

Congratulations on creating your first realm! Next, we will add a persistent volume.

Adding a Persistent Volume

While the procedure you just performed puts the OpenAM configuration directory inside the Docker container, it does not perform volume mapping. This is problematic, because if your pod crashes, the configuration will be lost. As a result, we need OpenShift to create something does the same job as volume mapping—a persistent volume. Enter the following:

$ docker run — name am-eval -p 8080:8080 -v $PWD/openam-configuration:/home/forgerock/openam/ am-eval

Navigate to the storage section and select Create Storage. The Create Storage dialog box displays:

https://backstage-community-prod.storage.googleapis.com/original/1X/b3ee4aa6b284c206a05ee827efe1546b0645a31f

Enter 4 in the *Size Min: 1GiB text area. Note that 2 GB should be fine as well. Select Create. The Storage dialog box displays:

https://backstage-community-prod.storage.googleapis.com/original/1X/1190521bba8b579d01292c6890c4ed3bc74f8d82

Select Create Storage. A persistent volume is created:

https://backstage-community-prod.storage.googleapis.com/original/1X/f10681c0d6ea74c47be03b8e9b3659a29b51cdc2

Next, we will mount the new volume at the /home/forgerock/openam mount point. From the Actions menu, select Add Storage:

https://backstage-community-prod.storage.googleapis.com/original/1X/a2ee29cbff391d9a94d40a691a0171eeb110bae2

Enter a mount path in the respective text area and select Add:

https://backstage-community-prod.storage.googleapis.com/original/1X/84c743672f9ccda532348d0ede9f777125b9350f

OpenShift will now roll out the new configuration. The previous OpenAM configuration, which did not reside on a persistent volume, is lost. The configurator will display again, and you’ll see that the port 50389 and others are not free, because your pod is still running.

To delete the pod, from the Actions menu, select Delete:

https://backstage-community-prod.storage.googleapis.com/original/1X/5eaad60141b41f8bafa5174021cc5267996fd66c

A warning message, such as the one below, displays. Select the Delete pod immediately without waiting of the processes to terminate gracefully check box and select Delete:

https://backstage-community-prod.storage.googleapis.com/original/1X/0ee92c27d33f769ffbd84d5742867a3fb17a5e85

OpenShift will automatically create a new pod. Return to the URL you entered earlier and run the configuration again. You should see that port 50389 and others are free. Because that the configuration data now resides on a persistent volume, you can delete the pod without losing your data. The Realm Overview dialog box displays:

https://backstage-community-prod.storage.googleapis.com/original/1X/0ce8aedfd2290d8fe146bc0e1c98cffa9f32980b

Your session is still valid and you do not need to re-authenticate after a pod crashes/dies.

To continue, go to the next article, “Deploying ForgeRock Access Manager on OpenShift Online (Part 2).”