Servers, Runtime and Metrics
Enrolled servers and their daemon keys, the command / dispatch pipeline, deployments, slots, tasks, labels, and the metrics topology generations.
Tables in this group: command, deployment, dispatch, key, label, monitor, peak, peripheral, server, slot, task.
command
Append-only command history, one row per attempt dispatched to a daemon; created by routes and reconcilers, advanced by transitionCommand; UI status source.
| Column | Type | Required | Description |
|---|---|---|---|
id | uuid | yes | Primary key (uuidv7(), time-ordered). |
created_at | timestamp(3) with time zone | yes | Row creation time. |
updated_at | timestamp(3) with time zone | yes | Last write time; the ORM sets it to now() on every update. |
metadata | jsonb | no | Follow-up-chain blob only (pendingStandbyApplies, managedDestroyGate, followUpPromote, pendingTlsLeaf, desiredHash) and one-shot claim flags. |
organization_id | uuid | no | Organization of the server, copied at insert so the activity feed and org-wide lists filter without a join; set null if the organization row goes. |
server_id | uuid | yes | Parent server row (on delete cascade). |
environment_id | uuid | no | Environment a deploy, lifecycle or stop command was issued for (also kept in context); set null when the environment is deleted. |
managed_id | uuid | no | Managed cluster the command acts on (also kept in context); set null when the cluster is deleted. |
name | text | yes | Command type from COMMAND_TYPES in commands/types.ts, such as daemon.ping, environment.deploy, managed.apply or system.reconcile. |
status | text | yes | State queued, dispatching, sent, acked, running, then terminal succeeded, failed, timed_out or cancelled; set by transitionCommand. |
actor_type | text | yes | user for an operator request or system for the control plane's own reconcilers, sweeps and webhooks (mirrors COMMAND_ACTOR_TYPES); no FK. |
actor_id | uuid | yes | Id of the acting user, or of the triggering entity (usually the server) when actor_type is system; no FK. |
attempts | integer | yes | Dispatch retry count, incremented by the queue consumer each time it picks the command up. |
context | jsonb | no | Allowlisted non-secret identifier bag (managedId, environmentId, generation) extracted by commands/context.ts so reads never need the dispatch payload. |
result_summary | jsonb | no | Small bounded typed result reported by the daemon on completion (API field result); execution logs live in the execution-log store, not here. |
progress | jsonb | no | Live step plan and current step the server reports during a deploy (CommandProgress); NULL until reported, finalised when the command ends. |
error_code | text | no | Machine-readable terminal error code set when the command fails or times out. |
error_message | text | no | Human-readable terminal error text (API field error) set alongside error_code. |
queued_at | timestamp(3) with time zone | no | Set by transitionCommand when the status becomes queued. |
dispatch_started_at | timestamp(3) with time zone | no | Set when the queue consumer picks the command up (status dispatching). |
sent_at | timestamp(3) with time zone | no | Set when the command is enqueued to the daemon cell outbox (status sent). |
acked_at | timestamp(3) with time zone | no | Set when the daemon acknowledges receipt (status acked). |
started_at | timestamp(3) with time zone | no | Set when the daemon reports that execution has begun (status running). |
finished_at | timestamp(3) with time zone | no | Set when the command reaches any terminal status. |
expires_at | timestamp(3) with time zone | no | Optional deadline: once passed, the consumer marks the command timed_out instead of dispatching it; consumer-made follow-ups set 10 minutes, NULL means none. |
managed_destroy_gate_id | text | no | metadata.managedDestroyGate.gateId promoted to an indexed column so gated replica-destroy completions can be filtered; memberIds stays in jsonb. |
deployment
Current desired and applied state per (environment, server) pair, upserted on each redeploy by deploy-routes.ts; history lives in environment.deploy commands.
| Column | Type | Required | Description |
|---|---|---|---|
id | uuid | yes | Primary key (uuidv7(), time-ordered). |
created_at | timestamp(3) with time zone | yes | Row creation time. |
updated_at | timestamp(3) with time zone | yes | Last write time; the ORM sets it to now() on every update. |
metadata | jsonb | no | Jsonb patched on apply outcome: error holds the last failure message and is reset to null on success. |
options | jsonb | no | Per-target apply inputs written at deploy time: secretPlan, siteReleases (release trees the compose declares) and phpModes (mode per PHP site). |
environment_id | uuid | yes | Parent environment row (on delete cascade). |
server_id | uuid | yes | Parent server row (on delete restrict). |
last_command_id | uuid | no | Id of the command row for the most recent apply attempt on this pair, set null when that command is pruned; the join key into the command history. |
status | text | yes | pending, applying (deploy command created), applied, failed, or draining (server dropped from the plan, awaiting cleanup); set by deploy-routes. |
desired_generation | integer | yes | Environment deploy generation this row targets, written by deploy-routes.ts for every planned and drained server on each deploy. |
applied_generation | integer | no | Generation the daemon last applied successfully on this server, set on the applied transition; NULL until a first success. |
desired_hash | text | no | sha256 of this server's compiled runtime compose.yaml for the desired generation; NULL for draining targets. |
finished_at | timestamp(3) with time zone | no | When the last apply attempt reached a terminal state; summarizes only the latest attempt. |
duration_ms | integer | no | Wall-clock duration of the last apply attempt in milliseconds; NULL when unknown. |
outcome | text | no | Terminal outcome of the last apply attempt: applied, failed or timed_out (the command's own terminal status); NULL until one finishes. |
dispatch
One-shot daemon execution payload for a command and the only place secret-bearing command input lives; inserted with its command row, deleted on success.
| Column | Type | Required | Description |
|---|---|---|---|
command_id | uuid | yes | Primary key and FK to command.id (cascade): exactly one payload per command, written in the same transaction as the command row. |
created_at | timestamp(3) with time zone | yes | Row creation time. |
updated_at | timestamp(3) with time zone | yes | Last write time; the ORM sets it to now() on every update. |
payload | jsonb | yes | Typed, bounded daemon command input (may carry compose YAML, credential envelopes or TLS material); read once by the consumer just before dispatch. |
expires_at | timestamp(3) with time zone | no | Failure-retention deadline: NULL until a terminal failure, then now plus 24h (failed, timed_out, cancelled); the maintenance sweep deletes expired rows. |
key
The Ed25519 daemon identity key of a server, one row per server (unique server_id and fingerprint), written on enroll and re-enroll by server-identity-db.
| Column | Type | Required | Description |
|---|---|---|---|
id | uuid | yes | Primary key (uuidv7(), time-ordered). |
created_at | timestamp(3) with time zone | yes | Row creation time. |
updated_at | timestamp(3) with time zone | yes | Last write time; the ORM sets it to now() on every update. |
server_id | uuid | yes | Owning server, UNIQUE so re-enrolment replaces the row in place (fresh id, cleared revoked_at) unless the row is revoked; cascades on server delete. |
algorithm | text | yes | Signature algorithm of the key, constrained to Ed25519. |
public_jwk | jsonb | yes | Raw Ed25519 public JWK with crv, kty and x as sent by the daemon at enrolment; the private half never leaves the host. |
fingerprint | text | yes | SHA-256 hex digest of the canonical JSON of crv, kty and x; globally UNIQUE and used to look up the server on daemon auth. |
revoked_at | timestamp(3) with time zone | no | Set by revokeDaemonKey; non-null blocks new JWT issuance and is sticky, so a re-enrolment against a revoked row is refused rather than replacing it. |
last_used_at | timestamp(3) with time zone | no | Stamped by touchDaemonKeyLastUsed when a daemon JWT session is issued (single-column write, no cell wake); reset to NULL on re-enrolment. |
label
Key/value labels on a server, the source for compose deploy.placement.constraints (node.labels.*); replaced as a whole set by the labels API, max 64.
| Column | Type | Required | Description |
|---|---|---|---|
id | uuid | yes | Primary key (uuidv7(), time-ordered). |
created_at | timestamp(3) with time zone | yes | Row creation time. |
updated_at | timestamp(3) with time zone | yes | Last write time; the ORM sets it to now() on every update. |
server_id | uuid | yes | Parent server row (on delete cascade). |
key | text | yes | Label key, 1 to 255 chars matching ^[A-Za-z0-9][A-Za-z0-9._-]*$ and unique per server; matched by node.labels.KEY placement constraints. |
value | text | yes | Label value string (empty allowed, default '') capped at the description max length; compared with == or != in placement constraints. |
monitor
Per-server ProxySQL backend monitor credential minted by the control plane, one row per server; kept off server.options since that jsonb is served and cached.
| Column | Type | Required | Description |
|---|---|---|---|
id | uuid | yes | Primary key (uuidv7(), time-ordered). |
created_at | timestamp(3) with time zone | yes | Row creation time. |
updated_at | timestamp(3) with time zone | yes | Last write time; the ORM sets it to now() on every update. |
server_id | uuid | yes | Owning server, UNIQUE because one ProxySQL runs per host with a single global monitor credential; ON DELETE CASCADE so a deleted host leaves no orphaned secret. |
username | varchar(64) | yes | Deterministic monitor role name: tp_monitor_ plus the first 12 hex chars of the server UUID without dashes, kept within engine identifier limits. |
secret_envelope | text | yes | Password sealed with the data-encryption key (ENVELOPE_PREFIX_SECRET prefix); resealed to a tpdaemon envelope per recipient at send time. |
peak
Highest RAM and physical core readings of one server per UTC hour; the over-tier rules judge a server on the highest reading of the last 7 days.
| Column | Type | Required | Description |
|---|---|---|---|
id | uuid | yes | Primary key (uuidv7(), time-ordered). |
created_at | timestamp(3) with time zone | yes | Row creation time. |
updated_at | timestamp(3) with time zone | yes | Last write time; the ORM sets it to now() on every update. |
server_id | uuid | yes | Owning server; ON DELETE CASCADE so a deleted host leaves no readings, and (server_id, bucket) is UNIQUE so an upsert only raises the hour. |
bucket | timestamp(3) with time zone | yes | Start of the UTC hour the readings cover, aligned by the writer; rows older than the 7-day grace window are pruned by the 15-minute cron. |
memory_bytes | bigint | no | Highest total RAM in bytes read in the hour; NULL when none was read, never negative. |
cores | integer | no | Highest physical core count read in the hour; NULL when none was read, never negative. |
peripheral
A device node on a server that can be passed to one service (USB drive, serial adapter, printer, capture card), keyed by its stable path.
| Column | Type | Required | Description |
|---|---|---|---|
id | uuid | yes | Primary key (uuidv7(), time-ordered). |
created_at | timestamp(3) with time zone | yes | Row creation time. |
updated_at | timestamp(3) with time zone | yes | Last write time; the ORM sets it to now() on every update. |
server_id | uuid | yes | Parent server row (on delete cascade). |
service_id | uuid | no | The service the device is passed to; NULL when no service has it, and cleared when that service is deleted. |
name | text | no | Label an operator gave the device; NULL when none. |
kind | text | yes | What the device is: usb, serial, printer, video, audio or other. |
status | text | yes | present while the host reports the device, missing once it no longer does. |
path | text | yes | Stable device path under /dev (a by-id or by-path link) as the host reports it; unique per server. |
vendor_id | text | no | USB vendor id as four lower-case hex digits; NULL for a device that is not on USB. |
product_id | text | no | USB product id as four lower-case hex digits; NULL for a device that is not on USB. |
observed_at | timestamp(3) with time zone | no | When the host last reported the device. |
server
One enrolled host per row (uuidv7 id); daemon enroll and heartbeats project host facts onto it, operators set the name, options and pins via PATCH.
| Column | Type | Required | Description |
|---|---|---|---|
id | uuid | yes | Primary key (uuidv7(), time-ordered). |
created_at | timestamp(3) with time zone | yes | Row creation time. |
updated_at | timestamp(3) with time zone | yes | Last write time; the ORM sets it to now() on every update. |
metadata | jsonb | no | Daemon-projected host facts jsonb: resources, geo, docker, runtimes, cell plus the operator hardwareProfile; hostname, OS and NTP have own columns. |
options | jsonb | no | Operator config served by GET /servers: timezone, sshPort, ntp, hosting, cellLocationHint, cellGeneration, metricsCapabilityPlan, phpModes. |
organization_id | uuid | no | Owning organization, nullable; ON DELETE RESTRICT so an organization that still has server rows cannot be deleted. |
assigned_tier_id | uuid | no | Tier a manager assigned this server (Add Server choice, license-tier route or a named size change); self-hosted fills the top tier. NULL until set. |
preferred_tier_id | uuid | no | Written in step with assigned_tier_id, for the console's picked label; set alone when the Add Server tier had no free seat at enroll. |
preferred_datacenter_id | uuid | no | The datacenter whose network this server prefers when it belongs to several; NULL means no preference; set null when the datacenter is deleted. |
name | text | no | Optional operator-chosen display name, set when the registration key is minted or via PATCH; the UI falls back to hostname when null. |
role | text | yes | What the server is for: server runs workloads, witness only votes in database failover and holds no data; written by an administrator. |
hostname | varchar(255) | no | Daemon-reported host name written on enroll, hello and identity projection; used with machine_key to match a reconnecting daemon to its row. |
machine_key | text | no | Deterministic HMAC-SHA256 digest of the host machine-id (never the raw id, not a secret), echoed into signed enroll/auth payloads and used to match reconnects. |
os_id | varchar(255) | no | Distro ID from /etc/os-release as reported by the daemon; Raspberry Pi OS (including 64-bit ID=debian with /etc/rpi-issue) is stored as raspberry-pi-os. |
os_family | varchar(32) | no | Daemon-reported OS family, one of linux, windows, freebsd or darwin. |
os_version | varchar(64) | no | Daemon-reported OS version, preferring DEBIAN_VERSION_FULL or /etc/debian_version over VERSION_ID (such as 13.5). |
os_codename | varchar(64) | no | Daemon-reported VERSION_CODENAME from /etc/os-release. |
os_pretty_name | varchar(255) | no | Daemon-reported PRETTY_NAME from /etc/os-release. |
os_architecture | varchar(64) | no | Daemon-reported CPU architecture, normalised on ingest to x86_64 or aarch64 (amd64 and arm64 map across); other CPUs are not stored, so NULL. |
machine_class | text | no | physical or virtual for sensor entitlement; NULL means auto, where ingest writes physical once sensors are found (never virtual); PATCH can pin. |
machine_class_source | text | no | Who set machine_class: detected (ingest wrote it back from the topology) or operator (a PATCH pinned or cleared it); NULL while the class is NULL. |
timezone | varchar(64) | no | Daemon-observed IANA host timezone; the operator override lives in options.timezone and wins when set. |
ntp_servers | jsonb | no | Daemon-reported jsonb array of objects with host and optional fallback (FallbackNTP entries), read from timesyncd.conf or timedatectl. |
ntp_last_synced_at | timestamp(3) with time zone | no | Last successful NTP sync: set from the daemon stamp or first synced observation, cleared when the host reports unsynced, never bumped to now() per heartbeat. |
status_changed_at | timestamp(3) with time zone | no | Time of the last is_connected flip in either direction; read as connectedAt while connected and offline-since otherwise, NULL if never transitioned. |
daemon | jsonb | no | Sparse jsonb with an optional projection (hostname, machineKey, remoteAddress, keyId, daemonBuild) written by the cell; the key lives in key. |
sealing_key_kid | text | no | Fingerprint of the daemon X25519 sealing key, set when it registers; decrypt answers are sealed to that key for daemons listing daemon-sealed-secrets-v1. |
sealing_key_pub | text | no | Base64url raw public half of the daemon sealing key, stored only after its signature verified against the daemon key; NULL until registered. |
sealing_key_reported_at | timestamp(3) with time zone | no | When the daemon last registered its sealing key; NULL until it does. |
plaintext_secrets_at | timestamp(3) with time zone | no | Last time the secrets decrypt route answered this server in plaintext, written at most hourly; the edge go-live gate reads it. |
fabric_role | text | no | Operator TurboFabric role, gateway (accepts connections) or client (only dials out); NULL means automatic, gateway when a public address is known. |
trust_pinned_by | text | no | How the daemon pinned the panel key: install, upgrade or unsafe (installed with the skip flag); NULL until the daemon reports it. |
trust_level | smallint | yes | Highest daemon session trust this server has used: 0 unsigned, 1 signed frames, 2 signed with a daemon attach proof; raised only, never lowered. |
trust_pin_fingerprint | text | no | Control plane key fingerprint the server's pin file holds, from its last signed pin report; empty when nothing is pinned, NULL until a report verifies. |
trust_pin_keyset | integer | no | Key set number of that pin, from the same signed report. |
trust_pin_reported_at | timestamp (3) with time zone | no | When the last signed pin report verified. |
trust_pin_passkeys | text | no | Base64url SHA-256 of the rotation passkeys line in the server pin, from its signed pin report; empty with none pinned, NULL when not reported. |
trust_silence_stage | smallint | no | Pin silence alarm raised for the current offline episode: 1 pin silent, 2 pin missing; NULL when none, cleared on reconnect or a signed pin report. |
trust_silence_since | timestamp(3) with time zone | no | The offline episode that alarm belongs to, as the status change time it started at. |
trust_silence_alive_at | timestamp(3) with time zone | no | Since when TurboFabric peers have reported a healthy tunnel to this offline server without a break; NULL while none does. |
trust_reports_signed_at | timestamp(3) with time zone | no | When a signed daemon report from this server first verified; set once, and from then on its unsigned reports on a signed session are refused. |
container_prefix | cidr | no | Container range of this server (a /16 from the org container pool), set when first needed; cross-server network subnets come from it, NULL until then. |
hardware | jsonb | no | Latest hardware layout the daemon reported (generation, boot generation, snapshot, times); overwritten in place, no history, never read by list screens. |
capability | jsonb | no | Latest resolved metrics capability plan (generation, hash, plan, applied time); overwritten in place and recomputable from the box size and hardware. |
offline_reason | text | no | Why the host is offline: disconnect (socket closed) or sweep_stale (no heartbeat, likely power loss); NULL while online. |
daemon_commit | text | no | Commit of the daemon build running on the host, from its hello or heartbeat. |
daemon_built_at | timestamp(3) with time zone | no | Build time of the daemon build running on the host. |
daemon_update_status | text | no | Daemon self-update state: idle, updating, done, failed or expired; NULL until the host reports one. |
external_access_pending_at | timestamp(3) with time zone | no | When the host was last asked to change database external access and has not confirmed; a sweep re-sends it while set. |
is_time_sync_enabled | boolean | no | Daemon-reported NTP client enabled flag (ntpEnabled from the systemd-timesyncd facts); NULL when never reported. |
is_connected | boolean | yes | Daemon liveness flag written by the cell projection on connect and disconnect; online, offline or unknown is derived from it and status_changed_at. |
is_hosting_enabled | boolean | no | Boolean mirror of validated options.hosting.enabled, written by the same PATCH route so system/reconcile.ts can filter hosting in SQL; NULL means not set. |
is_fabric_enabled | boolean | yes | TurboFabric membership switch, default true; false keeps the server out of the mesh (no relay, no tp0, no peer entry, no fabric address). |
is_trust_pin_matching | boolean | no | Whether the reported pin named this control plane's current or next key; false raises the pin mismatch alarm. |
slot
One scheduled replica instance of a service on a server; derived scheduling state the planner writes through replaceEnvironmentSlots on each deploy.
| Column | Type | Required | Description |
|---|---|---|---|
id | uuid | yes | Primary key (uuidv7(), time-ordered). |
created_at | timestamp(3) with time zone | yes | Row creation time. |
updated_at | timestamp(3) with time zone | yes | Last write time; the ORM sets it to now() on every update. |
environment_id | uuid | yes | Parent environment row (on delete cascade). |
service_id | uuid | yes | Parent service row (on delete cascade). |
server_id | uuid | yes | Server the planner placed this replica on; sticky across re-plans (only generation is rewritten) unless the planner moves it; ON DELETE RESTRICT. |
address | inet | no | Cross-host inet address allocated on the environment's spanning compose network; at most one per slot, NULL clears a prior allocation. |
slot | integer | yes | 0-based replica index within the service (unlike 1-based container.ordinal), unique per service. |
generation | integer | yes | Environment deploy generation of the plan that last wrote this row; matches deployment.desired_generation. |
desired_state | text | yes | Intended state, running, stopped or removed; the planner only writes running today. |
task
Cron-style scheduled command on a service, created and edited by operators via the tasks API and rendered into systemd timers at deploy time; no run history.
| Column | Type | Required | Description |
|---|---|---|---|
id | uuid | yes | Primary key (uuidv7(), time-ordered). |
created_at | timestamp(3) with time zone | yes | Row creation time. |
updated_at | timestamp(3) with time zone | yes | Last write time; the ORM sets it to now() on every update. |
metadata | jsonb | no | Accepted by the record helper but never written by the tasks API today; reserved. |
options | jsonb | no | Accepted by the record helper but never written by the tasks API today; reserved. |
service_id | uuid | yes | Parent service row (on delete cascade). |
name | text | yes | Operator display name, unique per service and normalized as a display name (no format CHECK). |
schedule | text | yes | Cron expression validated by parseCronSchedule in lib/cron.ts and converted to a systemd OnCalendar value at deploy time. |
command | text | yes | Shell command line to run (under 1000 chars, each argument under 512), validated by parseCronCommand. |
timezone | text | no | Optional IANA timezone (validated against the allowed list) applied when the schedule is converted to a systemd OnCalendar value; NULL means none set. |
concurrency_policy | text | yes | What happens when a run is still going at the next tick: allow overlapping runs, forbid skips the tick (default), replace restarts the run. |
timeout_seconds | integer | no | Longest a run may take before it is stopped, at most 86400 (24h); NULL means no declared limit. |
is_enabled | boolean | yes | Operator toggle; a disabled task stays stored but renderCronForDeploy skips it, so no timer is rendered at deploy time. |
Last updated on