Organizations
The tenant boundary. Organizations own every other resource; teams and teammates carry membership; the TLS tables hold the Organization CA and its rotations.
Tables in this group: changeover, invitation, leaf, organization, team, teammate, tls.
changeover
Journal row for one Organization CA rotation (at most one in_progress per org); never deleted, it is the audit trail and resume state of the fan-out.
| 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 | Fan-out resume state written between passes: resumeAfterManagedId keyset cursor and needsRedeploy server/environment pairs. |
organization_id | uuid | yes | Owning org; the partial unique index allows one in_progress row per org, which is what makes the row act as the rotation lease. |
from_ca_generation | integer | yes | Generation that was active when the rotation minted its successor; 0 until the mint step has run. |
to_ca_generation | integer | yes | New active generation minted by this rotation; 0 until minted, and a non-zero value lets a repeated request resume fan-out. |
state | text | yes | in_progress (lease held), then awaiting_retire once fan-out converged, then completed when the old generation is retired, or failed. |
started_at | timestamp(3) with time zone | yes | When the lease was taken; reset when a stale in-progress row (older than 15 min) is stolen by another isolate. |
completed_at | timestamp(3) with time zone | no | Set by the retire step together with state = completed; null otherwise and cleared when a stale row is stolen. |
results | jsonb | no | Array of per-server fan-out rows with serverId, kind (ingress, apply or binding), managedId, commandId, status and error. |
retire_by | timestamp(3) with time zone | no | Set when fan-out finishes: after it the sweep retires the previous CA generation once every live target converged; null before. |
invitation
Team-scoped invite per (team, email) with a 7-day link; accept adds teammate and optional grants rows when stored.
| 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. |
user_id | uuid | yes | The inviter (a manager of the team), not the invitee; the invitee is known only by email until accept. |
team_id | uuid | yes | Team the invitee joins on accept; there is no organization_id, the organization is derived through the team. |
status | text | yes | pending at creation, then accepted by the accept route or revoked by the revoke route; expiry is not a status. |
expires_at | timestamp(3) with time zone | yes | Creation time + 7 days; status is not flipped on expiry, readers compare this column against now. |
email | varchar(255) | yes | Invited address; accept succeeds only for a signed-in account whose email equals it case-insensitively. |
grants | jsonb | no | Optional grant specs (entityType, entityId, permissionKey) an owner attached; null means none; materialized on accept. |
token_hash | text | yes | SHA-256 verifier of the secret emailed only in the accept link, used to look the invitation up; rotated on re-send. |
leaf
Tracking row per deployed Organization-CA-signed leaf (ingress per server, engine per replica); upserted after apply succeeds, keeps no history.
| Column | Type | Required | Description |
|---|---|---|---|
id | uuid | yes | Primary key (uuidv7(), time-ordered). |
updated_at | timestamp(3) with time zone | yes | Last write time; the ORM sets it to now() on every update. |
organization_id | uuid | yes | Parent organization row (on delete cascade). |
server_id | uuid | yes | Host the leaf is deployed on; unique per server for ingress rows. |
managed_id | uuid | no | Engine leaves only: the managed cluster that owns the replica; must be null on ingress rows. |
replica_id | uuid | no | Engine leaves only: the replica whose leaf this tracks, unique per replica; must be null on ingress rows. |
ca_id | uuid | yes | The tls Organization CA row that signed the leaf; the row is cascade-deleted with that CA. |
kind | text | yes | ingress (ProxySQL frontend leaf on a server) or engine (a cluster replica's engine leaf). |
ca_generation | integer | yes | Generation of the signing CA at issue time; a mismatch with the active generation makes the leaf due for renewal. |
not_after | timestamp(3) with time zone | yes | Leaf expiry (90-day lifetime); the renewal sweep treats a leaf as due when less than a third of its lifetime remains. |
issued_at | timestamp(3) with time zone | yes | When the leaf was minted; refreshed on every re-issue upsert. |
state | text | yes | active (counted and renewed when due) or stale (nothing waits on it: not counted, not renewed, never holds back retiring the old CA). |
stale_at | timestamp(3) with time zone | no | When the row was marked stale; set exactly when state is stale. |
stale_reason | text | no | Plain-words reason shown on the Organization CA card for a stale row (at most 300 characters). |
stale_cause | text | no | offline (server gone for weeks; comes back when it reconnects), unused (nothing needed it) or owner; set exactly when state is stale. |
attempts | integer | yes | Renewals tried since the leaf was last deployed; drives the retry back-off and resets on a successful deploy. |
attempted_at | timestamp(3) with time zone | no | When a renewal was last queued for this leaf; null before the first try. |
last_error | text | no | Plain-words reason the last renewal failed or could not be queued (at most 300 characters); cleared on a successful deploy. |
organization
Tenant organization; one is created by the install wizard and by every sign-up, its members come through teams, and options holds org-wide defaults.
| 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. |
options | jsonb | no | Org-wide settings merged key-by-key by the organization routes (maxServers, phpModes and more). |
backup_destination_id | uuid | no | Destination finished backups are copied to unless a cluster chooses otherwise; null means no default copy. Set null if the destination is deleted. |
name | text | no | Display name; sign-up uses [email protected]'s organization from email, else My Organization if missing, blank, or label invalid; install Root Organization. |
next_linux_id | integer | yes | Next uid/gid for a Hosting Account on servers this organization owns; starts at 30001, rises by one per new account, never reused. |
deploy_timeout_minutes | integer | no | The longest a deploy may run, in whole minutes from 5 to 240, counted only while the server reports; null means the default of 30. |
acme_contact_email | text | no | Contact address on the organization's Let's Encrypt account, needed to turn it on; null means none. |
acme_terms_accepted_at | timestamp(3) with time zone | no | When the organization last accepted the Let's Encrypt terms, needed to turn it on; the audit log says who. |
acme_terms_url | text | no | The exact Let's Encrypt agreement accepted at acme_terms_accepted_at; a newer one must be accepted again to turn it on. |
icon | text | no | Icon key from the same fixed list as project.icon, or one emoji; NULL means the default icon. |
is_acme_enabled | boolean | yes | Let's Encrypt allowed for this organization's certificates; off until the organization opts in. Turning it off erases stored keys but revokes nothing. |
is_emoji_icon_allowed | boolean | yes | Emoji icons allowed for the organization and its projects; off refuses new emoji icons and shows the default for stored ones, which are kept. |
team
Team within an organization; every org gets a Default Team at creation, and membership in any of its teams is what makes a user an org member.
| 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. |
organization_id | uuid | yes | Parent organization row (on delete cascade). |
name | text | no | Display label of 1-255 chars, Default Team for the team created with the organization; no route creates or renames teams today. |
teammate
User-to-team membership row (unique per pair), the source of truth for organization membership; written at org creation and on invitation accept.
| Column | Type | Required | Description |
|---|---|---|---|
id | uuid | yes | Primary key (uuidv7(), time-ordered). |
created_at | timestamp(3) with time zone | yes | Row creation time. |
team_id | uuid | yes | Team joined; unique together with user_id, and organization membership is derived through team.organization_id rather than stored here. |
user_id | uuid | yes | Parent user row (on delete cascade). |
tls
Per-organization TLS library: uploaded, Let's Encrypt, self-signed certificates and the Organization CA generations; hosting.tls_id pins rows by id.
| 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 | Certificate facts not promoted to columns: dnsNames, hasWildcard, notBefore, subject, issuer and acme (challengeType, managedBy, lastError). |
options | jsonb | no | Operator knobs: prefer (pin priority), autoRenew, and requestedHostnames asked for on Let's Encrypt or self-signed create; null on Organization CA rows. |
organization_id | uuid | yes | Parent organization row (on delete cascade). |
issued_by_server_id | uuid | no | Server whose Caddy issued the stored Let's Encrypt pair (the daemon that reported it); null when no pair is stored or that server was deleted. |
name | text | no | Operator label of 1-255 letters, digits, space, dot, underscore or dash; fixed Organization CA on CA rows. |
status | text | yes | Row health ready, pending, expired, failed, revoked or automatic (web server issues it); expired is derived from not_after, others stored. |
source | text | yes | upload, lets_encrypt (Caddy-managed ACME on the host), self_signed or organization_ca; decides which other columns are meaningful. |
certificate_pem | text | no | Leaf plus intermediate chain PEM; on lets_encrypt rows it is null until the serving host's Caddy has issued the certificate and its daemon has sent a copy. |
private_key_pem | text | no | Private key PEM sealed as a tpsecret envelope, never returned by the client API; Let's Encrypt rows get it from the daemon report and lose it on revoke. |
not_after | timestamp(3) with time zone | no | Certificate expiry parsed from the PEM at write; epoch-0 placeholder on automatic rows; indexed for expiry checks. |
fingerprint_sha256 | text | no | SHA-256 fingerprint of the leaf DER, unique per organization when set; null on automatic rows that have no certificate yet. |
ca_state | text | no | Organization CA lifecycle active (one per org), retired (still in the trust bundle) or revoked; null on non-CA rows. |
ca_generation | integer | no | Monotonic per-org counter (max + 1) assigned when a CA is minted; leaves record which generation signed them; null on non-CA rows. |
Last updated on