Configuring Docker Images and Networks

Editing Dockerfiles

You enable Docker support for a new StreamBase project by means of the check box on the Configure Maven Artifact panel.

Docker-enabled StreamBase application projects have the following additional features, compared to non-Docker projects.

src/main/docker

Studio places the Dockerfiles and a run script that it uses to create Docker images in src/main/docker:

You can edit these files before creating your Docker image to specify different defaults. See the comments in the files for the variables you can change.

For example, this passage is at the top of src/main/docker/base/Dockerfile. To specify a different administration username for the node in the Docker container, change tibco to another name.

#
# Set environment
#
ENV PRODUCT_HOME     /opt/tibco/streambase
ENV RUNTIME_HOME     /var/opt/tibco/streambase
ENV JAVA_HOME        /etc/alternatives/jre
ENV PATH             /bin:/usr/sbin:${PRODUCT_HOME}/distrib/tibco/bin
ENV USER_NAME        tibco
src/main/configurations

Docker–enabled projects have three HOCON configuration files created with default settings to configure containerized StreamBase nodes:

app.conf
defaultmode.conf
security.conf

The domain name value of the hosts property in security.conf is taken from the dockerDomain property that you specify when creating the project. The default is example.com.

// Default host-based security
//
name = "deploy_1st"
version = "1.0.0"
type = "com.tibco.ep.dtm.configuration.security"

configuration = {
    //  Make all nodes trusted in the docker network to
    //  eliminate the need for any credentials when accessing
    //  remote nodes
    //
    TrustedHosts = {
        hosts = [ "*.example.com" ]
    }
}

Configuring Multiple Docker Containers

To create and run more than one Docker containerized StreamBase node that can all communicate with each other without user authentication, you must configure both Docker network settings and StreamBase Runtime settings as follows:

  • Configure Docker network settings with --network and --hostname options for the docker run command.

  • Specify TrustedHosts membership in the same network for your StreamBase Runtime nodes.

  • Use the same domain name in the --network Docker option and in the TrustedHosts configuration.

The following example configures a three node cluster, with node each running the same docker_1st StreamBase Application.

docker network create example.com
docker run -d --name nodeA -e NODENAME=A.cluster -p 2000:2000 
  --network example.com --hostname A.example.com sample/docker_1st
docker run -d --name nodeB -e NODENAME=B.cluster -p 2001:2000 
  --network example.com --hostname B.example.com sample/docker_1st
docker run -d --name nodeC -e NODENAME=C.cluster -p 2002:2000 
  --network example.com --hostname C.example.com sample/docker_1st

Port 2000 is the default admin port for Studio-created Docker images, as specified in the start-node script described in the previous section. To run more than one node, map different Docker host's ports to the default node's admin port. Thus, the commands in this example map host ports 2000, 2001, and 2002 to the different port 2000's for the different nodes named nodeA, nodeB, and nodeC, respectively.

This example is artificial, because the three nodes contain only the firstapp EventFlow fragment with no availabilityZones HA configuration. You can add that configuration to each node and recreate the Docker images.

For further information on command line options for the docker run command, see Configure Networking in Docker's documentation.