Skip to content

Running WSO2 Integrator: SI with Docker and Kubernetes

This tutorial shows how to run the WSO2 Integrator: SI in Docker. To run it in Kubernetes, see Running the WSO2 Integrator: SI with Kubernetes.

Running the WSO2 Integrator: SI with Docker

This section shows you how to run WSO2 Integrator: SI in Docker. This involves installing Docker, running the WSO2 Integrator: SI in Docker and then deploying and running a Siddhi application in the Docker environment.

Before you begin:

  • The system requirements are as follows:
    • 3 GHz Dual-core Xeon/Opteron (or latest)
    • 8 GB RAM
    • 10 GB free disk space
  • Install Docker by following the instructions provided in here.
  • Save the following Siddhi application as a .siddhi file in a preferred location in your machine.
    @App:name('MySimpleApp')
    @App:description('Receive events via HTTP transport and view the output on the console')
    @source(type = 'http', receiver.url='http://0.0.0.0:8006/productionStream', basic.auth.enabled='false',
       @map(type='json'))
    define stream SweetProductionStream (name string, amount double);
    @sink(type='log')
    define stream TransformedProductionStream (nameInUpperCase string, amount double);
    -- Simple Siddhi query to transform the name to upper case.
    from SweetProductionStream
    select str:upper(name) as nameInUpperCase, amount
    insert into TransformedProductionStream;
    

    Note the following about this Siddhi application.
    • The Siddhi application operates in Docker. Therefore, the HTTP source configured in it uses a receiver URL where the host number is 0.0.0.0.
    • The 8006 port of the receiver URL is the same HTTP port that you previously exposed via Docker.

Starting the WSO2 Integrator: SI in Docker

In this scenario, you are downloading and installing the WSO2 Integrator: SI via Docker.

WSO2 provides open source Docker images to run WSO2 Integrator: SI on Docker Hub. You can view these images at Docker Hub - WSO2.

To run the WSO2 Integrator: SI from the open source image, follow the steps below:

  1. To pull the required WSO2 Integrator: SI distribution with updates from the Docker image, issue the following command.

    docker pull wso2/wso2si:<SI_VERSION>

  2. Expose the required ports via docker when running the docker container. In this scenario, you need to expose the following ports:

    • The 9443 port where the WSO2 Integrator: SI server is run.

    • The 8006 HTTP port from which Siddhi application you are deploying in this scenario receives messages.

    To expose these ports, issue the following command.

    docker run -p 9443:9443 -p 8006:8006 \
      -v <local-absolute-siddhi-file-path>/MySimpleApp.siddhi:/apps/MySimpleApp.siddhi \
      wso2/wso2si:<SI_VERSION> \
      -Dapps=/apps/MySimpleApp.siddhi
    

    Info

    In the above command, you are mounting the location where you have saved the MySimpleApp.siddhi file so that the WSO2 Integrator: SI can locate it and run it when it starts in Docker. Therefore, replace <local-absolute-siddhi-file-path> with the path in which you saved the Siddhi application in your machine.

  3. If you did not mount the MySimpleApp.siddhi file when starting the container, deploy it through the WSO2 Integrator: SI REST API:

    curl -X POST -k https://localhost:9443/siddhi-apps \
      --header "Content-Type: text/plain" \
      -u admin:admin \
      --data-binary @MySimpleApp.siddhi
    

    The -k flag disables TLS verification (WSO2 Integrator: SI ships with a self-signed certificate by default). The server responds with HTTP 201, and the Siddhi application is deployed within seconds. The following log appears in the console in which you started the WSO2 Integrator: SI in Docker:

    INFO {org.wso2.carbon.streaming.integrator.core.internal.StreamProcessorService} - Siddhi App MySimpleApp deployed successfully
    

Now the WSO2 Integrator: SI has started in the Docker environment.

Trying-out the Siddhi application

To try out the MySimpleApp Siddhi application you deployed in Docker, issue the following CURL command.

curl -X POST -d "{\"event\": {\"name\":\"sugar\",\"amount\": 20.5}}"  http://0.0.0.0:8006/productionStream --header "Content-Type:application/json"

The following output appears in the console in which you started the WSO2 Integrator: SI in Docker.

HTTP Response

Running the WSO2 Integrator: SI with Kubernetes

To run the WSO2 Integrator: SI in Kubernetes, use the WSO2 Helm chart. For instructions, including how to deploy and try out a Siddhi application, see Installing WSO2 Integrator: SI Using Kubernetes.

Note

The Siddhi Kubernetes operator is not supported with WSO2 Integrator: SI 4.4.x.