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.
- Docker 19.03.1
- Minishift – 1.3
- VirtualBox 6.0
- WSO2 API Manager (2.6.0) zip
- JDK 1.8 zip
- 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
- VirtualBox 6.0 – To run minishift VM in Virtual environment. You can follow VirtualBox installation for Mac and download version 6.0 from here
- Download WSO2 API Manager latest version from here
- Jdk 1.8 is downloaded from here
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)
4. Installation steps
This demo instructions in this document are categorised in 3 sections
- Setup environment (Virtual Box/ Docker / minishft) in the laptop
- Build WSO2 API Manager into docker.
- 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
VirutalBox Minishift is running
Once you install, you can run
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
Clone required artefacts from my git repository
Step2: Modify Dockerfile based on your need
Dockerfile looks like below
# 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.
# Set environment variables.
# Set working directory
# Expose ports
EXPOSE 8280 8243 9763 9443 9099 5672 9711 9611 7711 7611 10397
Chance path details according to your system details
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
Check whether “wso2am-centos” running is showing in docker image repository
Lakshmanans-MacBook-Pro:centos laks$ docker image ls
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
Before deploying docker image into OpenShift, the following steps to be completed
- Login into Openshif Cluster
Lakshmanans-MacBook-Pro:centos laks$ oc login
Authentication required for https://192.168.99.107:8443 (openshift)
You have access to the following projects and can switch between them with ‘oc project <projectname>’:
- 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
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
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.
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
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)
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