Self-Hosted Extensions

Add IBM Db2 support to a self-hosted Ragnerock deployment by building extended images from the Dockerfile we publish.

Some databases need client software that Ragnerock doesn’t ship in its own images. On a self-hosted deployment you add it yourself: build new images on top of ours with a Dockerfile we publish, push them to your registry, and point the Helm chart at them. Nothing else in the deployment changes.

IBM Db2 is the one extension today. It’s what lets you use Db2 as a data database and as a SQL source. Hosted Ragnerock doesn’t offer it.

What the Db2 extension adds

The Dockerfile lives in the extensions/db2/ directory of the Ragnerock release you run, next to two small configuration files it copies into the image. It installs three packages from PyPI into the image’s Python environment:

  • ibm_db, IBM’s Db2 driver, which bundles IBM’s Db2 CLI driver;
  • ibm_db_sa, the SQLAlchemy dialect for it;
  • db2-sqlglot-dialect, IBM’s Db2 dialect for the SQL parser Ragnerock uses.

It also:

  • removes the compiled build of that SQL parser (the sqlglotc package), because IBM’s dialect can’t run on it. The parser falls back to its pure-Python build, so SQL parsing is a little slower in these images;
  • adds a Db2 CLI driver configuration that keeps the driver’s trace off (a trace can record statement text and values) and its diagnostic log small, written under /tmp;
  • adds a default krb5.conf that lists no realms and keeps Kerberos server lookup off DNS;
  • sets DB2_DIAGPATH, DB2DSDRIVER_CFG_PATH and KRB5_CONFIG to point at those files.

The image still runs as the same unprivileged user, and the application directory stays read-only.

Build it for three images: db-service (the data database connection), data-ingestor (SQL sources) and api (it reads Db2 SQL to check source queries, though it never connects). No other image needs it.

Building the images

You need Docker with BuildKit, network access to PyPI, and the Ragnerock images for the version you run. The images are linux/amd64 only: IBM doesn’t publish the driver for ARM Linux.

Build once per image, with the image to extend as BASE_IMAGE and extensions/db2 as the build context:

VERSION=v2026.10.05
REGISTRY=registry.example.com/ragnerock

for image in db-service api data-ingestor; do
  docker build --platform linux/amd64 \
    --build-arg BASE_IMAGE=$REGISTRY/$image:$VERSION \
    -t $REGISTRY/$image-db2:$VERSION \
    extensions/db2
  docker push $REGISTRY/$image-db2:$VERSION
done

Use the extensions/db2 directory from the same release as VERSION, and tag the result with that version too.

Build arguments

ArgumentDefaultWhat it does
BASE_IMAGEnone, requiredThe Ragnerock image to extend
WITH_KERBEROSfalsetrue adds Kerberos support (below)
IBM_DB_VERSION3.2.6The ibm_db release to install
IBM_DB_SA_VERSION0.4.4The ibm_db_sa release to install
DB2_SQLGLOT_DIALECT_VERSION1.0.0The db2-sqlglot-dialect release to install
GSSAPI_VERSION1.12.0The gssapi release, with WITH_KERBEROS=true

The defaults are the versions the release was tested with, so leave them alone unless we tell you otherwise. In particular, stay on ibm_db 3.2.x: 3.3.0 crashes when it sends a string to a CLOB parameter, which Ragnerock does all the time. Ragnerock also checks the dialect package’s version when it starts and won’t use one outside the range it was tested with.

Kerberos

Kerberos sign-in to Db2 needs the MIT Kerberos libraries and the gssapi Python package. They aren’t installed by default, so customers who don’t use Kerberos carry nothing extra. Add them with:

--build-arg WITH_KERBEROS=true

gssapi doesn’t publish Linux wheels, so the Dockerfile compiles it in a separate build stage and copies only the result into the image. No compiler ends up in the image you deploy.

Build all three images the same way so they stay interchangeable, even though only db-service and data-ingestor make Kerberos connections.

Deploying with Helm

The chart builds every image reference from one registry, global.image.registry, plus each service’s image.name and a tag. So push the Db2 images to the registry the chart already uses, and change the three image names:

dbService:
  image:
    name: db-service-db2
api:
  image:
    name: api-db2
dataIngestor:
  image:
    name: data-ingestor-db2

If you tagged the Db2 images with the release version, as above, you don’t need to set a tag: the chart falls back to its own version. If you pull Ragnerock’s images straight from our registry today, mirror them into yours first so the Db2 images can sit next to them.

Once the new pods are running, open Settings > Database > Add Database. Db2 should be selectable. If it’s still shown as unavailable, the reason is next to it, and each service logs a “Db2 support” line at startup that says which part didn’t load.

Mounting your krb5.conf

For Kerberos, db-service and data-ingestor need your deployment’s krb5.conf, naming the realms your Db2 servers use and their KDCs. KDCs only ever come from this file. A database config can’t name its own, and Ragnerock won’t look them up in DNS. It refuses Kerberos entirely if the file doesn’t set dns_lookup_kdc = false, or if it turns dns_lookup_realm or dns_fallback on.

A minimal file:

[libdefaults]
    dns_lookup_kdc = false
    dns_lookup_realm = false
    dns_canonicalize_hostname = false
    rdns = false

[realms]
    EXAMPLE.COM = {
        kdc = kdc1.example.com:88
        kdc = kdc2.example.com:88
    }

The KDCs you list are trusted the way the cluster’s DNS servers are, so only list servers you control. Put the file in a ConfigMap:

kubectl create configmap ragnerock-krb5 --from-file=krb5.conf

and mount it over the image’s default with the chart’s existing volumes and volumeMounts values, at /etc/ragnerock/db2/krb5.conf:

dbService:
  volumes:
    - name: krb5-conf
      configMap:
        name: ragnerock-krb5
  volumeMounts:
    - name: krb5-conf
      mountPath: /etc/ragnerock/db2/krb5.conf
      subPath: krb5.conf
      readOnly: true
dataIngestor:
  volumes:
    - name: krb5-conf
      configMap:
        name: ragnerock-krb5
  volumeMounts:
    - name: krb5-conf
      mountPath: /etc/ragnerock/db2/krb5.conf
      subPath: krb5.conf
      readOnly: true

Kubernetes doesn’t update a file mounted with subPath when the ConfigMap changes, so restart the two deployments after editing it.

Changing Db2 settings

The Db2 settings have defaults that suit most deployments. To change one, add it to the service’s extraEnv, which takes the same entries as a Kubernetes container’s env. For example, to let db-service wait longer for a lock:

dbService:
  extraEnv:
    - name: DB2_LOCK_TIMEOUT_SECONDS
      value: "60"

Every service in the chart has an extraEnv value, so the same works for any other setting the chart doesn’t expose directly.

Upgrading

Rebuild the Db2 images every time you upgrade Ragnerock, from the new release’s extensions/db2 directory and on top of the new release’s images. The extended images contain a full copy of Ragnerock, so if you upgrade the chart and keep the old Db2 images, those three services keep running the old version against a database the new one has migrated.

Ragnerock notices this. Every image carries the version it was built from, and when db-service or data-ingestor reports a different version than the api, Db2 is shown as unavailable with “The Db2 images are from a different Ragnerock version than the rest of this deployment. Rebuild them for this version.” Rebuild and redeploy to clear it.

The constraints file

Every Ragnerock image has a file at /app/constraints.txt listing the exact version of each third-party Python package in the image. The Dockerfile installs with it as a constraint, so an extension can’t replace a package Ragnerock depends on. If a package it asks for needs a different version of something already installed, the build fails rather than your running service. We keep this file at that path from release to release, so you can rely on it if you extend the images in other ways.

Licensing

Building the image downloads IBM’s packages from PyPI, including the Db2 CLI driver bundled with ibm_db. Ragnerock doesn’t distribute them. Their licenses are between you and IBM, so review them before you build.

Support

Db2 is a supported extension: we test each release with the Dockerfile and the package versions it pins, and we’ll help with problems in images built from it. You can add other packages to our images the same way, installing against /app/constraints.txt, but anything beyond Db2 is yours to support. Don’t extend the python-service image: its security model depends on its environment being exactly what we built.

Next Steps