Docker Compose
deploy/docker-compose.yml runs Postgres and the coordinator on one machine. It is written for local development and evaluation. This page explains what it runs, which settings to change before anyone else can reach it, and how to put TLS in front of it.
What it runs
Section titled “What it runs”The Compose project is named zentri. It has four services:
| Service | Image | What it does |
|---|---|---|
postgres |
pgvector/pgvector:pg16 |
The database. It creates the vector and pg_trgm extensions and the coordinator role the first time its volume is made. |
migrate |
zentri-server:dev, built from server/Dockerfile |
Runs zentri-server migrate up as the database owner once, then exits. |
server |
The same image | Runs zentri-server serve --no-migrate as zentri_coordinator. |
ollama |
ollama/ollama:0.40.19 |
Optional local models. Starts only with --profile ollama. |
They start in this order:
postgres (healthy) -> migrate (exits 0) -> serverThe migrate and server containers run as the image’s nonroot user, with a read-only root file system, every Linux capability dropped, and no-new-privileges. See Security hardening.
Every port is published on 127.0.0.1 only, so nothing outside the machine can reach it.
| Variable | Default | Service |
|---|---|---|
ZENTRI_PORT |
8080 | server |
POSTGRES_PORT |
5432 | postgres |
OLLAMA_PORT |
11434 | ollama |
Volumes
Section titled “Volumes”| Volume | Mounted at | Holds |
|---|---|---|
postgres-data |
/var/lib/postgresql/data |
Every row Zentri stores. |
ollama-data |
/root/.ollama |
Pulled models. |
deploy/postgres/init is mounted read-only at /docker-entrypoint-initdb.d. Postgres runs those scripts only when postgres-data is empty.
Set it up
Section titled “Set it up”You need Docker with Compose v2 and a checkout of the repository. Run every command from the repository root.
-
Copy the example settings.
deploy/.envis git-ignored.Terminal window cp deploy/.env.example deploy/.env -
Open
deploy/.envand replace both passwords. This makes a random one:Terminal window openssl rand -hex 24Variable Used for POSTGRES_PASSWORDThe owner role. migrateconnects with it.ZENTRI_APP_DB_PASSWORDzentri_coordinator.serverconnects with it.Postgres reads both only when it first creates
postgres-data. To change one later, change it in Postgres withALTER ROLEtoo. -
Set the other variables you need. Each one in
deploy/.env.examplehas a comment. The table below lists them. See the environment reference for the full list.
Settings in deploy/.env
Section titled “Settings in deploy/.env”| Variable | Default | What it does |
|---|---|---|
POSTGRES_USER, POSTGRES_DB |
zentri |
The owner role and the database name. |
OTEL_EXPORTER_OTLP_ENDPOINT |
Empty, tracing off | An OTLP/HTTP endpoint for traces. See Observability. |
ZENTRI_EMBEDDER |
hash |
hash (offline), ollama, or openai. |
ZENTRI_EMBED_BASE_URL, ZENTRI_EMBED_MODEL |
Empty | Where the embedder runs and which model. |
ZENTRI_LLM_BASE_URL, ZENTRI_LLM_MODEL |
Empty, no LLM | An OpenAI-compatible URL ending in /v1. Every task prompt is sent to it. |
ZENTRI_LLM_STEPS |
judge |
Any of judge, extract and phrase, comma separated. |
ZENTRI_LLM_RESPONSE_FORMAT |
json_schema |
Or json_object. |
ZENTRI_LLM_REASONING_EFFORT |
Empty | Sent as reasoning_effort. none turns off a thinking model’s reasoning. |
ZENTRI_MODEL_TIMEOUT |
5s |
The limit for each model call. |
ZENTRI_EMBED_API_KEY_FILE, ZENTRI_LLM_API_KEY_FILE |
Empty | Paths inside the container to files that hold API keys. |
ZENTRI_DATA_KEY_FILE |
Empty | Path inside the container to the key that encrypts raw prompts. The LLM judge runs only with it. |
ZENTRI_SLACK_RETRY_BASE |
10s |
The first retry delay of a Slack delivery. It doubles up to 15m. |
ZENTRI_IMAGE |
zentri-server:dev |
The tag of the image Compose builds. |
ZENTRI_VERSION, ZENTRI_COMMIT, ZENTRI_DATE |
dev, none, unknown |
Build details stamped into the binary. |
Secret files
Section titled “Secret files”API keys, the data key and the bootstrap token are read from files, never from variables. Keep the files outside the repository and mount each one read-only with a second Compose file. Compose does not pass ZENTRI_BOOTSTRAP_ADMIN_TOKEN_FILE to the server, so the second file adds it.
# deploy/compose.secrets.yml. It holds paths, not secrets.services: server: environment: ZENTRI_DATA_KEY_FILE: /run/secrets/zentri-data-key ZENTRI_BOOTSTRAP_ADMIN_TOKEN_FILE: /run/secrets/zentri-admin-token volumes: - /etc/zentri/data-key:/run/secrets/zentri-data-key:ro - /etc/zentri/admin-token:/run/secrets/zentri-admin-token:roMake the data key with:
openssl rand -hex 32 > /etc/zentri/data-keyThe server runs as the image’s nonroot user, so that user must be able to read each file. On Linux, give the files to user ID 65532 with mode 0400.
When you use a second file, name both files on every command. With -f, Compose loads only the files you name.
docker compose -f deploy/docker-compose.yml \ -f deploy/compose.secrets.yml up --build -dFirst start
Section titled “First start”docker compose -f deploy/docker-compose.yml up --build -dmake dev runs the same stack in the foreground.
On its first start, the coordinator creates an org named default, a user named admin, and an admin token. Unless you set ZENTRI_BOOTSTRAP_ADMIN_TOKEN_FILE, it generates the token and prints it once to standard output:
docker compose -f deploy/docker-compose.yml logs serverZentri bootstrap admin token (shown once, store it now):zt_a_...Store the token in a password manager. The coordinator keeps only its hash and never prints it again. It prints a token only on the start that creates the admin user. Later starts skip the step.
The bootstrap token has every scope and no expiry. See Security hardening for how to replace it.
Check that it runs
Section titled “Check that it runs”The postgres service has a health check, so docker compose ps shows it as healthy. The server image has no shell, so the server service has no Docker health check. Probe it from the host:
curl -fsS http://127.0.0.1:8080/healthzcurl -fsS http://127.0.0.1:8080/readyz{"status":"ok"}{"status":"ready"}/healthz answers while the process runs. /readyz also pings Postgres, and answers 503 with {"status":"unavailable","reason":"database unreachable"} when it cannot reach it. See Observability.
The server logs one line when it is ready to take requests:
{"time":"...","level":"INFO","msg":"listening","addr":":8080","version":"dev","tracing":false,"embedding_model":"hash-v1","llm":false}The values differ with your settings.
Put TLS in front
Section titled “Put TLS in front”The coordinator serves plain HTTP. zt accepts plain HTTP only for a loopback host, so engineers on other machines need HTTPS. Pick one:
- Tailscale. Serve the coordinator on your tailnet with HTTPS. Nothing is exposed to the internet. See Tailscale.
- A reverse proxy on the same machine. The coordinator’s port is on
127.0.0.1, so the proxy can reach it and nothing else can.
This Caddyfile is a starting point. Zentri’s tests do not cover a proxy.
zentri.example.com { reverse_proxy 127.0.0.1:8080}/metrics needs a token whenever the coordinator listens on more than loopback. In Compose it listens on :8080 inside the container, so /metrics always needs one. See Observability.
Local models with Ollama
Section titled “Local models with Ollama”The ollama profile runs Ollama next to the coordinator. ADR-0006 measured this setup on a 16 GB laptop with no GPU.
-
Start the profile:
Terminal window docker compose -f deploy/docker-compose.yml --profile ollama up -d -
Pull the models once:
Terminal window docker compose -f deploy/docker-compose.yml exec ollama \ollama pull embeddinggemma:300mdocker compose -f deploy/docker-compose.yml exec ollama \ollama pull qwen3:4b-instruct -
Set these in
deploy/.env, mount the data key as shown in Secret files, and start again:Terminal window ZENTRI_EMBEDDER=ollamaZENTRI_EMBED_BASE_URL=http://ollama:11434ZENTRI_EMBED_MODEL=embeddinggemma:300mZENTRI_LLM_BASE_URL=http://ollama:11434/v1ZENTRI_LLM_MODEL=qwen3:4b-instructZENTRI_DATA_KEY_FILE=/run/secrets/zentri-data-key -
Embed the intents stored with the old model:
Terminal window docker compose -f deploy/docker-compose.yml \run --rm --no-deps server intents reembed --allIf you use a second Compose file, name it here too, so the command gets the same settings as the server.
The service keeps both models loaded (OLLAMA_KEEP_ALIVE=-1), because a cold judge load takes longer than the 5 s model timeout. It also runs each model on 4 threads. A model runner otherwise starts one thread per CPU it sees, and on a laptop with efficiency cores those slow cores hold up every step. Set OLLAMA_THREADS in deploy/.env to your number of performance cores. ADR-0006 has the measurements.
See Calibrating dedup and Intents and dedup.
Stop and remove
Section titled “Stop and remove”down stops the containers and keeps the volumes:
docker compose -f deploy/docker-compose.yml downdocker compose -f deploy/docker-compose.yml down -vA volume made before milestone M1 has no zentri_coordinator role, because Postgres creates it only when the volume is first made. Such a volume needs down -v once.
Kubernetes and other installs
Section titled “Kubernetes and other installs”deploy/helm/zentriis a Helm chart that runs the same steps on Kubernetes. See Kubernetes.deploy/installholds the shell and PowerShell installers for thezentriCLI. They work once a release is published. See Release process.- No coordinator image is published yet. Compose builds it from source.
Limitations
Section titled “Limitations”- The Compose file is written for one machine and for development. It has no TLS, no backups and no server health check.
- Compose passes neither
ZENTRI_BOOTSTRAP_ADMIN_TOKEN_FILEnorZENTRI_MIGRATE_DATABASE_URL. Use a second Compose file for the first. - The database URLs use
sslmode=disable, because Postgres runs on the same Docker network.