> For the complete documentation index, see [llms.txt](https://docs.visdom.virtuslab.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.visdom.virtuslab.com/visdom-tracing/operations/deployment.md). Agents can also search and read this documentation through its [MCP server](https://docs.visdom.virtuslab.com/~gitbook/mcp).

# Deployment

The two containers, the database, what must be set before the first start, health checks, and what runs in the background.

AI Tracing is two containers and a PostgreSQL database:

| Container | Built from                                                                                  | Listens on | What it is                                                                                                 |
| --------- | ------------------------------------------------------------------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------- |
| Server    | `Dockerfile` at the repository root (Rust; runtime `debian:trixie-slim` with `git`)         | 3000       | The API, the LLM proxy, ingest, signing, the background jobs, and the git clones of your repositories      |
| Web app   | `crates/tracevault-server/web/Dockerfile`, built with the repository root as context (Node) | 4000       | The web app. It serves the pages and forwards `/api/*` to the server, so the browser talks to one address. |

The database is PostgreSQL 16. The `pgvector` extension is optional: with it, [Chat](https://docs.visdom.virtuslab.com/visdom-tracing/web-app/chat.md) can search sessions; without it, everything else works and Chat has nothing to search.

## Before the first start

The server refuses to start, with a message, when one of these is missing or wrong:

| Setting                                                                                        | Why                                                                                                                                                           |
| ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `CORS_ORIGIN`                                                                                  | The web app's public address (comma-separated if several). Required; a malformed entry stops the server.                                                      |
| `AI_TRACING_SIGNING_SEED`                                                                      | Required, as base64 of 32 bytes, when `AI_TRACING_SIGNING_ENABLED=true`.                                                                                      |
| `AI_TRACING_OIDC_ISSUER_URL`                                                                   | Required, as a valid URL, when `AI_TRACING_OIDC_AUDIENCE` is set (Keycloak on).                                                                               |
| `AI_TRACING_CONTROL_PLANE_API_URL`, `AI_TRACING_M2M_CLIENT_ID`, `AI_TRACING_M2M_CLIENT_SECRET` | All three or none; all three when Keycloak is on.                                                                                                             |
| `AI_TRACING_GITHUB_APP_ID`, `AI_TRACING_GITHUB_APP_PRIVATE_KEY`                                | Both or neither; the key must be a valid PEM.                                                                                                                 |
| Enumerated values                                                                              | `AI_TRACING_COMPLIANCE_MODE`, `AI_TRACING_USAGE_SOURCE`, the `AI_TRACING_PROXY_*` policies and `AI_TRACING_CP_PROJECTS_ONLY` accept only their listed values. |

Set as well, although the server starts without them:

* `AI_TRACING_ENCRYPTION_KEY` (base64 of 32 bytes; `openssl rand -base64 32`). It encrypts upstream LLM keys, the Control Plane client secret, deploy keys and webhook secrets. Without it the server logs a warning at every start, the proxy and secret detection refuse to store keys, and the LLM settings are stored in plain text.
* A persistent volume for the git clones at `/data/repos` (the image sets the path).

Every variable is in the [Configuration reference](https://docs.visdom.virtuslab.com/visdom-tracing/operations/configuration-reference.md).

## Evaluate with Docker Compose

`docker-compose.yml` at the repository root runs PostgreSQL 16, the server on port 3000 and the web app on port 5173, built from source:

```bash
export TRACEVAULT_ENCRYPTION_KEY=$(openssl rand -base64 32)
docker compose up -d --build
```

It has no Keycloak, so the server runs with API keys only and the web app's sign-in page reports that single sign-on is unavailable. Add Keycloak and the variables above for the web app; see [Sign-in and permissions](https://docs.visdom.virtuslab.com/visdom-tracing/visdom-platform/sign-in-and-permissions.md).

## On Kubernetes

The repository has no Helm chart; run the two images as two Deployments with Services:

* **Server.** Configuration from a ConfigMap and a Secret (database URL, encryption key, signing seed, client secrets, LLM keys). A PersistentVolumeClaim at `/data/repos`. Readiness `GET /ready`, liveness `GET /health`.
* **Web app.** `API_URL` pointing at the server's Service, `WEB_ORIGIN` set to its public address, the `PUBLIC_*` addresses below. Readiness and liveness `GET /health`.
* **Ingress.** The web app's host serves the browser. The LLM proxy (`/proxy/*`), the ingest endpoints and the CLI reach the server's API; either expose the server under its own host, or route those paths to it. The web app shows the proxy address as `<web app address>/proxy/…` (**Profile › LLM Proxy**), so on a shared host route `/api`, `/proxy`, `/health`, `/api-docs` and `/swagger-ui` to the server and everything else to the web app; otherwise `/proxy` reaches the web app and answers 404.

Migrations run when the server starts, before it serves; they only go forward. Take a database backup before an upgrade. A failed migration makes the pod restart until it is fixed. When a release notes a migration that is not backward compatible, roll the server with the `Recreate` strategy so that old and new versions never serve at once.

On SIGTERM the server stops accepting connections and drains for up to 20 seconds, then flushes its telemetry.

The repository ships the two Dockerfiles and Compose files for evaluation; it has no Helm chart or Kubernetes manifests, so a cluster installation brings its own.

## Web app

The web app reads its settings at runtime; nothing is built into the image.

| Variable                                                                                          | Default                                        | What it does                                                                                                                                                                     |
| ------------------------------------------------------------------------------------------------- | ---------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `API_URL`                                                                                         | `http://localhost:3000`                        | Where the web app reaches the server.                                                                                                                                            |
| `WEB_ORIGIN`                                                                                      | –                                              | The web app's public address (`https://tracing.example.com`). Set it behind a proxy or ingress. The other adapter settings take the same `WEB_` prefix (`WEB_PORT`, `WEB_HOST`). |
| `PUBLIC_CONTROL_PLANE_URL`                                                                        | derived from the web app's host, else Visdom's | Control Plane's address: the Home entry and the settings gear in the module rail, and the calls for the project switcher, theme and time zone.                                   |
| `PUBLIC_SUITE_ORCHESTRATOR_URL`, `PUBLIC_SUITE_CONTEXT_FABRIC_URL`, `PUBLIC_SUITE_AI_GATEWAY_URL` | derived from the web app's host                | The other modules in the rail. Set one empty to hide that entry.                                                                                                                 |
| `PUBLIC_DATE_LOCALE`                                                                              | `en-US`                                        | How dates are written.                                                                                                                                                           |

Keycloak needs a public client `visdom-ai-tracing` with the redirect URI `{web app}/auth/callback`; see [Sign-in and permissions](https://docs.visdom.virtuslab.com/visdom-tracing/visdom-platform/sign-in-and-permissions.md#sign-in-clients).

{% hint style="warning" %}
Serve the web app over **HTTPS** (or on `localhost`). Signing in uses PKCE, which needs the browser's Web Crypto API, and browsers offer it only on secure origins: on plain HTTP under any other host name, **Sign in with Visdom** stops with *Crypto.subtle is available only in secure contexts (HTTPS)*.
{% endhint %}

## Health

| Endpoint      | Container | Answers                                      |
| ------------- | --------- | -------------------------------------------- |
| `GET /health` | Server    | `ok` while the process runs                  |
| `GET /ready`  | Server    | 200 when the database answers, 503 otherwise |
| `GET /health` | Web app   | The server's `/health`, through the web app  |

## What runs in the background

| Job                                                  | When                                                                                                                                   |
| ---------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| Price list sync from LiteLLM                         | At start and every 24 hours ([Pricing](https://docs.visdom.virtuslab.com/visdom-tracing/operations/pricing.md))                        |
| Daily session statistics refresh                     | Every 5 minutes                                                                                                                        |
| Sealing sessions idle for 30 minutes                 | Every 5 minutes                                                                                                                        |
| Retrying failed repository clones                    | Every 5 minutes                                                                                                                        |
| Fetching repositories                                | At start                                                                                                                               |
| Interpreting AI Gateway records                      | Every 2 seconds, with gateway ingest on ([AI Gateway](https://docs.visdom.virtuslab.com/visdom-tracing/visdom-platform/ai-gateway.md)) |
| Deleting AI Gateway content older than the retention | Every hour, with gateway ingest on                                                                                                     |
| Cleaning up expired sign-in requests                 | Every hour                                                                                                                             |

The Control Plane sync and the AI Gateway worker coordinate through the database, so several replicas can run them. The other jobs take no lock, so run the server as one replica unless you have checked them on several.

## Releases

Every merge to `main` produces a release `v<version>` of the server with an image of the same tag. Pin the server and the web app to the same release. CI publishes both images to Visdom's registry as `visdom-ai-tracing-backend` and `visdom-ai-tracing-frontend`, each tagged with the commit and with `v<version>`.
