The libraries may be extracted from an installation kit (or taken from an existing installation), and copied to the container using the
COPY directive in your Dockerfile.
For example the ActiveSpaces Operators rely, not only on the tibdg.jar Java library file, but also on the native libraries from the FTL and ActiveSpaces installations. By default, FTL and ActiveSpaces are installed to the following directories:
/opt/tibco/ftl/6.6/lib/
/opt/tibco/as/4.6/lib/
The
*.so native library files in these directories need to be copied, along with the java library (
/opt/tibco/as/4.6/lib/tibdg.jar), to the Docker container. These paths then need to be specified in your SB engine configuration file:
configuration =
{
StreamBaseEngine =
{
externalNativeLibraryPath =
{
linux_x86_64 =
[
"/opt/tibco/as/4.6/lib",
"/opt/tibco/ftl/6.6/lib"
]
}
externalClassPath =
[
"/opt/tibco/as/4.6/lib/tibdg.jar"
]
}
}
In your Streaming application project's Docker base location (under
src/main/docker/base/), create folders to store copies of the FTL and ActiveSpaces libraries:
src/main/docker/base/ftl-libs/
src/main/docker/base/as-libs/
Then obtain installation kits for FTL and Activespaces, and extract the needed libraries:
$ mkdir ~/tmp
$ cd ~/tmp
$ unzip /path/to/TIB_ftl_6.6.1_linux_x86_64.zip
$ unzip /path/to/TIB_as_4.6.1_linux_x86_64.zip
$ tar -xzf TIB_ftl_6.6.1/tar/TIB_ftl_6.6.1_linux_x86_64-java.tar.gz
$ tar -xzf TIB_ftl_6.6.1/tar/TIB_ftl_6.6.1_linux_x86_64-runtime.tar.gz
$ tar -xzf TIB_ftl_6.6.1/tar/TIB_ftl_6.6.1_linux_x86_64-thirdparty.tar.gz
$ tar -xzf TIB_as_4.6.1/tar/TIB_as_4.6.1_linux_x86_64-java.tar.gz
$ tar -xzf TIB_as_4.6.1/tar/TIB_as_4.6.1_linux_x86_64-runtime.tar.gz
$ tar -xzf TIB_as_4.6.1/tar/TIB_as_4.6.1_linux_x86_64-thirdparty.tar.gz
$ cp opt/tibco/ftl/6.6/lib/* /path/to/project/src/main/docker/base/ftl-libs/
$ cp opt/tibco/as/4.6/lib/* /path/to/project/src/main/docker/base/as-libs/
Next, edit the Dockerfile (under
/path/to/project/src/main/docker/base/Dockerfile) to copy these files to the container, and set the
LD_LIBRARY_PATH environment variable:
#
# Set environment
#
ENV STREAMING_PRODUCT_HOME /opt/tibco/streambase
ENV STREAMING_RUNTIME_HOME /var/opt/tibco/streambase
ENV TIBFTL_LIBS /opt/tibco/ftl/6.6/lib
ENV TIBDG_LIBS /opt/tibco/as/4.6/lib
ENV JAVA_HOME /etc/alternatives/jre
ENV PATH /bin:/usr/sbin:${STREAMING_PRODUCT_HOME}/distrib/tibco/bin
ENV LD_LIBRARY_PATH ${TIBFTL_LIBS}:${TIBDG_LIBS}
ENV USER_NAME tibco
...
#
# Install FTL and AS libraries
#
RUN mkdir -p ${TIBFTL_LIBS}
RUN mkdir -p ${TIBDG_LIBS}
COPY ftl-libs/. ${TIBFTL_LIBS}
COPY as-libs/. ${TIBDG_LIBS}
RUN chmod 755 ${TIBFTL_LIBS}/*
RUN chmod 755 ${TIBDG_LIBS}/*
...
Finally, build your Docker image and run it:
$ cd /path/to/project/
$ mvn clean package -DskipTests
$ docker run -d --name deployas -e STREAMING_NODENAME=deploy.as deployas:0.0.1-SNAPSHOT