Oracle Cloud is among the top in Enterprise Public Cloud platforms and unlike other cloud vendors, it’s Always Free tier offers services to deploy complete application stack.

I have not tried it until recently Oracle offered free training and certification on Oracle Cloud Infrastructure exams. It was a really worthy set of courses and it’s the first time for me to have the overall understanding of how everything is connected in a cloud environment.

I was in a much need of a stable public cloud environment to experiment things for a long time. With the other cloud platforms, most important services such as compute instance and storage comes with restrictions but Oracle Cloud always free tier entitled for 2 compute instances of 1GB memory and Storage of 100 GB which is quite enough to deploy full application stack.

In this post I will share my experience of deploying WSO2 Micro Integrator in Oracle Cloud.

Things Covered…

Deploy WSO2 Micro Integrator in Oracle Cloud Ubuntu virtual machine

Login to the Oracle cloud console and go to Compute > Instances.

If you are new to oracle cloud, it’s really worth checking the oracle course material or check the key concepts.

I have chosen the latest Ubuntu distribution available in Oracle-Provided images.

OCI Linux based instances use SSH key pair instead of password login. It has an easy guide to generate keys (https://docs.cloud.oracle.com/en-us/iaas/Content/Compute/Tasks/managingkeypairs.htm). I used the putty key generator to generate the SSH keys. Note that you need the public key in OpenSSH format to input to OCI, therefore don’t save the public key and instead copy the public key displayed in the Putty KeyGen and paste in OCI key field (I should have read through the guide above). Make sure to save the private key.

In couple of minutes my VM is ready and I’m rady to login

Open Putty and navigate to Connection > SSH > Auth Category. Select the saved private key from Putty KeyGen.

provide the public IP of the VM and then Open connection.

First, update Ubuntu package index

>sudo apt update

Install OpenJDK 8. Full list of WSO2 compatible OS and JDK is listed here (https://docs.wso2.com/display/compatibility/Tested+Operating+Systems+and+JDKs)

>sudo apt install openjdk-8-jdk

I personally prefer Tree package to displays an indented directory tree, in color.

>sudo apt install tree

Then we need to download Micro Integrator. I found it bit tricky since the distributions available in WSO2 website requires consent and my linux knowledge is way too low to do this in console. Therefore I used the Micro Integrator 1.1.0 release in WSO2 github (https://github.com/wso2/micro-integrator/releases/tag/v1.1.0-rc1)

Note that the official release does not have the .zip so I had to use RC1, but there seems to be no difference between RC1 and official release.

>wget https://github.com/wso2/micro-integrator/releases/download/v1.1.0-rc1/wso2mi-1.1.0-rc1.zip

make sure that file is properly downloaded

Go to the /usr/lib and create a new directory wso2

>cd /usr/lib
>sudo mkdir wso2

go back to root and unzip wso2mi-1.1.0-rc1.zip to /usr/lib/wso2

>sudo unzip wso2mi-1.1.0-rc1.zip -d /usr/lib/wso2/

Go to the /usr/lib/wso2/ and check the directory structure

Now we need to set the JAVA_HOME

>export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
>echo $JAVA_HOME

Grant the permission to the directory, otherwise you cannot start Micro Integrator due to permission issue.

>sudo chmod -R a+rwx /usr/lib/wso2

Now it’s all set from wso2 side and micro integrator should start

Basic WSO2 Start/Stop commands

>/usr/lib/wso2/wso2mi-1.1.0/bin/micro-integrator.sh start
>/usr/lib/wso2/wso2mi-1.1.0/bin/micro-integrator.sh stop
>/usr/lib/wso2/wso2mi-1.1.0/bin/micro-integrator.sh restart
>/usr/lib/wso2/wso2mi-1.1.0/bin/micro-integrator.sh version

Update iptables and firewall to allow connections from port 8290 and 8253

>sudo iptables -I INPUT -p tcp --dport 8290 --syn -j ACCEPT
>sudo iptables -I INPUT -p tcp --dport 8253 --syn -j ACCEPT
>sudo ufw allow from any to any port 8290 proto tcp
>sudo ufw allow from any to any port 8253 proto tcp

OCI VM instances default public IP is ephemeral, which means it existing for the lifetime of the instance. If you are okay with that, then Micro Integrator ports can be opened directly from the subnet and your MI instance is ready!

If you need more robust setup, then a Load Balancer can be setup, which is part of the OCI Always Free plan and then you can have a reserved IP which will not changed. I have list down both the options below

Option 1: Configure direct access to Micro Integrator

Go to the OCI console and navigate to the security list of the VCN

Add two Ingress rules to enable port 8290 and 8253 to public

Source CIDR: 0.0.0.0/0
Protocol: TCP
Destination Port(s) 8253, 8290

Option 2: Creating Load Balancer to access the Micro Integrator

Go to OCI console > Networking > Load Balancers, Create New Load Balancer

Choose the Type as Public, and Bandwidth Micro, which is covered in Always Free.

I’m putting the Load Balancer in the same subnet as my VM. but it is possible to put it in a different subnet.

In the next page, add the backend VM we created, port 8290

Configure the Load Balancer with HTTP option

Finally, go to the Public Sublet Security List and add a Ingress rule to allow traffic to port 80

After creating the Load Balancer , I noticed that the health check is critical for the backend VM. To overcome that, I created a simple proxy service and set the health check URI to this service.

<?xml version="1.0" encoding="UTF-8"?>
<proxy name="HealthCheck" startOnLoad="true" transports="http https" xmlns="http://ws.apache.org/ns/synapse">
    <target>
        <inSequence>
            <payloadFactory media-type="json">
                <format>{"Health":"OK"}</format>
                <args/>
            </payloadFactory>
            <respond/>
        </inSequence>
        <outSequence/>
        <faultSequence/>
    </target>
</proxy>

This simple proxy deployment can be downloaded here if anyone is interested.

https://objectstorage.uk-london-1.oraclecloud.com/n/lrjwenxfrdxx/b/knakit-wso2/o/OCI_LB_Health_CheckCompositeApplication_1.0.0.car

Now the Load Balancer is working just fine as expected!

Below picture shows the resource utilization of the VM in idle state and as you can see the memory has not even reached 80% so I expect my instance is capable of handling a high load. Hats off to the WSO2 team for making the product super light weight and it will benefit in many ways to continue the Microservices journey.

Hope you enjoy the read, Thanks!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s