Architecture
Karakoram is a self-hosted, multi-platform control plane that reconciles engine clusters across infrastructure providers and namespace targets. Zerops is the reference provider; Dokploy and Nomad are also available. See Providers.
Deployment and trust boundaries
Section titled “Deployment and trust boundaries”The diagram and concrete paths below show the Zerops provider deployment; other providers provide their own runtime layout, storage and public ingress.
Diagram source
flowchart LR
Client[Browser / karactl] -->|Public HTTPS| Routing[Zerops HTTP routing]
Routing -->|HTTP 8080| CP[Karakoram control plane]
CP --> State[(SQLite / karakoramdata)]
CP -->|Project-scoped credentials| Platform[Zerops REST API]
CP -->|Engine driver-authenticated administration| Engine[Engine runtime]
CP -->|Pinned TLS + member token / 9443| Agent[Node agent]
Agent -->|Protected configuration pull / TLS 9443| CP
Agent -->|Render files / supervise processes| Engine- Control plane: one runtime service, normally
karakoram, with one container and akarakoramdataLocal Storage volume mounted at/mnt/karakoramdata. UI/API traffic enters through public HTTPS; the private agent listener uses TLS 9443. SQLite stores desired state, observations, operations, events and encrypted secret values. The master key is a separately managed service secret. - Data-bearing members: singleton Ubuntu 24.04 runtimes with independently identified persistent volumes and stable identities (Local Storage on Zerops). Increasing a runtime’s container count is not engine replication.
- Stateless components: engine driver-supported auxiliary runtimes do not have durable data volumes. Containers sharing a service identity are not independent data-bearing members.
- Node agent:
karakoram agentsupervises the selected engine and exposes a bounded private API, not a remote shell.
Private networking alone is not an authentication boundary. Agent traffic uses pinned trust roots and per-member bearer tokens. Public HTTPS, internal agent TLS and engine authentication/TLS protect different paths. See Security for credentials, project-token authority and secret-storage limits. Backup transfer paths are documented in Backups and storage.
Namespaces and relay routing
Section titled “Namespaces and relay routing”A namespace selects an immutable provider kind and target with its infrastructure credentials. Providers are the Zerops provider (targets are Zerops projects), the Dokploy provider (Dokploy environments on a Docker Swarm), and the Nomad provider (Nomad namespaces on an operator-managed cluster). default is the control plane’s own target and uses direct private networking. Additional namespaces use an outbound relay only when their provider’s BackendInfo.Relay requires one; all three current providers require it.
The relay opens an outbound WebSocket connection through public HTTPS and carries an inner mutually authenticated TLS tunnel. Engine driver-approved administration traffic and protected agent traffic use namespace-qualified streams; agent configuration pulls retain end-to-end TLS. A namespace token or relay outage interrupts management of that namespace, not every project. The relay is not application networking.
See Namespaces and relays, the relay threat model and ADR 0018.
Infrastructure providers
Section titled “Infrastructure providers”The server composition root registers compiled-in factories in infra.Registry. Each factory constructs and validates a namespace’s Target; engines use infra.Backend, not the platform client. Neutral ServiceSpec values distinguish runtimes from independently identified persistent volumes. Deployment pairs an executable artifact with a structured RuntimeSpec; each provider renders its own manifest and supplies its runtime Layout. Operations remain opaque handles polled through OpStatus, and errors use neutral classes.
Provider capabilities describe optional public routing, disk growth, quotas, placement, logs and other resource/runtime features. Engine capability gates reject unsupported requests. GET /api/v1/backends publishes registered kinds and capabilities; namespace responses identify their provider and enabled capabilities. All providers must pass the shared contract suite. See ADR 0030; the registry does not imply support for an unregistered platform.
Desired state and durable operations
Section titled “Desired state and durable operations”Clusters separate desired spec from observed status, with generation tracking. Mutations persist intent before reconciliation. Per-cluster workers serialize synchronization and imperative operations; unrelated clusters can progress independently. Engine drivers persist checkpoints and platform identifiers, then observe completion before advancing disruptive work.
Engine driver persistence replaces each owned state value, not just its nonempty fields. PostgreSQL, Elasticsearch and Supabase replace their complete Cluster.Internal namespace objects. Flat MongoDB and RabbitMQ state uses internal/statejson.ReplaceOwned: explicit JSON tags define owned root keys, omitted empty fields remove prior values, and unrelated workflow keys survive. Nested values are replaced whole; adding an optional owned field must not require a second, hand-maintained deletion list.
Neither HTTP acceptance nor a successful infrastructure configuration process proves engine health. There is no distributed exactly-once transaction across SQLite, infrastructure providers and engine/storage APIs: durable identifiers and observation constrain replay, while ambiguous outcomes require investigation. Clusters and operations defines generations, operation phases, health, cancellation and wait behavior.
Independent availability renewal for steady clusters can use authenticated agent heartbeats and a shared per-target platform snapshot; health leases remain anchored to their oldest evidence. Lifecycle reconciliation and safety decisions keep fresh reads, with 30-minute deep resynchronization for steady clusters. ADR 0070 defines the freshness classes, mutation epochs and fallback to live observation.
Node-local durability
Section titled “Node-local durability”Agents cache assigned configuration on the data volume with owner-only permissions. Existing data-bearing members can start from that cache during control-plane downtime; first startup without a cache cannot. Stateless runtimes lose cached configuration when replaced.
Rendered credentials, certificates and configuration are restricted to the runtime owner. Explicit maintenance and process-stop holds are persisted separately from pulled configuration, so a configuration refresh or agent restart does not silently release them. Restore/restart recovery remains engine driver-specific: use the engine operations and recovery guides rather than manually overriding holds.
When the member executable is PID 1, a minimal init parent re-executes the real
agent as its child. The parent forwards termination, interrupt and hangup signals,
reaps adopted daemon descendants, and exits with the real agent’s status. This
keeps orphan reaping separate from the agent’s os/exec command waits; daemonized
database processes cannot remain zombies that block their supervisor’s lifecycle
checks. Ordinary non-PID-1 members do not re-execute.
The shared process supervisor reaps each direct child independently of stdout and stderr EOF. After exit it allows up to 250 ms for final log draining, then closes its pipe readers so descendants retaining inherited descriptors cannot block exit status, restart scheduling or stop completion. Normal EOF finishes the drain immediately. Exit observation does not signal descendants; explicit stop/restart retains the configured stop signal to the child’s process group.
Recovery, monitoring and events
Section titled “Recovery, monitoring and events”The control plane owns scheduling and count retention; its downtime pauses new scheduling and retention. Already-started engine-side work can continue without the control plane. Engine backups and control-plane state backups protect different assets: preserve both the SQLite state and its master key as described in state backup and recovery.
Agents expose member metrics for control-plane collection, history and authenticated Prometheus export. Persisted events feed live UI/API updates; the live event stream is an acceleration, not the persistence layer. See Monitoring and events and API pagination and events.
Failure domains
Section titled “Failure domains”The control plane is single-replica. Persistent volumes are node-local on current providers. Zerops does not guarantee host separation; Dokploy and Nomad report authoritative node placement but cannot establish independent racks or physical hosts beneath the scheduler. Engine replication cannot compensate for every shared-host failure. See Limitations before selecting availability and recovery objectives.
Engine drivers
Section titled “Engine drivers”The code calls an engine driver engine.Provider; the API and CLI retain spec.provider, /api/v1/providers and --provider for engine selection. Engine drivers are compiled into Karakoram, not dynamically installable plugins. Each owns its version catalog, validation/defaults, topology, health observation, lifecycle checkpoints, access APIs and backup semantics. Shared interfaces handle infrastructure, namespaces, secrets, operations and monitoring; capability metadata gates supported UI/API actions. A cluster’s engine driver is immutable.
Optional auxiliary services use ordered ComponentDef/ComponentSet declarations with per-component replicas and resources in spec.components.extra. Shared stateless reconciliation handles enable/disable stages through engine callbacks; credentials, application readiness, resizing and stateful safety remain engine-owned. Elasticsearch uses this for Kibana, Logstash and APM; PostgreSQL for ProxySQL; Supabase for its modular native services. See ADR 0031.
| Engine | Engine driver | Runtime and operational details |
|---|---|---|
| MongoDB | psmdb |
Overview |
| RabbitMQ | rabbitmq |
Overview |
| Elasticsearch | elasticsearch |
Overview |
| PostgreSQL | postgres |
Percona, extension profiles, Patroni/etcd HA, Citus, ProxySQL and pgBackRest |
| Supabase | supabase |
PostgreSQL core plus modular native services |
| Keycloak | keycloak |
Native identity service with a managed PostgreSQL binding |
| OpenBao | openbao |
Native secrets clusters, Raft recovery and leased database credentials |
| Temporal | temporal |
Stateless workflow roles on bound PostgreSQL; requires the PostgreSQL binding service |
| MySQL | mysql |
Percona Server, Group Replication, ProxySQL and XtraBackup |
| Percona XtraDB Cluster | pxc |
Galera, quorum recovery and separate backup provenance |
| Neo4j Community | neo4j |
TLS-only singleton, native administrative users and offline dumps |
| Weaviate | weaviate |
Native lifecycle, access management and recovery |
Supabase wraps the PostgreSQL core rather than duplicating database lifecycle. Internal services use a protocol-transparent leader forwarder rather than ProxySQL; the client proxy retains explicit protocol limits. Native service availability comes from an embedded, checksum-pinned lock with operator mirror precedence, not floating downloads. See ADRs 0034–0036 and native artifacts.
See ADR 0005 for the engine driver seam and Contributing for code layout and development workflows.