> 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-control-plane/operations/deployment.md). Agents can also search and read this documentation through its [MCP server](https://docs.visdom.virtuslab.com/~gitbook/mcp).

# Deployment

Running the Control Plane: the container, PostgreSQL, Keycloak, health checks, replicas, and what it talks to.

The Control Plane is one container: a Rust service with the web UI embedded. It stores everything in PostgreSQL and signs people and services in through Keycloak. Nothing else is required; Slack, the LLM providers and Atlassian are reached only when those integrations are used.

## The image

|             |                                                                                                                              |
| ----------- | ---------------------------------------------------------------------------------------------------------------------------- |
| Image       | `europe-west4-docker.pkg.dev/visdom-496808/visdom-gar/visdom-control-plane`, tagged `v<version>` per release (and by commit) |
| Base        | `gcr.io/distroless/cc-debian13:nonroot`: no shell, no package manager                                                        |
| User        | `65532:65532` (non-root)                                                                                                     |
| Port        | `8080` (`CP_LISTEN_ADDR`)                                                                                                    |
| Entry point | `/usr/local/bin/cp-server`                                                                                                   |
| UI          | Built into the binary; served from the same port, with its runtime settings at `/config.js`                                  |

The image has no `HEALTHCHECK`; use the HTTP endpoints below from your orchestrator.

## What it needs

* **PostgreSQL.** The only store: projects, repositories, users, grants, secrets, integrations and the sync outbox. The repository's own Compose file uses PostgreSQL 17. There is no pool-size setting; the driver's defaults apply.
* **Keycloak.** An OIDC realm with the clients and roles described in [Keycloak](https://docs.visdom.virtuslab.com/visdom-control-plane/operations/keycloak.md). The Control Plane only validates tokens and, for project sync, mints a client-credentials token of its own.
* **A master key** for secrets: 32 random bytes in base64 (`openssl rand -base64 32`), in `CP_SECRETS_MASTER_KEY`. Keep it in your secret store. Losing it makes every stored secret, Slack token, LLM key and Atlassian token unreadable; there is no rotation.
* Optionally an **OpenTelemetry collector**; see [Observability](https://docs.visdom.virtuslab.com/visdom-control-plane/operations/observability.md).

Every setting is an environment variable; the full list is in [Configuration reference](https://docs.visdom.virtuslab.com/visdom-control-plane/operations/configuration-reference.md).

## Start-up

{% stepper %}
{% step %}

### Configuration

The server reads its environment once. A missing required value, a malformed URL or an incomplete pair (for example a sync URL without the client credentials) stops it with `config error: …` on stderr and exit code 1.
{% endstep %}

{% step %}

### Database and migrations

It connects to PostgreSQL and applies its migrations, which are embedded in the binary (26 of them today). They run before the server listens; a failed migration stops the start.
{% endstep %}

{% step %}

### Workers and listener

It starts one project-sync worker per configured product (see [Project sync](https://docs.visdom.virtuslab.com/visdom-control-plane/integrating-a-product/project-sync.md)) and begins serving. Keycloak's signing keys are fetched on the first request, not at start-up.
{% endstep %}
{% endstepper %}

## Health and API documents

| Path                  | Auth | What it answers                                      |
| --------------------- | ---- | ---------------------------------------------------- |
| `GET /healthz`        | none | `200 ok` while the process runs                      |
| `GET /readyz`         | none | `200 ok` as well. It does **not** check the database |
| `GET /_/openapi.json` | none | The OpenAPI document of the API                      |
| `GET /_/openapi/ui`   | none | Swagger UI for it                                    |

There is no `/metrics` endpoint; metrics leave only through OTLP. Probe requests are not traced or logged.

## Replicas

Several replicas can run side by side. Project-sync workers on every replica claim outbox rows with row locks in PostgreSQL, so each change is delivered once; Slack's OAuth state is signed rather than stored, so any replica can finish a sign-in that another one started. Signing-key and token caches are per replica, which is harmless.

{% hint style="warning" %}
**Upgrading from a release older than v0.1.1** (across migration 0008) must run with the Control Plane scaled to zero, or with a `Recreate` strategy: during a rolling deploy, old pods fail every project and repository write. Any later release rolls normally. See [Releases and upgrades](https://docs.visdom.virtuslab.com/visdom-control-plane/operations/releases-and-upgrades.md).
{% endhint %}

The server has no graceful shutdown: on `SIGTERM` it stops at once. A sync delivery that was in flight is claimed again after 90 seconds and retried, so nothing is lost; an API request in flight fails and the client retries.

## Network

**Inbound.** People's browsers (the UI and the API under `/api/v1`), the other Visdom products (API calls with their service accounts), and Slack's OAuth redirect to `/api/v1/integrations/slack/oauth/callback` when Slack is used.

**Outbound from the server.**

| To                                                              | When                                                              |
| --------------------------------------------------------------- | ----------------------------------------------------------------- |
| Keycloak: `{issuer}/protocol/openid-connect/certs` and `/token` | Always (signing keys); the token endpoint when project sync is on |
| Each product's sync URL (`CP_*_API_URL`)                        | When project sync to that product is on                           |
| `slack.com`                                                     | Slack integration: OAuth, channel lists                           |
| `api.anthropic.com`, `api.openai.com`                           | The **Test** button of an LLM integration                         |
| `<site>.atlassian.net`                                          | The **Test** button of an Atlassian integration                   |

**From the browser.** The Home dashboard is assembled in the browser: it calls `GET /api/v1/dashboard/summary` on Orchestrator, Context Fabric and AI Tracing at their `CP_SUITE_*_URL` addresses, with the person's own token. Those products must be reachable from people's browsers and must allow the Control Plane's origin (CORS). See [The suite shell and the dashboard](https://docs.visdom.virtuslab.com/visdom-control-plane/integrating-a-product/suite-shell-and-dashboard.md).

The API answers cross-origin calls only from the origins of the configured `CP_SUITE_*_URL` addresses, for `GET`, `POST`, `PUT` and `DELETE` with the `Authorization` and `Content-Type` headers.

## Kubernetes

The repository ships no Helm chart or manifests. A Deployment with the image, a Service on port 8080, the environment from a Secret and probes on `/healthz` and `/readyz` is all it needs; Visdom's own environments are installed from Kustomize overlays in a GitOps repository. Run it behind your ingress on HTTPS: the UI's sign-in uses PKCE, which browsers allow only on secure origins (or `localhost`).

## First start

1. Create the PostgreSQL database and user.
2. Set up the Keycloak clients and give the first administrators the `control-plane-admin` realm role ([Keycloak](https://docs.visdom.virtuslab.com/visdom-control-plane/operations/keycloak.md)).
3. Generate the master key and set the required variables: `CP_DATABASE_URL`, `CP_OIDC_ISSUER_URL`, `CP_OIDC_AUDIENCE`, `CP_SECRETS_MASTER_KEY`.
4. Add the `CP_SUITE_*_URL` addresses of the products you run, so the module rail, CORS and the dashboard know them.
5. For project sync, add each product's `CP_*_API_URL` and the `control-plane-m2m` credentials.
6. Start it, check `GET /healthz`, open the UI and sign in as an administrator.

Running it on a laptop for development is described in the repository's local development runbook.
