Running WSO2 Micro Integrator on Containers

To run your Micro Integrator solutions on Docker or Kubernetes, you need to first create an immutable docker image with the required synapse artifacts, configurations, and third-party dependencies by using the base Docker image of WSO2 Micro Integrator. You can then deploy and run the immutable images on Docker or Kubernetes. One advantage of having an immutable docker image is that you can easily implement a CI/CD pipeline to systematically test the solution before deploying in production.

Base Docker Images

Two types of base Docker images are available for the Micro Integrator:

  • The Micro Integrator Docker image (with the latest updates) is available in the WSO2 Docker Registry.

    Note that you need a valid WSO2 subscription to use the Docker image with updates. Therefore, you need to provide your log in credentials when downloading the Docker image. If you do not already have a subscription, you can get a free trial subscription.

    Micro Integrator Docker image (with updates)

    docker.wso2.com/wso2mi:latest

    Log in to WSO2 Docker Registry

    docker login docker.wso2.com
  • The community version of WSO2 Micro Integrator's base Docker image is available on DockerHub.

    Base Docker Image and Tag (community version)

    wso2/wso2mi:latest
    The wso2mi:latest tag points to the most lightweight version of the Micro Integrator, which includes the minimal Docker image based on Alpine Linux.

    Go to DockerHub to find the Micro Integrator Docker images that are based on Ubuntu and CentOS platforms.

Running the Micro Integrator on Docker

You can easily run your Micro Integrator solution in a Docker environment by using the Docker Exporter in WSO2 Integration Studio.

Create your integration solution

Once you have created your integration solution in WSO2 Integration Studio, you will have an integration project (maven multi module project) with all your integration artifacts. To run the solution on Docker, you need a Docker Exporter in the integration project.

Let's create a simple integration project with a Docker Exporter by running the Hello Docker sample template in WSO2 Integration Studio.

You will get the following integration project in the project explorer:

Build and Push the Docker image

Open the pom.xml file of your Docker Exporter module and update the details for your Docker image.

  • The base Docker image to use.
  • The target Docker registry to which the Docker image should be published.

Click Build to first build the image, and then click Push to push the image to a Docker registry.

Start Docker container

Start a container in your Docker environment. This command will pull the image from your Docker registry and start a container.

docker run -d -p 8290:8290 sample_docker_image

Running the Micro Integrator on Kubernetes

Kubernetes is an open source container orchestration system for automating, scaling, and managing your application deployments.

You can easily run your Micro Integrator solution in a Kubernetes environment by using the Kubernetes Exporter in WSO2 Integration Studio and the EI Kubernetes Operator.

See the EI Kubernetes Operator samples for instructions.

Create Docker files manually

If you already have packaged integration artifacts in a CAR file, you can manually create the Docker files and deploy on Docker. Follow the steps given below.

Tip

Before you begin: Use WSO2 Integration Studio to create the integration artifacts and then export the integration artifacts into a CAR file.

  1. Create the Dockerfile as shown below.

    This file contains instructions to download the base Docker image of WSO2 Micro Integrator from DockerHub (community version) or the WSO2 Docker Registry (includes updates), and to copy the integration artifacts to the Micro Integrator.

    The Dockerfile:

    FROM <docker_image_name>:1.2.0
    COPY <directoy_path>/<capp_name> $WSO2_SERVER_HOME/repository/deployment/server/carbonapps
    The information specified in the Docker file is as follows:

    Parameter Description
    FROM

    The 'FROM' tag in the docker file specifies the WSO2 Micro Integrator version that should be downloaded. You can use the updated Docker image or the community version as shown below. The version is 1.2.0 of the WSO2 Micro Integrator. If required, you can use an earlier version by replacing 'latest' with the version number.

    Example 1: Docker image with updates
    FROM docker.wso2.com/wso2mi:1.2.0
    Example 2: Docker image without updates (community version)
    FROM wso2/wso2mi:1.2.0
    COPY

    The 'COPY' tag in the docker file specifies the directory path to your composite application, followed by the location in your Docker instance to which the composite application should be copied. The location of MI_HOME can be referred to as 'WSO2_SERVER_HOME' since this is exposed as an environment variable from the base image.

    Example 1
    COPY carbonapps $WSO2_SERVER_HOME/repository/deployment/server/carbonapps

    If you have multiple composite application that you want to deploy in Docker using a single Docker image, add another entry to the Dockerfile. For example:

    Example 2
    COPY carbonapps $WSO2_SERVER_HOME/repository/deployment/server/carbonapps
    COPY <sample_carbon_app> $WSO2_SERVER_HOME/repository/deployment/server/carbonapps

  2. Create an immutable Docker image for your integration artifacts on WSO2 Micro Integrator by executing the following command from the location of your Dockerfile.

    docker build -t sample_docker_image .
  3. Start a Docker container by running the Docker image as shown below.

    docker run -d -p 8290:8290 sample_docker_image
Top