1 . Introduction

Following are some steps to carry on to configure WSO2 API Manager Product in RedHat OpenShift platform for demo purpose (here minishift). Configuration for production-grade OpenShift platform deployment will differ from the following steps. The environments that I used for this demo are as follows.

2. Prerequisites  

  1. Docker 19.03.1
  2. Minishift – 1.3
  3. VirtualBox 6.0
  4. WSO2 API Manager (2.6.0) zip
  5. JDK 1.8 zip
  1. Docker installation for mac, please refer below link to install docker

To verify Docker version installed, you should able to see docker version

Lakshmanans-MacBook-Pro:~ laks$ docker –version

Docker version 19.03.1, build 74b1e89

  • Minishift 1.3 –  Minishift is a tool that helps you run OpenShift locally by running a single-node OpenShift cluster inside a VM. For running production like OpenShift cluster, you follow multimode/master deployment configuration from minishift

$ brew cask install minishift

Lakshmanans-MacBook-Pro:~ laks$ minishift version

minishift v1.33.0+ba29431

  • Download WSO2 API Manager latest version from here
  • Jdk 1.8 is downloaded from here 
Java SDK version download

Lakshmanans-MacBook-Pro:~ laks$ java -version

java version “11.0.1” 2018-10-16 LTS

Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS)

Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)

3. Architecture

4. Installation steps

This demo instructions in this document are categorised in 3 sections

  1. Setup environment (Virtual Box/ Docker / minishft) in the laptop
  2. Build WSO2 API Manager into docker.
  3. Deploy Dockerised image into OpenShift platform ( Minishif here)

4.1. Setup environment (Virtual Box/ Docker / minishft) in the laptop

Follow prerequisites instructions steps 1 to 4. You can use VirtualBox to run minishift VM. For that that you need to use VirutalBox drive

Run the following command to run minishift in VirtualBox

$minishift start –vm-driver=virtualbox

minishift start vm

VirutalBox Minishift is running

Once you install, you can run

$minishift console

Or

User: admin

Password: admin (default)

4.2 Build WSO2 API Manager into docker

In order to deploy WSO2 API Manager, first we need to create docker image for WSO2 API Manager. Also, we need to include jdk 1.8 version in docker creation. I used simple dockerfile to create docker image. This one way of building docker image from dockerfile, otherwise if you prefer to pull the readymade docker image from WSO2 Docker repository, you can pull image from WSO2 Docker image

Step1:

Clone required artefacts from my git repository

$git clone https://github.com/PLAKSHAMANAN2001/apim-openshift.git

Step2: Modify Dockerfile based on your need

Dockerfile looks like below

MAINTAINER lakshmanan@wso2.com

# Create group and add user wso2

RUN groupadd admin

RUN useradd -g admin wso2

# Copy the necessary product zip.

COPY files/product/jdk1.8.0_221 /Users/laks/Downloads/wso2demo/dockerimg/wso2/jdk1.8.0_221

COPY files/product/wso2am-2.6.0 /Users/laks/Downloads/wso2demo/dockerimg/wso2/wso2am-2.6.0

COPY files/lib/mysql-connector-java-8.0.12.jar /Users/laks/Downloads/wso2demo/dockerimg/wso2/wso2am-2.6.0/repository/components/lib/mysql-connector-java-8.0.12.jar

# Copy config file/s.

COPY files/apim/axis2.xml /Users/laks/Downloads/wso2demo/dockerimg/wso2/wso2am-2.6.0/repository/conf/axis2/axis2.xml

# Give permission to the user.

RUN chown -R wso2:admin /Users/laks/Downloads/wso2demo/dockerimg/wso2

# Switch to user wso2.

USER wso2

# Set environment variables.

ENV JAVA_HOME=/Users/laks/Downloads/wso2demo/dockerimg/wso2/jdk1.8.0_221

# Set working directory

WORKDIR /Users/laks/Downloads/wso2demo/dockerimg/wso2/wso2am-2.6.0

# Expose ports

EXPOSE 8280 8243 9763 9443 9099 5672 9711 9611 7711 7611 10397

ENTRYPOINT [“bin/wso2server.sh”]

Chance path details according to your system details

Step3:

Build docker image with dockerfile and you should able to see docker file execution logs as below.

Lakshmanans-MacBook-Pro:centos laks$ docker build -t wso2am-centos .

Sending build context to Docker daemon  1.633GB

Removing intermediate container c0a1544e4356

Successfully built cc6e592d4152

Step 4:

Check whether “wso2am-centos” running is showing in docker image repository

Lakshmanans-MacBook-Pro:centos laks$ docker image ls

Step 5:

Now WSO2 API Manager docker image is created as next step, we need to get this image pushed into minishift local registry. To do that, we need to know OpenShift Registry details and to run below command to get the details

Lakshmanans-MacBook-Pro:centos laks$ minishift openshift registry

172.30.1.1:5000

Step 6:

Before deploying docker image into OpenShift, the following steps to be completed

  1. Login into Openshif Cluster

Lakshmanans-MacBook-Pro:centos laks$ oc login

Authentication required for https://192.168.99.107:8443 (openshift)

Username: admin

Password:

Login successful.

You have access to the following projects and can switch between them with ‘oc project <projectname>’:

  * binarylogicworkslocalwebsite

  • Create project called “wso2”

Lakshmanans-MacBook-Pro:centos laks$ oc create is wso2am -n wso2

  • Select wso2 project

Lakshmanans-MacBook-Pro:centos laks$ oc project wso2

Now using project “wso2” on server https://192.168.99.107:8443

  • Create Image stream, which we are going to use later

Lakshmanans-MacBook-Pro:centos laks$ oc create is wso2am -n wso2

imagestream.image.openshift.io/wso2am created

Step 7:

Then we need to tag docker images to OpenShift registry. So, run the following command after you finish all step6

Lakshmanans-MacBook-Pro:centos laks$ docker tag wso2am-centos 172.30.1.1:5000/wso2/wso2am

docker tag wso2am-centos 172.30.1.1:5000/wso2/wso2am

here :

wso2am-centos – docker build image

172.30.1.1:5000 – OpenShift Registry

wso2 – OpenShift project Name

wso2am – image stream created in 6.4 step

4.3.  Deploy Dockerised image into OpenShift platform ( Minishift here)

So far, we have done the following activities:

  • Created a project called wso2.
  • Created an Image Stream named wso2am for the project wso2.
  • Created a Docker image for WSO2 API Manager and tagged it as 172.30.1.1:5000/wso2/wso2am.
  • Pushed the Docker image to the Docker registry.

Now we need to push docker images to OpenShift Platform(minishift)

Step 1. Run below command login

Lakshmanans-MacBook-Pro:centos laks$ docker login -u developer -p $(oc whoami -t) $(minishift openshift registry)

WARNING! Using –password via the CLI is insecure. Use –password-stdin.

Login Succeeded

Step2: Push the docker image local repository

Lakshmanans-MacBook-Pro:centos laks$ docker push 172.30.1.1:5000/wso2/wso2am

Step 3: Verify the images

Lakshmanans-MacBook-Pro:centos laks$ oc get is

NAME      DOCKER REPO                   TAGS      UPDATED

wso2am    172.30.1.1:5000/wso2/wso2am   latest    26 seconds ago

Lakshmanans-MacBook-Pro:centos laks$

Step 4: run $minishift console

Step 5: Deploy WSO2 API Manager Image

Click the Overview menu of the project and you will be presented this GUI. Then, select the Deploy Image option.

Now, choose the image stream and then click deploy,

Once it’s deployed, you can see the following page:

Click the service wso2am (marked in red) under the NETWORKING section and let’s create a passthrough route.

After successfully created the Route, you can view it as shown

Step: 6: Access wso2 API manager using following Routes created in Openshift cluster ( Minishift)

Publisher: https://wso2am-wso2.192.168.64.2.nip.io/publisher

Store: https://wso2am-wso2.192.168.64.2.nip.io/store

Admin: https://wso2am-wso2.192.168.64.2.nip.io/admin

Carbon: https://wso2am-wso2.192.168.64.2.nip.io/carbon

Please reach out any queries or comments on this document to me. I will own this document and will fine-tune as I go further when I create production like OpenShift cluster deployment