Configuring Dockerfiles 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 are used 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, consider 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, you can change tibco to another name.

#
# Set environment
#
ENV STREAMING_PRODUCT_HOME     /opt/tibco/streambase
ENV STREAMING_RUNTIME_HOME     /var/opt/tibco/streambase
ENV JAVA_HOME        /etc/alternatives/jre
ENV PATH             /bin:/usr/sbin:${STREAMING_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 = "docker_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.

    This is done for you when you specify a dockerDomain when creating the StreamBase Application project. Studio takes the domain name you provide and enters it into the TrustedHosts root object of the security.conf configuration file created for that project.

  • 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 STREAMING_NODENAME=A.cluster \
  --network example.com --hostname A.example.com docker_1st:1.0.0
docker run -d --name nodeB -e STREAMING_NODENAME=B.cluster \
  --network example.com --hostname B.example.com docker_1st:1.0.0
docker run -d --name nodeC -e STREAMING_NODENAME=C.cluster \
  --network example.com --hostname C.example.com docker_1st:1.0.0

This example is artificial, because the three nodes contain only the firstapp EventFlow fragment with no availabilityZones HA configuration. You can add that configuration and recreate the Docker images. For further information on availabilityZones configuration, see Runtime Node Configuration in the Configuration Guide.

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