Data Services Builder with Docker

Version 3

    Introduction

     

    This article details alternative instructions on how to obtain Data Services Builder (ds-builder).

     

    'Docker provides a container for wrapping software in a complete filesystem that contains everything needed to run: code, runtime, system tools, system libraries – anything that can be installed on a server. This guarantees that the software will always run the same, regardless of its environment.'

     

    To install a fully working ds-builder, a number of software components are required, which the configured docker container builds supply:

    • Operating System;
    • Java Runtime;
    • EAP / Wildfly Application Server (configured for https / ssl access);
    • Teiid Runtime deployment;
    • vdb-builder deployment;
    • ds-builder deployment.

     

    Installation of Docker

    The Docker server and client are necessary pre-requisites for installing and executing any containers. To learn more about the specifics of docker, refer to the Docker Documentation. Specific instructions for installation of Docker on Linux, Windows and Mac are available.

     

    Available Docker Image Builds

    1. dsbuilder - container comprising only the software components required to start a new ds-builder instance;
    2. dsbuilder-mysql - the ds-builder container with an additional mysql database instance installed alongside for test data;
    3. dsbuilder-mysql-with-test-data - the ds-builder container with US States and patient test data installed in the accompanying mysql database;
    4. dsbuilder-mysql-usstates - the ds-builder container with an example dataservice installed in the workspace, targetting US States test data installed in the accompanying mysql database;
    5. dsbuilder-mysql-patients - the ds-builder container with an example dataservice installed in the workspace, targetting patient test data installed in the accompanying mysql database.

     

    Installation of a Docker Image

    Assuming Docker is correctly installed on the host, the following command is required for installating and executing a container.

     

    docker run -it -p 8443:8443 -p 9900:9900 -p 31000:31000 teiidkomodo/[IMAGE-NAME]
    

     

    This command:

    1. Downloads the image and its pre-requisites;
    2. Installs then starts a container instance;
    3. Exposes the requisite ports to allow external connections, ie. https (8443), wildfly-admin (9990), teiid-jdbc (31000).

     

    Once started, the container will function (via the ports) as if the software components were all installed locally on the host.

     

    Credentials of the Server Instances

    • Wildfly
      • Management user:  admin  password: secret
      • Teiid JDBC user:  user  password: user1234!
    • Mysql
      • Root user:  root  password: secret (only accessible locally within in the container)
      • Management user:  admin  password: admin

     

    Starting and Stopping a Docker Container

    1. Using 'docker run' will create a container instance from downloaded image and start it. Subsequent stopping and starting calls can be executed using:

       

      docker start/stop [CONTAINER NAME OR ID]
      

       

    2. Repeated calls to 'docker run' will create different instances of the same image, which are independent of one another. To ensure a single instance of the image is always run then the --name [LABEL] switch should be appended to the command, eg. --name pj. Subsequent uses of this switch will mean that docker will fail to start a container if a container with this name already exists. If a new container is required then the old container should be stopped then removed using:

       

      docker rm [CONTAINER NAME OR ID]
      

     

    Interacting / Debugging a Docker Container

    Access to the internal filesystem of a container may sometimes become necessary. In order to access a running container, the following command should be executed:

     

    docker exec -i -t [CONTAINER NAME OR ID] /bin/bash
    

     

    • The container's name and id can be found using:

     

    docker ps
    

     

    • The command 'docker exec' will attach to the existing container and start a bash interactive shell inside the container. The user can then navigate the filesystem in the same manner as the host (assuming the host is a unix system).

     

    Persisting Configuration or Deployment Changes to a Docker Container

    A ds-builder container instance can be started, stopped, restarted and debugged. However, with the commands detailed above, it can only be modified using the ports exposed. Should new deployments be required or an alternative ssl certificate need installation then the container's filesystem will need modification. To achieve this, external directories can be mounted into the container, culminating in the directories' files existing in both the container's and host's filesystems. For example, to mount an external Wildfly configuration directory add the following switch:

     

    docker run -v [HOST WILDFLY CONFIGURATION DIRECTORY]:/opt/jboss/wildfly/standalone/configuration ... ...
    

     

    Changes to the files contained in this directory will presist after the container has been stopped so it is important to revert any changes should a new container instance be executed, eg. deployments listed in the configuration xml file may not be valid for a new instance.