Skip to main content
Version: Deploy 24.3

Setting up JDBC and MQ Drivers

Starting with Digital.ai Deploy version 24.3.0, there are two types of images available for Kubernetes-based setups with an external database or message queue: slim and non-slim.

Slim Image: This lightweight version of the Deploy is packaged only with the PostgreSQL driver and the RabbitMQ message queue driver. This helps to reduce the image size and minimize security risks by including only essential components.

Non-Slim Image: The non-slim image comes pre-packaged with a set of supported drivers, such as JDBC database drivers (PostgreSQL, MySQL, H2, and MSSQL) and message queue drivers (ActiveMQ and RabbitMQ).

This document provides instructions on two available options for handling custom drivers:

Using Slim or Non-Slim Images: Focuses on adding JDBC and Message Queue (MQ) drivers to the respective directories in the Deploy container.

Building Custom Deploy Images: Provides steps for creating custom master and worker images that includes specific drivers such as the Oracle JDBC driver.

Both options allow for the addition of custom libraries to tailor the Deploy image to your environment.

Option 1: Use Slim or Non-Slim Images

Tip: This documentation focuses on the Oracle JDBC driver. However, the process for adding other JDBC and MQ drivers is similar; they should be placed in the driver/mq directory.

Directories for JDBC and MQ Drivers:

  • JDBC Drivers Directory: driver/jdbc

  • Message Queue (MQ) Drivers Directory: driver/mq

Prerequisites

Ensure you are using the slim version of the Deploy image, tagged as 24.3-slim (or the version you are working with).

Steps to add Oracle JDBC driver using slim image

  1. Customize CR with a patch file:

Use the following patch file to download the Oracle JDBC driver and place it in the appropriate directory within the slim image:

cat << EOF > custom-slim-image-patch.yaml
spec:
external:
db:
enabled: true
main:
url: jdbc:oracle:thin:@//db_hostname:1521/db
username: user
password: pass
report:
url: jdbc:oracle:thin:@//db_hostname:1521/db
username: user
password: pass
postgresql:
install: false
master:
initContainers:
- name: db-install
image: library/busybox:stable
imagePullPolicy: IfNotPresent
securityContext:
runAsNonRoot: true
runAsUser: 10001
command:
- "/bin/sh"
- "-c"
args:
- |
export LIB_VERSION=23.4.0.24.05
export LIB_FILE=ojdbc11-${LIB_VERSION}.jar
export LIB_URL=https://repo1.maven.org/maven2/com/oracle/database/jdbc/ojdbc11/${LIB_VERSION}/${LIB_FILE}
if [ -f "/opt/xebialabs/xl-deploy-server/driver/jdbc/${LIB_FILE}" ]
then
echo "${LIB_FILE} exists"
elif wget -P /opt/xebialabs/xl-deploy-server/driver/jdbc ${LIB_URL}
then
echo "${LIB_URL} downloaded"
else
echo "Download failed"
fi
volumeMounts:
- name: custom-jdbc-drivers
mountPath: /opt/xebialabs/xl-deploy-server/driver/jdbc
extraVolumes:
- name: custom-jdbc-drivers
emptyDir: {}
extraVolumeMounts:
- name: custom-jdbc-drivers
mountPath: /opt/xebialabs/xl-deploy-server/driver/jdbc
readOnly: true
diagnosticMode:
enabled: false
worker:
initContainers:
- name: db-install
image: library/busybox:stable
imagePullPolicy: IfNotPresent
securityContext:
runAsNonRoot: true
runAsUser: 10001
command:
- "/bin/sh"
- "-c"
args:
- |
export LIB_VERSION=23.4.0.24.05
export LIB_FILE=ojdbc11-${LIB_VERSION}.jar
export LIB_URL=https://repo1.maven.org/maven2/com/oracle/database/jdbc/ojdbc11/${LIB_VERSION}/${LIB_FILE}
if [ -f "/opt/xebialabs/deploy-task-engine/driver/jdbc/${LIB_FILE}" ]
then
echo "\${LIB_FILE} exists"
elif wget -P /opt/xebialabs/deploy-task-engine/driver/jdbc \${LIB_URL}
then
echo "\${LIB_URL} downloaded"
else
echo "Download failed"
fi
volumeMounts:
- name: custom-jdbc-drivers
mountPath: /opt/xebialabs/deploy-task-engine/driver/jdbc
extraVolumes:
- name: custom-jdbc-drivers
emptyDir: {}
extraVolumeMounts:
- name: custom-jdbc-drivers
mountPath: /opt/xebialabs/deploy-task-engine/driver/jdbc
readOnly: true
diagnosticMode:
enabled: false
EOF

The initContainer is configured to download the Oracle JDBC driver and place it directly in the driver/jdbc directory, which is already part of the image.

  1. Patch the CR in digitalai namespace.

Apply the patch to your Kubernetes resource:

kubectl patch -n digitalai digitalaideploys.xld.digital.ai dai-xld \
--type=merge --patch-file custom-slim-image-patch.yaml

  1. Restart the master and worker pods.

Note: After patching the CR configuration, the master and worker will not automatically restart with the new settings. You will need to manually delete the STS:

kubectl delete sts dai-xld-digitalai-deploy-master -n digitalai
kubectl delete sts dai-xld-digitalai-deploy-worker -n digitalai

After restarting, the master and worker pods will launch with the new images, which include the Oracle JDBC driver in the lib directory. The external Oracle DB configuration will be applied and used from the central configuration server.

Option 2: Build Deploy Images with Custom Libraries

This option uses custom master and worker images to customize the Deploy’s lib folder with additional lib - Oracle JDBC. The example starts with building custom images with the additional jar, after that custom images are used to run the containers.

Prerequisites

  • Deploy installed on a Kubernetes cluster (e.g., in the digitalai namespace).

  • A DockerHub account (or another image registry) to upload the custom images.

With this option, you will have statically built and prepared images that can be scanned and tested with your tool before any production use.

Note: In the following examples, we are downloading the image from the public repository. Ensure that your artifact repository is trusted and secured by your organization. The URL location of the JAR file is provided as an example and can refer to any other repository or library.

Steps to build Deploy images with custom libraries

  1. Create Dockerfile for master image with the following:
cat << EOF > Dockerfile-xl-deploy
FROM xebialabs/xl-deploy:24.1.2

USER 0

# download oracle JDBC driver
ENV LIB_VERSION=23.4.0.24.05
ENV LIB_FILE=ojdbc11-\${LIB_VERSION}.jar
ENV LIB_URL=https://repo1.maven.org/maven2/com/oracle/database/jdbc/ojdbc11/\${LIB_VERSION}/\${LIB_FILE}
# if you need to download by using auth for example basic auth, use RUN with curl line instead of following ADD command
# RUN curl -u $user:$pass -o /tmp/\${LIB_FILE} -L \${LIB_URL}
ADD \${LIB_URL} lib/\${LIB_FILE}
RUN chown 10001:10001 lib/\${LIB_FILE} && chmod 664 lib/\${LIB_FILE}

USER 10001

ENTRYPOINT ["/opt/xebialabs/tini", "--", "/opt/xebialabs/xl-deploy-server/bin/run-in-container.sh"]
EOF

  1. Create Dockerfile for worker image:
cat << EOF > Dockerfile-deploy-task-engine
FROM xebialabs/deploy-task-engine:24.1.2

USER 0

# download oracle JDBC driver
ENV LIB_VERSION=23.4.0.24.05
ENV LIB_FILE=ojdbc11-\${LIB_VERSION}.jar
ENV LIB_URL=https://repo1.maven.org/maven2/com/oracle/database/jdbc/ojdbc11/\${LIB_VERSION}/\${LIB_FILE}
# if you need to downaload by using auth for example basic auth, use RUN with curl line instead of following ADD command
# RUN curl -u $user:$pass -o /tmp/\${LIB_FILE} -L \${LIB_URL}
ADD \${LIB_URL} lib/\${LIB_FILE}
RUN chown 10001:10001 lib/\${LIB_FILE} && chmod 664 lib/\${LIB_FILE}

USER 10001

ENTRYPOINT ["/opt/xebialabs/tini", "--", "/opt/xebialabs/deploy-task-engine:/bin/run-in-container.sh"]
EOF

  1. Build and push the images to the DockerHub:

Note: Use build args for the username and password if you need to log in to your artifact repository.

docker build --build-arg user=your_username --build-arg pass=your_password -f Dockerfile-deploy-task-engine -t xebialabsunsupported/deploy-task-engine:24.1.2-ojdbc11 .
docker push xebialabsunsupported/deploy-task-engine:24.1.2-ojdbc11

  1. Customize CR with patch file:

Here’s how you can use custom images by updating the master and worker image tags and modifying the database configuration to use the Oracle JDBC driver.

cat << EOF > custom-image-and-external-db-patch-1.yaml
spec:
external:
db:
enabled: true
main:
url: jdbc:oracle:thin:@//db_hostname:1521/db
username: user
password: pass
report:
url: jdbc:oracle:thin:@//db_hostname:1521/db
username: user
password: pass
postgresql:
install: false
master:
image:
repository: xebialabsunsupported/xl-deploy
tag: 24.1.2-ojdbc11
imagePullPolicy: Always
diagnosticMode:
enabled: false
worker:
image:
repository: xebialabsunsupported/deploy-task-engine
tag: 24.1.2-ojdbc11
imagePullPolicy: Always
diagnosticMode:
enabled: false
EOF
  1. Patch the CR in digitalai namespace:
kubectl patch -n digitalai digitalaideploys.xld.digital.ai dai-xld \
--type=merge --patch-file custom-image-and-external-db-patch-1.yaml
  1. Restart the master and worker pods.

Note: After patching the CR configuration, the master and worker will not automatically restart with the new settings. You will need to manually delete the StatefulSet (STS).

kubectl delete sts dai-xld-digitalai-deploy-master -n digitalai
kubectl delete sts dai-xld-digitalai-deploy-worker -n digitalai

After restarting, the master and worker pods will launch with the new images, which include the Oracle JDBC driver in the lib directory. The external Oracle DB configuration will be applied and managed through the central configuration server.