Cloud Software Group, Inc. EBX®
Documentation > Administration Guide > EBX® Container Edition
Navigation mode Documentation > Administration Guide > EBX® Container Edition

# Customizing the image

The EBX® Container Edition image can be used as a parent image to create a customized image.

## User specified in Docker file

The EBX® Container Edition image’s docker file specifies user ebx .

A Docker file extending the image may need to set current user to root and later switch back to ebx as in following sample:

    FROM ebx:6.2.1
    USER root
    # Do something requiring being root...
    USER ebx

## Setting default configuration

Setting default EBX® configuration should not be based on /opt/ebx/conf/ebx-container.properties as this file may be overridden at runtime.

Instead, proceed as following in the Docker file:

- Rename file /opt/ebx/webapps/ebx/WEB-INF/ebx-default.properties , for example to ebx-default-original.properties .

- Create a new file /opt/ebx/webapps/ebx/WEB-INF/ebx-default.properties container new property values. This file must define property ebx.file.previous set to the original property file new name, for example ebx-default-original.properties .

For the list of properties supported by EBX®, see TIBCO EBX® main configuration file .

Here is a sample Docker file that set the locale to "en-US"

    FROM ebx:6.2.1
    USER root

    RUN mv /opt/ebx/webapps/ebx/WEB-INF/ebx-default.properties \
           /opt/ebx/webapps/ebx/WEB-INF/ebx-default-original.properties

    RUN echo "ebx.file.previous=ebx-default-original.properties" >> \
             /opt/ebx/webapps/ebx/WEB-INF/ebx-default.properties
    RUN echo "ebx.locales.available=en-US" >> /opt/ebx/webapps/ebx/WEB-INF/ebx-default.properties

    USER ebx

## Adding a custom module

One can extend EBX® by developing custom modules. An EBX® module is a standard Jakarta EE web application, packaging various resources such as XML Schema documents, Java classes and static resources.

For more information on EBX® module, see Packaging TIBCO EBX® modules .

With EBX® Container Edition, it is recommended to deploy modules as "unpacked" (exploded) WARs. This allows a faster startup and avoids unnecessarily increasing container size because Tomcat will not need to unpack WAR files.

The recommended way to add a module to an image is to:

- Copy the WAR to folder /opt/ebx/webapps . As stated previously, exploded format is recommended.

- Create an associated Tomcat context XML file named module_war_name.xml and copy it to folder /opt/ebx/contexts.

- Optionally, copy shared JARs to folder /opt/ebx/lib .

The Tomcat context XML file should have the following content:

    <?xml version="1.0" encoding="UTF-8"?>
    <Context docBase="${ebx.container.base}/webapps/module_war_name"/>

Using variable ${ebx.container.base} is required for correct support of environment variable EBX_ROOT_PATH .

For more information on Tomcat contexts see https://tomcat.apache.org/tomcat-10.1-doc/config/context.html#Defining_a_context .

Here is a sample Docker file:

    FROM ebx:6.2.1
    USER root
    COPY "./module_name.xml" "/opt/ebx/contexts"
    COPY "./module_name" "/opt/ebx/webapps"
    USER ebx

## Adding a new locale

To add one or more locales, you need the language packs software zip file(s). Here is a shell script that creates a Docker file and builds the target image. This script can be modified to suit your needs.

    #!/bin/bash
    #
    # Build a docker image tag including language packs for
    # a specified version available from the current folder.
    #
    # Usage: build.sh <lp-version> <from-tag> <build-tag>
    #
    set -e

    LP_VERSION="$1"
    FROM_TAG="$2"
    BUILD_TAG="$3"

    if (( $# != 3 )); then
      echo "Syntax $0 <lp-version> <from-tag> <build-tag>" 1>&2
      exit 1
    fi

    EBX_LOCALES=""

    if [ -d files ]; then
      rm -rf files
    fi

    mkdir -p "files/lib"

    for zip in TIB_ebx-lp_${LP_VERSION}_addon_*_languagepack*.zip ; do
      locale=$(echo ${zip} | sed -e 's/.*languagepack-\([a-zA-Z-]*\).zip/\1/g')
      EBX_LOCALES="${EBX_LOCALES},${locale}"
      echo unzip locale=${locale}
      unzip -oq ${zip}

      if [ -d ${locale} ] ; then
        mkdir -p "files/webapps/ebx-manager/www/${locale}"
        mv "${locale}/" "files/webapps/ebx-manager/www/"
      fi
    done

    mv *.jar "files/lib"

    cat > Dockerfile << EOF
    FROM ${FROM_TAG}

    COPY "files" "/opt/ebx"

    USER root

    RUN mv "/opt/ebx/webapps/ebx/WEB-INF/ebx-default.properties" \
           "/opt/ebx/webapps/ebx/WEB-INF/ebx-default-original.properties" &&\
      echo "ebx.file.previous=ebx-default-original.properties" >> \
           "/opt/ebx/webapps/ebx/WEB-INF/ebx-default.properties" &&\
      echo "ebx.locales.available=en-US,fr-FR${EBX_LOCALES}" >> \
           "/opt/ebx/webapps/ebx/WEB-INF/ebx-default.properties"

    USER ebx
    EOF

    docker build -t ${BUILD_TAG} .

    echo "To run a container using this image, use command:"
    echo " EBX_LOCALES=${EBX_LOCALES}"
    echo " docker run -p 8080:8080 -d ${BUILD_TAG}"

In this example, libs and optional documentation are copied, then locales are set using the method described in the setting default configuration section.

## Adding a new JDBC driver

Adding a new JDBC driver is similar to adding a new library. You simply have to copy the jar file in the "/opt/ebx/lib" folder with the correct permission. Here is an example with the Oracle JDBC driver:

    FROM ebx:6.2.1
    USER root

    ADD \
     https://repo1.maven.org/maven2/com/oracle/database/jdbc/ojdbc11/21.8.0.0/ojdbc11-21.8.0.0.jar \
     "/opt/ebx/lib/"

    RUN chmod +r "/opt/ebx/lib/ojdbc11-21.8.0.0.jar"

    USER ebx

See Database drivers for more information.

## Adding a driver for the Metadata database

Adding a driver for the Metadata database requires installing the corresponding Python module. Here is an example of how we can customize the Docker image to add the driver for the PostgreSQL database:

    FROM ebx:6.2.1
    USER root

    RUN cd "/opt/ebx/classifier" \
    && . venv/bin/activate \
    && pip3 install psycopg2==2.9.9

    USER ebx

See SQLAlchemy dialects for more information about the database drivers that can be used with SQLAlchemy.

Documentation > Administration Guide > EBX® Container Edition