Your image: add the database driver¶
From 1.1.5 HelixIAM ships no JDBC driver: not in the server image, not in a drivers image, not in the install bundles. You add the one driver of your database yourself, once per release:
- Kubernetes, Docker, any container platform: build your own image, the HelixIAM server image plus the driver,
from a short
Dockerfilethat comes with every release. Push it to your registry and run it instead of the plain server image. - The Linux server bundles (with Docker or without): put the driver jar in the bundle's
drivers/folder.
The server image itself is unchanged: it still carries no driver, and it still loads exactly one jar from
/opt/helix/drivers (DB_DRIVER_DIR).
The drivers of this release¶
One row per database the server accepts. Each release lists its own versions: the server refuses any other jar.
| Database | Dockerfile | Driver | SHA-256 |
|---|---|---|---|
| PostgreSQL | postgresql.Dockerfile |
pgjdbc 42.7.14, postgresql-42.7.14.jar |
73914527305a40cce504b0d3d90b23caf565136912d607ae8ae7c5895512332c |
| MySQL | mysql.Dockerfile |
MySQL Connector/J 9.7.0, mysql-connector-j-9.7.0.jar |
0353648eaa1c91e0f4020c959abf756bc866ffd583df22ae6b6f6e0cbd43eb44 |
Where each jar is on Maven Central (the same path on any Maven mirror):
| Database | URL |
|---|---|
| PostgreSQL | https://repo1.maven.org/maven2/org/postgresql/postgresql/42.7.14/postgresql-42.7.14.jar |
| MySQL | https://repo1.maven.org/maven2/com/mysql/mysql-connector-j/9.7.0/mysql-connector-j-9.7.0.jar |
MySQL Connector/J is licensed under the GPL: HelixIAM never redistributes it. Your build downloads it.
1. Why: one driver, pinned, checked twice¶
- Only the driver you use. Your image holds the driver of your database and nothing else, so its SBOM and its vulnerability scans name only code that runs.
- Pinned. The release's Dockerfile names the driver by version and SHA-256. Docker downloads it and refuses any other bytes: the build fails.
- Checked again at start-up. The server hashes the jar and loads it only when the SHA-256 is on its list of
tested drivers for
DB_VENDOR. It also refuses a writable jar or folder, a second jar, and anything that is not a jar (section 12). - Nothing is downloaded at run time. The driver is in the image before you deploy it, so a pod or container start needs no internet access.
This is the release's postgresql.Dockerfile, as it comes:
# syntax=docker/dockerfile:1
# Generated from helix-iam-server/src/main/resources/db/drivers/tested-drivers.yaml by e2e/drivers/dockerfiles.sh; do not edit.
# The HelixIAM server image plus the postgresql JDBC driver, pinned by version and SHA-256 (Docker refuses other bytes).
# Build: docker build -f postgresql.Dockerfile -t registry.example.com/helixiam:postgresql .
ARG HELIXIAM_IMAGE=registry.helixiam.com/helixiam/helix-iam-server:v1.1.5
ARG MAVEN_REPOSITORY=https://repo1.maven.org/maven2
FROM scratch AS driver
ARG MAVEN_REPOSITORY
ADD --checksum=sha256:73914527305a40cce504b0d3d90b23caf565136912d607ae8ae7c5895512332c --chmod=444 ${MAVEN_REPOSITORY}/org/postgresql/postgresql/42.7.14/postgresql-42.7.14.jar /
FROM ${HELIXIAM_IMAGE}
COPY --from=driver /postgresql-42.7.14.jar /opt/helix/drivers/postgresql-42.7.14.jar
# The server image's user; stated so the image runs unprivileged whatever the base sets.
USER 10001
- The first stage holds only the checked jar, read-only (
444). The second is the server image of this release (HELIXIAM_IMAGE) with that jar copied into/opt/helix/drivers. The folder is created owned by root with mode755, the jar keeps444: the server's user (10001) can read both and change neither. - No
RUN: nothing runs inside the server image while it is built.USER 10001is the server image's own user, stated so the image runs unprivileged whatever the base sets. - Two build arguments:
HELIXIAM_IMAGE(the server image; the default is the release the file belongs to) andMAVEN_REPOSITORY(the Maven repository the jar comes from; section 8).
Get the Dockerfile and check it¶
The Dockerfiles are release files, like the compose file and the bundles. Open https://download.helixiam.com, sign
in with your licence account, open the release's folder (v1.1.5/) and download the Dockerfile of your database and
its signature, for example postgresql.Dockerfile and postgresql.Dockerfile.sigstore.json. Check the signature
(needs cosign):
cosign verify-blob postgresql.Dockerfile --bundle postgresql.Dockerfile.sigstore.json \
--certificate-identity https://github.com/melmarzgioui/helixiam/.github/workflows/release.yml@refs/tags/v1.1.5 \
--certificate-oidc-issuer https://token.actions.githubusercontent.com
It prints Verified OK. Keep the file as it is: a changed file no longer matches its signature. Every build option
you need is a build argument.
2. Docker: build and push¶
Sign in to the HelixIAM registry (for the server image) and to your own registry (for the result), then build in the folder with the Dockerfile. Docker needs BuildKit, its default builder.
echo "$REGISTRY_TOKEN" | docker login registry.helixiam.com -u "$REGISTRY_USER" --password-stdin
docker build -f postgresql.Dockerfile -t registry.example.com/acme/helixiam:v1.1.5-postgresql .
docker push registry.example.com/acme/helixiam:v1.1.5-postgresql
For both platforms the server image is built for (linux/amd64 and linux/arm64) under one tag:
docker buildx build --platform linux/amd64,linux/arm64 -f postgresql.Dockerfile \
-t registry.example.com/acme/helixiam:v1.1.5-postgresql --push .
Check what is in the image:
docker run --rm --entrypoint ls registry.example.com/acme/helixiam:v1.1.5-postgresql -ln /opt/helix/drivers
The repository and the tag are yours to choose; v<release>-<database> keeps the release and the database in sight.
Give your image a repository of its own (here acme/helixiam), not one whose path ends in /helixiam/helix-iam-server:
the Helm install notes take that for the plain server image and warn that it has no driver. Docker keeps a
checked jar in its build cache by its SHA-256 and does not download it again for the next build.
3. Podman and Buildah¶
The same Dockerfile, the same build arguments. Tested with Podman 6.2 and Buildah 1.46.
Podman and Buildah check the SHA-256 the same way. Bytes that differ stop the build with
unexpected response digest for "<url>": sha256:<what was downloaded>, want sha256:<the pinned one>.
4. Helm values¶
Run your image instead of the plain server image: set image.repository and image.tag, and give the cluster a pull
secret for your registry.
# my-values.yaml (Helm)
image:
repository: registry.example.com/acme/helixiam
tag: v1.1.5-postgresql
imagePullSecrets:
- name: my-registry
helm upgrade --install helixiam oci://registry.helixiam.com/helixiam/charts/helixiam --version 1.1.5 \
-f my-values.yaml \
--set database.host=postgres.db.svc \
--set secrets.existingSecret=helixiam-secrets \
...
The install notes say where the driver comes from:
JDBC driver: postgresql, from your image (registry.example.com/acme/helixiam:v1.1.5-postgresql: the one jar in /opt/helix/drivers)
The migrations Job (config.migrationsEnabled=false) runs the same image, so it has the driver too.
Instead of your own image the chart can mount a volume that holds the jar and nothing else, read-only, over
/opt/helix/drivers: database.driver.volume (a persistentVolumeClaim, hostPath or csi source; not a
configMap or secret, whose symlinks the server refuses). The server checks that jar the same way.
helm upgrade --install helixiam oci://registry.helixiam.com/helixiam/charts/helixiam --version 1.1.5 \
--set database.driver.volume.persistentVolumeClaim.claimName=helixiam-driver \
...
With neither, the server does not start: it names helix.database.driver-dir (section 12).
The install notes warn whenever image.repository is the plain HelixIAM server image: a path ending in
/helixiam/helix-iam-server on any registry (the chart's default, registry.helixiam.com, a mirror of it).
database.driver.image (the drivers image of earlier releases) and database.driver.sizeLimit were removed in 1.1.5.
Values that still set database.driver.image fail the render instead of being ignored; see
section 11 for the upgrade from 1.1.4.
5. Docker Compose¶
The quick-start compose file of the release builds the image itself: its server service is the release's
server image plus the PostgreSQL driver, from the same Dockerfile, built by Compose on your machine. Start it with
--build:
echo "$REGISTRY_TOKEN" | docker login registry.helixiam.com -u "$REGISTRY_USER" --password-stdin
docker compose up -d --build
- It needs Docker Compose v2.20 or later with BuildKit (the default), and access to
repo1.maven.org. For a Maven mirror, putMAVEN_REPOSITORY=<mirror URL>in.envnext to the compose file; it is passed to the build only when set. HELIX_SERVER_IMAGEin.envis the base the driver is added to (the server image of the release by default).- Every
upbuilds (pull_policy: build); cached layers make that quick. -
This error means BuildKit is off (
DOCKER_BUILDKIT=0): unsetDOCKER_BUILDKITand use Compose v2.20 or later.
Your own compose file runs the image you built in section 2, or builds it from the release's Dockerfile next to it:
services:
server:
build:
context: .
dockerfile: postgresql.Dockerfile
image: helixiam-server:v1.1.5-postgresql
pull_policy: build
read_only: true
tmpfs:
- /tmp
# environment, ports, healthcheck: as in the release's compose file
6. Linux server and native bundle¶
Both bundles ship an empty drivers/ folder (mode 0555). Put exactly one jar in it: the driver of your database,
checked, read-only (0444). The server refuses a writable jar or folder.
After unpacking the bundle in /opt (see Install on one Linux server),
download the jar to a folder of your own, check it, then copy it into drivers/:
cd "$(mktemp -d)" &&
curl -fLO https://repo1.maven.org/maven2/org/postgresql/postgresql/42.7.14/postgresql-42.7.14.jar &&
echo "73914527305a40cce504b0d3d90b23caf565136912d607ae8ae7c5895512332c postgresql-42.7.14.jar" | sha256sum -c &&
sudo cp postgresql-42.7.14.jar /opt/helixiam/drivers/ &&
sudo chmod 0444 /opt/helixiam/drivers/postgresql-42.7.14.jar &&
sudo chmod 0555 /opt/helixiam/drivers &&
ls -l /opt/helixiam/drivers
sha256sum -c prints postgresql-42.7.14.jar: OK; on a mismatch it prints FAILED and the chain stops before
the copy. On macOS use shasum -a 256 -c. The compose file mounts the
folder read-only (./drivers:/opt/helix/drivers:ro). Unpacking a new bundle over the install keeps the jar.
Unpack helixiam-native.tar.gz, put the jar in its helixiam/drivers/, then run the installer. The folder comes
read-only (0555): as a user other than root, make it writable for yourself first.
tar -xzf helixiam-native.tar.gz &&
chmod u+w helixiam/drivers &&
curl -fL -o helixiam/drivers/postgresql-42.7.14.jar \
https://repo1.maven.org/maven2/org/postgresql/postgresql/42.7.14/postgresql-42.7.14.jar &&
echo "73914527305a40cce504b0d3d90b23caf565136912d607ae8ae7c5895512332c helixiam/drivers/postgresql-42.7.14.jar" | sha256sum -c &&
sudo ./helixiam/install.sh
A FAILED check stops the chain before the installer runs; delete the jar before you try again. install.sh
installs the jar in /opt/helixiam/drivers (root, 0444, in a 0555 folder) and replaces the one
installed before. Without a jar in the bundle an upgrade keeps the installed driver. A first install without one
stops before it changes anything:
helixiam: no JDBC driver: put the jar of your database's driver in <bundle>/drivers, then run ./helixiam/install.sh again (nothing was changed). See https://docs.helixiam.com/operations/database-driver/
More than one jar, or a file that is not a jar, also stops it before anything changes.
7. MySQL¶
The same steps with mysql.Dockerfile: your build downloads MySQL Connector/J from Maven Central (or your mirror),
and Docker checks its SHA-256.
docker build -f mysql.Dockerfile -t registry.example.com/acme/helixiam:v1.1.5-mysql .
docker push registry.example.com/acme/helixiam:v1.1.5-mysql
With Helm:
helm upgrade --install helixiam oci://registry.helixiam.com/helixiam/charts/helixiam --version 1.1.5 \
--set image.repository=registry.example.com/acme/helixiam --set image.tag=v1.1.5-mysql \
--set database.vendor=mysql --set database.port=3306 --set database.host=mysql.db.svc \
...
On a Linux server, put mysql-connector-j-9.7.0.jar in drivers/ as in section 6,
with its URL and SHA-256 from the table above, and set DB_VENDOR=mysql in .env. The
rest of MySQL's setup: MySQL database.
8. A Maven mirror¶
Point the download at your Maven repository with MAVEN_REPOSITORY. It must serve Maven Central's layout
(<repository>/org/postgresql/postgresql/42.7.14/postgresql-42.7.14.jar); a proxy of Maven Central does.
docker build -f postgresql.Dockerfile --build-arg MAVEN_REPOSITORY=https://maven.example.com/maven2 \
-t registry.example.com/acme/helixiam:v1.1.5-postgresql .
The SHA-256 is checked whatever the source. A mirror that serves other bytes fails the build:
ERROR: failed to build: failed to solve: digest mismatch sha256:6e0e4cc2d8cae902084f8a2b18728b073a6fd9d1f87c9d8bff8f298c18185b93: sha256:73914527305a40cce504b0d3d90b23caf565136912d607ae8ae7c5895512332c
- The server image from your registry:
--build-arg HELIXIAM_IMAGE=registry.example.internal/helixiam/helix-iam-server:v1.1.5. - No access to Docker Hub: the first line (
# syntax=docker/dockerfile:1) makes BuildKit fetch Docker's Dockerfile frontend from Docker Hub. Name your mirror of it with--build-arg BUILDKIT_SYNTAX=registry.example.internal/docker/dockerfile:1. - A mirror that needs a password: the URL takes none. Build arguments can end up in the image's build provenance,
so never put a password in
MAVEN_REPOSITORY. Download the jar with your credentials and build the air-gapped way below.
9. Air-gapped¶
Without any network access during the build: download the jar where you can, check it, carry it over, and COPY it.
--checksum exists for downloads only, so here the check is yours (sha256sum -c), and the server checks the jar again
at start-up.
On a machine with access:
curl -fLO https://repo1.maven.org/maven2/org/postgresql/postgresql/42.7.14/postgresql-42.7.14.jar
echo "73914527305a40cce504b0d3d90b23caf565136912d607ae8ae7c5895512332c postgresql-42.7.14.jar" | sha256sum -c
On the build machine, next to the jar, postgresql-airgapped.Dockerfile:
# The HelixIAM server image plus a PostgreSQL driver jar you downloaded and checked: no network during the build.
ARG HELIXIAM_IMAGE=registry.example.internal/helixiam/helix-iam-server:v1.1.5
FROM scratch AS driver
COPY --chmod=444 postgresql-42.7.14.jar /
FROM ${HELIXIAM_IMAGE}
COPY --from=driver /postgresql-42.7.14.jar /opt/helix/drivers/postgresql-42.7.14.jar
# The server image's user; stated so the image runs unprivileged whatever the base sets.
USER 10001
docker build --network=none -f postgresql-airgapped.Dockerfile \
-t registry.example.internal/acme/helixiam:v1.1.5-postgresql .
- It has no
# syntaxline, so nothing is fetched for the Dockerfile itself: Docker's built-in frontend knowsCOPY --chmod. - Keep the two stages.
COPY --chmod=444straight into/opt/helix/drivers/also makes the new folder444; the server cannot open it and refuses the jar asis not a regular .jar file. - The server image comes from your registry: load it there from the release like the other images.
10. CI pipeline¶
A GitHub Actions workflow that checks the server image's signature, builds your image on it for both platforms, pushes
it and signs it with cosign (keyless, with the workflow's identity). Commit the release's checked Dockerfile as
helixiam/postgresql.Dockerfile in your repository; the secrets hold your HelixIAM registry account and your own
registry's credentials.
# .github/workflows/helixiam-image.yml
name: HelixIAM image
on:
workflow_dispatch:
push:
paths: [helixiam/postgresql.Dockerfile]
permissions:
contents: read
id-token: write # keyless cosign signing
env:
RELEASE: v1.1.5
IMAGE: registry.example.com/acme/helixiam
jobs:
image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0
- uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
- uses: sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 # v4.1.2
- name: Sign in to both registries
env:
HELIXIAM_USER: ${{ secrets.HELIXIAM_REGISTRY_USER }}
HELIXIAM_TOKEN: ${{ secrets.HELIXIAM_REGISTRY_TOKEN }}
OWN_USER: ${{ secrets.REGISTRY_USER }}
OWN_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
run: |
echo "$HELIXIAM_TOKEN" | docker login registry.helixiam.com -u "$HELIXIAM_USER" --password-stdin
echo "$OWN_TOKEN" | docker login registry.example.com -u "$OWN_USER" --password-stdin
- name: Check the server image's signature and pin it by digest
run: |
base=registry.helixiam.com/helixiam/helix-iam-server
digest=$(cosign verify "$base:$RELEASE" \
--certificate-identity "https://github.com/melmarzgioui/helixiam/.github/workflows/release.yml@refs/tags/$RELEASE" \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
| jq -r '.[0].critical.image."docker-manifest-digest"')
echo "BASE=$base@$digest" >> "$GITHUB_ENV"
- name: Build and push (linux/amd64 and linux/arm64)
run: |
docker buildx build --platform linux/amd64,linux/arm64 -f helixiam/postgresql.Dockerfile \
--build-arg "HELIXIAM_IMAGE=$BASE" --metadata-file metadata.json \
-t "$IMAGE:$RELEASE-postgresql" --push helixiam
echo "DIGEST=$(jq -r '."containerimage.digest"' metadata.json)" >> "$GITHUB_ENV"
- name: Sign the image
run: cosign sign --yes --recursive "$IMAGE@$DIGEST"
The build uses the server image by the digest whose signature was checked, so a tag that moves in between cannot
change what is built. Deploy $IMAGE@$DIGEST, or the tag, and verify it with cosign verify and your workflow's
identity.
11. Each HelixIAM upgrade¶
Your image is tied to one release. For each new release:
- Download the new release's Dockerfile and its signature, and check it (above).
Its
HELIXIAM_IMAGEis the new release, and its driver is the one that release was tested with. -
Build and push the new image:
-
Upgrade with the new chart and the new tag:
Use the new release's Dockerfile, not the old one with a new HELIXIAM_IMAGE: when a release moves to another driver
version, the new server refuses the old jar (section 12, "not a tested driver"). On the
Linux server, replace the jar in drivers/ when the table at the top of this page changes.
From 1.1.4 (the drivers image)¶
Up to 1.1.4 the chart copied the driver from the helix-database-drivers image. 1.1.5 refuses those values:
helixiam: database.driver.image was removed in 1.1.5: build your own image with the driver (https://docs.helixiam.com/operations/database-driver/) or set database.driver.volume; remove database.driver.image from your values (helm upgrade: --reset-then-reuse-values --set database.driver.image=null)
Build and push your image (section 2), then upgrade with Helm 3.14 or later.
database.driver.image=null drops any drivers image setting from the values --reset-then-reuse-values keeps
(the 1.1.4 quick start set its repository); it is harmless when you never set one:
helm upgrade helixiam oci://registry.helixiam.com/helixiam/charts/helixiam --version 1.1.5 \
--reset-then-reuse-values --set database.driver.image=null \
--set image.repository=registry.example.com/acme/helixiam --set image.tag=v1.1.5-postgresql
An install with database.driver.volume keeps its volume and needs only --set database.driver.image=null.
Replace docker-compose.yml with the 1.1.5 file. The 1.1.4 quick start put the image lines in .env, and they
win over the file's own version: set both to 1.1.5 (or remove them), and drop the drivers image line. Otherwise the
server stays on 1.1.4.
sed -i.bak -e 's#^\(HELIX_SERVER_IMAGE=.*\):v1\.1\.4$#\1:v1.1.5#' \
-e 's#^\(HELIX_CONSOLE_IMAGE=.*\):v1\.1\.4$#\1:v1.1.5#' -e '/_DRIVERS_IMAGE=/d' .env
grep IMAGE .env
docker compose up -d --build
grep shows the two image lines with :v1.1.5 and no drivers line.
The drivers volume of the old file is no longer used; docker volume ls shows it, and you may remove it.
Nothing to do: the jar of 1.1.4 (drivers/postgresql.jar, pgjdbc 42.7.14) is the tested one of 1.1.5. Unpacking
the new bundle over the install, or running the new install.sh, keeps it.
12. What the server says¶
Every refusal stops the server at start-up, before it opens a database connection. The log names the setting and the file; find the line with:
| Situation | The server says | Fix |
|---|---|---|
| No driver folder: the plain server image, no volume | JDBC driver helix.database.driver-dir does not exist or is not a directory |
Run your own image, or mount a volume. |
| The folder is empty | JDBC driver helix.database.driver-dir holds no driver jar |
Put the jar in it. |
| Two jars | JDBC driver helix.database.driver-dir holds 2 jars (postgresql-42.7.13.jar, postgresql-42.7.14.jar); keep one or pin one with helix.database.driver.file and .sha256 |
Keep exactly one. |
| Something else in the folder | JDBC driver 'README.txt' is not a regular .jar file; the driver directory holds driver jars only |
Remove it; only the jar goes there. The same message for a jar in a folder without x permission (444; see section 9). |
| The jar is writable by the server | JDBC driver 'postgresql-42.7.14.jar' is writable by the server process; driver jars must be read-only |
chmod 0444 the jar, owned by root. |
| The folder is writable by the server | JDBC driver directory (helix.database.driver-dir) is writable by the server process; mount it read-only |
chmod 0555 the folder, owned by root, or mount it read-only. As root the message says the server runs as root, which permissions do not stop: run as another user. |
| A jar that is not on the tested list | JDBC driver 'postgresql-42.7.13.jar' (SHA-256 6e0e4cc2d8cae902084f8a2b18728b073a6fd9d1f87c9d8bff8f298c18185b93) is not a tested postgresql driver; use a tested jar or set helix.database.driver.allow-untested=true (unsupported) |
Use the jar of the table above. |
The driver of another database (here MySQL's with DB_VENDOR=postgresql) |
JDBC driver 'mysql-connector-j-9.7.0.jar' (SHA-256 0353648eaa1c91e0f4020c959abf756bc866ffd583df22ae6b6f6e0cbd43eb44) is not a tested postgresql driver; use a tested jar or set helix.database.driver.allow-untested=true (unsupported) |
Build with the Dockerfile of your database, or correct DB_VENDOR. |
An image built from the release's Dockerfile always has the jar owned by root with mode 444. On a read-only root
file system (the chart's default) the kernel refuses every write, so the server cannot see a jar as writable there
whatever its mode: the "writable" refusals come only from a writable file system or mount.
A driver that loads shows in the database health group, on the management port:
Its jdbcDriver component names the file, the version, the SHA-256 and "driver.tested":true. See
PostgreSQL database.