To run Software AG webMethods API Gateway 10.5 on a Red Hat OpenShift cluster you can make use of the API Gateway image that is available on Docker Hub (https://hub.docker.com/_/softwareag-apigateway?tab=description). This image is a free trial, time-limited and for non-production version. There is an article on the Software AG Tech Community that explains how to do this: https://tech.forums.softwareag.com/t/api-gateway-meets-openshift/237425

This article will explain how to:

  • Install an API Gateway on a local machine
  • Create a Docker image of the installation
  • Push it to the Docker Hub repository
  • And finally run API Gateway on OpenShift

Step 1. Install API Gateway

Install webMethods Integration Server and API Gateway on a local machine (Linux, eg. CentOS 8). You should also have Docker installed on the same local machine.

1. Download the Software AG Installer from the SAG site

https://empower.softwareag.com/Products/DownloadProducts/sdc/default.aspx

2. Install API Gateway

Change the permissions of the file

command: chmod +x SoftwareAGInstaller20191216-LinuxX86.bin

Create an installation folder with correct permissions, eg. /opt/softwareag105/AG

Run the installer

command: ./SoftwareAGInstaller20191216-LinuxX86.bin

Click next until we can select API Gateway component and install (You will have to provide a license file for API Gateway)

Run the afterInstallAsRoot script

commands:

cd /opt/softwareag105/AG/bin

./afterInstallAsRoot.sh

3. Download Software AG Update Manager

Documentation: https://documentation.softwareag.com/a_installer_and_update_manager/Using_SAG_Update_Manager_for_10-5_and_later/index.html#page/sag-update-manager-help%2Fta-starting_sum_on_nix.html%23

4. Install the API Gateway fixes

Change the permissions of the file

command: chmod +x SoftwareAGUpdateManagerInstaller20200916-11-LinuxX86.bin

Run the update manager

command: ./SoftwareAGUpdateManagerInstaller20200916-11-LinuxX86.bin –accept-license -d /opt/softwareag105/sagsum

Start the Update manager:

commands:

cd /opt/softwareag105/sagsum/bin

./UpdateManagerGUI.sh

5. Test your installation

commands:

cd /opt/softwareag105/AG/profiles/IS_default/bin/

./startup.sh

./shutdown.sh

Step 2. Build the Docker image

Documentation: https://documentation.softwareag.com/webmethods/api_gateway/yai10-5/10-5_API_Gateway_webhelp/index.html#page/api-gateway-integrated-webhelp%2Fta-build_docker_image.html%23

1. Navigate to the location of the script to build a docker image

command: cd /opt/softwareag105/AG/IntegrationServer/docker

2. Create a Docker file for the IS

command: ./is_container.sh createDockerfile -Dimage.name=centos:8 -Dfile.name=IS_Agent_Dockerfile

The generated docker file (IS_Agent_Dockerfile) is located at /opt/softwareag105/AG/

3. Build the IS Docker image

command: ./is_container.sh build -Dfile.name=IS_Agent_Dockerfile -Dimage.name=gw_is_agent:is

4. Create a Docker file for the API GW based on the IS Docker image

command: ./apigw_container.sh createDockerfile –base.image gw_is_agent:is –file.name IS_APIGW_Agent_Dockerfile –target.configuration OpenShift –os.image centos:8

The generated docker file (IS_APIGW_Agent_Dockerfile) is located at /opt/softwareag105/AG/

5. Build the API GW Docker image

command: ./apigw_container.sh build –file.name IS_APIGW_Agent_Dockerfile –image.name gw_is_agent:apigw

To list the images you just created

command: docker images

6. Test the image

Make sure that you have enough memory:

command: sysctl -w vm.max_map_count=262144

Start the container

command: docker run -d -p 5555:5555 -p 9072:9072 –name apigw gw_is_agent:apigw

Check the status

command: docker ps

wait for status to change from “Up x seconds/minutes/… (health: starting)” to “Up x seconds/minutes/.. (healthy)”

Stop and remove the container

commands:

docker stop -t90 apigw

docker rm apigw

Step 3. Push image to Repository (DockerHub)

Documentation: https://docs.docker.com/docker-hub/repos/#:~:text=To%20push%20an%20image%20to,docs%2Fbase%3Atesting%20

1. Re-tag your local image to use with DockerHub

command: docker tag gw_is_agent:apigw DockerUser/sag:latest

2. Push your image to the DockerHub registry

command: docker push DockerUser/sag:latest

This will take some time …

Step 4. Run API GW on OpenShift

Documentation: https://documentation.softwareag.com/webmethods/api_gateway/yai10-5/10-5_API_Gateway_webhelp/index.html#page/api-gateway-integrated-webhelp%2Fta-run_apigw_container_sagadmin_user.html%23

1. Login to OpenShift

Click on the arrow next to your user in the GUI of OpenShift in the top right corner and select “Copy Login Command”

command: oc login –token=<token> –server=<url>

2. Create new project or switch to existing project, eg. sag-is

commands:       

oc new-project sag-is

or

oc project sag-is

3. Create a service account runassagadmin.

command: oc create serviceaccount runassagadmin

4. Assign admin privileges to your user (to be able to execute the next step)

5. Assign permissions to use the docker image build-in user (requires admin privileges)

command: oc adm policy add-scc-to-user anyuid -z runassagadmin

6. Create deploymentConfig based on the OpenShift sample files in the WmAPIGateway package

Location sample files: /opt/softwareag105/AG/IntegrationServer/instances/default/packages/WmAPIGateway/resources/samples/OpenShift

Make the following changes to the sample file:

  • Replace the default serviceAccountName with runassagadmin
  • Update the <yourClusterBaseUrl>-placeholder in the host element of the 2 routes to match the cluster URL
  • Update the placeholders in the ImageStream to match the registry location of your image

7. Create a secret to log into DockerHub and link it to the service account that will start our pod

commands:

oc create secret docker-registry hub-secret –docker-server=https://index.docker.io/v1/ –docker-username=DockerUser –docker-password=xxxxxxx –docker-email=DockerUser@example.com

oc secrets link runassagadmin hub-secret –for=pull

8. Navigate to the location of your DeploymentConfig file

9. Apply the DeploymentConfig file

command: oc apply -f api-gateway-deployment-embedded-elasticsearch.yaml

This will start the deployment of your API Gateway pods on the OpenShift cluster.

To watch the status of your pods

command: oc get pods

When the API Gateway pods have a status “Running” you can access them via the routes you defined.

Author: Raf Vanderzande