Skip to content

Docker

Docker Hub

Pre-built multi-platform images (linux/amd64, linux/arm64) are available on Docker Hub:

# API-only (REST API on :8080)
docker pull ralforion/orionbelt-semantic-layer-api
docker run -p 8080:8080 ralforion/orionbelt-semantic-layer-api

# API + Arrow Flight SQL (REST on :8080, Flight on :8815)
docker pull ralforion/orionbelt-semantic-layer-flight
docker run -p 8080:8080 -p 8815:8815 --env-file .env ralforion/orionbelt-semantic-layer-flight

# UI (Gradio on :7860, connects to API)
docker pull ralforion/orionbelt-semantic-layer-ui
docker run -p 7860:7860 \
  -e API_BASE_URL=http://host.docker.internal:8080 \
  ralforion/orionbelt-semantic-layer-ui

See Drivers & Flight SQL for Flight SQL configuration and BI tool setup (DBeaver, Tableau, Power BI).

The .env passed with --env-file carries the database credentials. The API image carries the DuckDB driver only; the Flight image carries all eight (docker build --build-arg OB_EXTRA=flight . builds an API image with them). To serve several databases from one container, two of one dialect included, declare them as named data sources (OBSL_DATABASES); the same page shows how to pass them, and their secrets, on Cloud Run.

Docker Compose

The repository's deploy/compose/ directory holds a Compose setup: OBSL alone (compose.yml), and on request a local lake for development, an S3 endpoint with an Apache Iceberg REST catalog (COMPOSE_PROFILES=lake).

cd deploy/compose
cp .env.example .env            # which files and profile, images, ports
cp obsl.env.example obsl.env    # OBSL's settings: models and data sources
mkdir -p models data            # mounted at /models and /data
docker compose up -d --wait
  • The image. OBSL is built from the checkout; OBSL_IMAGE in .env runs a published image instead.
  • Models. As shipped, OBSL starts with the example model built into its image, which compiles queries but has no data to run them. Put your models in models/, and name them in obsl.env (MODEL_DIR=/models, MODEL_FILES).
  • The local lake. The example obsl.env has a block, commented out, for a DuckDB source that reads the lake's files and Iceberg tables in process (Files and Lakehouse Tables). Uncomment it with the profile: without the profile there is no catalog to attach.
  • Federation's spill files go to a volume at /app/spill (below).
  • DuckDB workers. compose.pool.yml adds DuckDB servers beside OBSL, for the DuckDB sources set to run on them (DuckDB Workers). The -flight image carries their driver.

The directory's README has every file and setting.

Spilling federated queries to disk

A query across data sources spills its large legs to disk instead of holding them in memory. Unless FEDERATION_SPILL_DIR names a directory, they go to the temp directory, /tmp in the images, which in a container is its writable layer. Give it a volume instead:

docker volume create obsl-spill
docker run -p 8080:8080 --env-file .env \
  -v obsl-spill:/app/spill \
  -e FEDERATION_SPILL_DIR=/app/spill \
  ralforion/orionbelt-semantic-layer-flight
# docker compose
services:
  api:
    image: ralforion/orionbelt-semantic-layer-flight
    env_file: .env
    environment:
      FEDERATION_SPILL_DIR: /app/spill
    volumes:
      - obsl-spill:/app/spill
volumes:
  obsl-spill:
Question Answer
Which path? /app/spill. The API and Flight images create it owned by their non-root app user, and Docker gives a new, empty named volume the owner of the directory it is first mounted on, so the server can write to it. A volume created earlier keeps the owner it has. A volume mounted on a path the image does not have starts out owned by root, and every federated query is then refused, naming FEDERATION_SPILL_DIR
A host directory instead? It keeps the host's owner. Make it writable for the image's app user, whose id docker run --rm --entrypoint id <image> app prints, e.g. sudo chown <uid> /srv/obsl-spill, then mount it with -v /srv/obsl-spill:/app/spill
Without a volume? The files go to /tmp in the container's writable layer: on the host's disk, but through the overlay filesystem (slower), and counted against the container rather than a volume you can size and watch. FEDERATION_SPILL_DIR=off keeps every leg in memory instead
--tmpfs? No. A tmpfs is memory, so a spilled leg takes the memory it was meant to free. A /tmp on a tmpfs is recognised and nothing spills there by default, and neither on Cloud Run, whose filesystem is in memory; a FEDERATION_SPILL_DIR given is used as given
How large? Each query's legs spill at most FEDERATION_SPILL_MAX_MB, all queries' legs together at most FEDERATION_SPILL_BUDGET_MB, and each query's DuckDB combine step at most FEDERATION_SPILL_MAX_MB more. The most the directory holds is FEDERATION_SPILL_BUDGET_MB + FEDERATION_MAX_CONCURRENT × FEDERATION_SPILL_MAX_MB: 16384 + 4 × 4096 MB = 32 GB with the defaults. Docker does not cap a named volume's size; it takes from the disk Docker stores volumes on, so that disk needs this much free, or lower the limits to fit it (a 10 GB disk: FEDERATION_SPILL_BUDGET_MB=4096, FEDERATION_SPILL_MAX_MB=1024, which with 4 queries at once takes 8 GB at most)
Docker Desktop? Volumes live on the Desktop VM's virtual disk, shared with every image, container and build cache (Settings > Resources > Virtual disk limit). docker system df shows what takes it, and df -h /app/spill inside the container what is left
When the disk fills? A query that cannot create its directory, or runs out of space while writing a leg, is refused with HTTP 503 naming FEDERATION_SPILL_DIR and the operating system's reason (FEDERATION_SPILL_FULL), not reported as a database failure. Set the limits below what the disk holds, so the budget refuses a query before the disk does
Kubernetes? An emptyDir volume without medium: Memory, with sizeLimit at least the size above: the kubelet evicts a pod that writes past it
Cleaning up? Each query removes its own files when it ends, failed or not, so the volume holds only what the queries running now spilled. Restarting the container mid-query can leave a query's obsl-federation-* directory behind; any of them is safe to delete while the server is stopped

Build from Source

Two separate images — API-only (fast) and UI (with Gradio):

# API image (no Gradio, fast cold starts)
docker build -t orionbelt-semantic-layer-api .
docker run -p 8080:8080 orionbelt-semantic-layer-api

# UI image (Gradio, connects to API)
docker build -f Dockerfile.ui -t orionbelt-semantic-layer-ui .
docker run -p 7860:7860 \
  -e API_BASE_URL=http://host.docker.internal:8080 \
  orionbelt-semantic-layer-ui

The API is available at http://localhost:8080. The UI is at http://localhost:7860. Sessions are ephemeral (in-memory, lost on container restart).

Integration Tests

# Build image and run 15 endpoint tests
./tests/docker/test_docker.sh

# Skip build (use existing image)
./tests/docker/test_docker.sh --no-build

# Run 37 tests against a live deployment (the demo serves one model of its own,
# so the suite checks that uploads and removals are refused and queries that model)
./tests/cloudrun/test_cloudrun.sh https://orionbelt.ralforion.com

Cloud Run Deployment

OrionBelt deploys as two separate Cloud Run services behind a shared load balancer:

Load Balancer (single IP)
  ├── /ui/*     → orionbelt-ui   (Gradio)
  └── /*        → orionbelt-api  (FastAPI)

The API image (Dockerfile) excludes Gradio for faster cold starts (~2-3s vs ~12s), while the UI image (Dockerfile.ui) connects to the API via API_BASE_URL. When the UI starts while a scaled-down API is still starting, it waits up to two minutes for the API; a page opened while the API did not answer asks it again each time the page loads. Cloud Armor provides WAF protection.