The What, Why and Wow behind the WSO2 Micro Integrator Containers

Sajitha Liyanage
Think Integration
Published in
8 min readNov 29, 2020

--

Nowadays most of the enterprises are moving to the containerized solutions from the virtualization due to its popularity and tons of benefits. As we all know they start and stop much faster than virtual machines, they have higher portability, can be quickly added or removed in the environment, can run on any type of platforms, smaller than the VMs, etc. majorly can be considered as it’s plus points.

Although the concept of containerization has a long history, it has attracted attention with the release of Docker as an open-source project in 2013. Linux Containers can have multiple management interfaces like Docker, Kubernetes but in all cases, they are powered by two main building blocks: Linux namespaces and cgroups. With these two Linux technologies, containerization provides virtualization at the operating system level, unlike a VM that provides hardware virtualization. This is because containers (Docker) runs everywhere like on-prem (Windows, Linux, macOS) and even in the cloud platforms (AWS, GCP, Azure). Once the enterprise application is containerized, it can be easily built, deployed and moved in and across the environments as we desire. Also can run in a hybrid on-prem and cloud infrastructure.

WSO2 Micro Integrator vs WSO2 EI 6.x Family

Before moving towards the big picture of the WSO2 Micro Integrator Containers, let's discuss what and why about the WSO2 Micro Integrator(MI) first. As a reputed middleware company, WSO2 offers WSO2 Enterprise Integrator(EI) which is a comprehensive integration solution for all kind of enterprise integration needs. Further, WSO2 EI consists of their own Synapse and Axis2 engines as the integration runtime and the web service engine which are battle-tested over millions of integration use cases over the past decade. However, with the demand and the evolution of the microservices WSO2 decided to have two major product families based on the integration architectures.

  • WSO2 EI 6.x Family - offers the conventional, centralized integration solution of the WSO2 middleware stack. WSO2 EI 6.x includes the ESB profile and other supporting profiles packaged in a single distribution.
  • WSO2 EI 7.x Family - offers a hybrid platform that enables API-centric integration supporting various integration architecture styles: microservices architecture, cloud-native architecture, or a centralized ESB architecture.

Given below is a comparison between the Micro Integrator of EI 7.x and the ESB profile of EI 6.x.

Comparison between EI 6.x and EI 7.x families

What is WSO2 Micro Integrator?

WSO2 Micro Integrator is an open-source, container friendly Integration runtime of Enterprise Integrator which is used for integrating APIs, services, data, and SaaS, proprietary, and legacy systems. Also, it supports both centralized (ESB style) and decentralized (microservices, cloud native) architectural styles.

As described in above, WSO2 Micro Integrator is specifically designed for the cloud-native environment with the key attributes that are essential for a microservice-ready integration solution such as faster startup time, low memory footprint, lightweight, etc. when it compares with the EI 6.x series.

Running WSO2 Micro Integrator on Containers

To run the Micro Integrator based integration solutions on the container orchestration platforms like Docker Swarm or Kubernetes, first, we need to create an immutable Docker image with our integration solution by using WSO2 Micro Integrator base image. Here, WSO2 has been creating MI base images from Ubuntu, CentOS and Alpine Linux operating systems for each of their Micro Integrator releases. The community version of WSO2 Micro Integrator’s base Docker image is available on DockerHub.

  • Base Docker Images and Tags (community version)
docker pull wso2/wso2mi:latest
docker pull wso2/wso2mi:latest-ubuntu18.04
docker pull wso2/wso2mi:latest-centos7

Also, WSO2 maintains its own Docker registry to deliver Docker images with the latest updates for WSO2 customers. Users need a valid WSO2 subscription to access the WSO2 Docker Registry.

  • Base Docker Image and Tag (with updates)
docker pull docker.wso2.com/wso2mi:latest

Build Immutable Docker Images for Integrations

If you have worked with WSO2 Micro Integrator, then you will have already heard of WSO2 Integration Studio. Because it is the drag-and-drop graphical development environment for the WSO2 Enterprise Integrator.

What is WSO2 Integration Studio?

WSO2 Integration Studio is a low code development platform for the WSO2 Enterprise Integrator. It provides intiutive, efficient integration artifact development experience and accelerates all the stages of development lifecycle (design, develop, debug and test) with ease and a connected experience.

So, let us see how we can build immutable Docker images for our integration solutions using the WSO2 Integration Studio. For this example, I am going to use a basic Hello World type of integration flow. You can find this template on the Getting Started page of the Integration Studio.

  1. Click on the Hello World sample in the Getting Started page and give a suitable name for the project.
Creating Hello World Integration Project

As you can see, Hello World project has been created as a Maven Multi-Module(MMM) project by default. Also, it is the recommended way of creating an Integration Solution for the WSO2 Enterprise Integrator 7.1.0 release onwards.

2. To export the Hello World sample as a Docker image, create a Docker Exporter module inside the created MMM project.

Creating a Docker exporter module

Fill up the wizard form with suitable Docker image details.

  • Docker Exporter Name - Name for the module.
  • Base Image Repository - Base image name of the WSO2 EI runtime.
  • Base Image Tag - Base image tag of the WSO2 EI runtime.
  • Target Image Repository - Name of the creating Docker image (should be in {registry_url}/{username}/{repository} or {username}/{repository} naming convention).
  • Target Image Tag - Tag of the creating Docker image.
  • Environment Variables - Section for adding env variables to the creating Docker image.
Docker Image Details

3. Select the Hello World composite exporter module as a dependency (Here we can add multiple composite exporter modules to pack inside the creating Docker image).

Select composite exporter module as a dependency

4. Fire up the Build Image button in the Docker exporter POM file to build the Docker image. Make sure you have installed Docker on your machine.

Build a Docker image

Once, the docker build is successful, you will be notified with a pop-up message and you can see that the image is available in your Docker environment.

Docker build successful message

5. Run the built Docker image and invoke the HelloWorld service.

docker run -p 8290:8290 <IMAGE_ID>
curl http://localhost:8290/HelloWorld

6. Fire up the Push Image button in the Docker exporter’s POM file to push the Docker image using the provided Docker registry credentials.

Push Docker image to the registry

Once, the docker push is successful, you will be notified with a pop-up message.

Docker push successful message

See how smart it is. We can now build and ship Docker images with just two button clicks. 😎

Additionally, since all the projects in Integration Studio are based on Maven, we can execute following maven commands on the Docker exporter’s POM file in order to build/push Docker images to the Docker registries. This is how WSO2 EI project structure fits with the CICD workflows.

  • Build a Docker image with the integration solution
mvn clean install -Ddockerfile.push.skip
  • Push built Docker image to a Docker registry
mvn clean install -Ddockerfile.build.skip -Ddockerfile.username=<USERNAME> -Ddockerfile.password=<PASSWORD>
  • Build and Push Docker image to a Docker registry
mvn clean install -Ddockerfile.username=<USERNAME> -Ddockerfile.password=<PASSWORD>

Applying secure-vault to WSO2 Micro Integrator Containers

WSO2 Enterprise Integrator uses Cipher-Tool (to mask sensitive information in server configurations) and Secure-Vault (to mask sensitive information in Synapse configurations) implementations for more secured integration solutions with sensitive data. However, in previous versions of the WSO2 Integration Studio, we had to follow multiple steps to enable these implementations in a Docker image with the Docker exporter module. But from the Integration Studio 7.1.0 release onwards, in order to encrypt sensitive information, we can follow the below easy steps to achieve the requirement.

  1. Define the secrets inside the deployment.toml file which is located in the Docker exporter module as follows.
....[truststore]
# refer secret as a server configuration value
password = "$secret{truststore_password}"
[secrets]
truststore_password = "[wso2carbon]"
runtime_secret = "[secret]"
...

You can refer the above runtime_secret alias inside the Synapse configuration by using the vault-lookup function ({wso2:vault-lookup('alias')) as shown below.

<log level="custom">   
<property expression="wso2:vault-lookup('runtime_secret')" name="secret"/>
</log>

2. Select the “Enable Cipher Tool” option in the Docker Exporter’s POM file (underneath, this option encrypts all the secrets defined in the TOML file and generates required files to enable security for the MI while the Docker build).

Enabling Cipher Tool option

3. Change the default secure vault configurations inside the Docker exporter’s POM file via the source view if needed.

....
<properties>
<keystore.type>JKS</keystore.type
<keystore.password>wso2carbon</keystore.password>
<ciphertool.enable>true</ciphertool.enable
<keystore.alias>wso2carbon</keystore.alias
<keystore.name>wso2carbon.jks</keystore.name>
</properties>
....

4. Build the Docker image.

As a summary, we discussed how and why WSO2 Micro Integrator suits to the containerized architectures and later discussed WOW facts of generating immutable Docker images with WSO2 Integration Studio. Hope everything in this article makes sense for your development with containerized WSO2 Micro Integrator. If you have any questions, comment below. Cheers! 🍻

Resources

--

--

Sajitha Liyanage
Think Integration

Software Engineer @ WSO2 | Open Source Contributor | Computer Science Graduate @ UCSC