Skip to main content

The tenant lifecycle

A tenant is built once and then changes for years: a new version of your image, a different machine, a second machine beside the first, and eventually an ending. Each of those is one operation with a stated order, and the order is what makes an interrupted one recoverable. This page is that set.

Provisioning & self-service covers the first step. Everything here happens afterwards.

Update — a new version of your image​

POST /platform/api/tenants/{slug}/update with {"image_ref": "repo:tag"}, or repo@sha256:… to pin a digest. The control plane looks up the machine holding the tenant and asks its agent; the agent's own answer is passed back unchanged, because it is the only party that knows whether the tenant moved or was put back.

The agent reads the instance's current environment and carries forward what cannot be produced again — its generated secrets and its issued OIDC client — recomputing everything else from the new image. It waits for health, and if the new image does not come up it puts the previous state back and reports which image the tenant is actually on.

A new image faces every refusal a first provision faces. An image whose compose file asks for more than the plan bought, or for more of the machine than it should have, is refused at update too — so a tenant cannot be moved onto a stack that would not have been built in the first place.

The fleet, in batches​

POST /platform/api/fleet/update runs the same operation across every selected tenant and answers 202 with a rollout id, not a result: it restarts each customer's stack in turn and takes as long as the slowest of them put together. Naming a host_id limits it to one machine, which is how an image is proved on one before the rest follow.

Three rules are worth knowing before you trust the number it reports:

  • A rollback counts as a failure. The agent answers success for one — the tenant is serving — but it did not move, and an image that rolls back on one tenant rolls back on the next.
  • A tenant that cannot be attempted is skipped, not failed. One with no recorded machine, or on a machine that is not registered, does not implicate the image, and stopping would fix nothing.
  • The failure threshold is checked between batches, never inside one. A batch already running is not abandoned half-way, so the batch size is the number of tenants one bad image can reach before anything stops.

Move — the same tenant, another machine​

POST /platform/api/tenants/{slug}/move with an optional {"to_host": "..."}; without one, placement chooses. Four steps, in this order:

  1. A copy is taken where the tenant is running — its own copy, not the newest scheduled one, so the move carries what the tenant holds now.
  2. The destination builds it from that copy and the tenant's own escrowed secrets, and registers a fresh OIDC client for the new instance.
  3. The placement is recorded, which is what re-points the edge.
  4. The old stack is removed.

Read it as four failure points, because that is what the order is for:

InterruptedStateThe retry
before the buildthe tenant is still serving where it waschanges nothing
between the build and the placementtwo stacks, traffic still going to the old onethe destination answers "already built" and the move carries on
after the placementtwo stacks, traffic going to the new onethe retry removes the old

The reverse order — remove first, then build — has a window in which the tenant exists nowhere, and the step that would have to work is the one that just failed.

A move refuses a tenant that is not placed anywhere: there would be no machine to take a copy from, and building from escrow alone would produce a tenant with its secrets and no data — which answers, and is wrong.

What a move does with the copy it made

Carrying the data is how a move happens, so a copy is taken whatever the tenant decided about backups. Afterwards the copy is deleted unless that tenant's copies are on — and only the copy the move made: the ones it held from before are not a move's to delete. See Data & backups.

A second machine — serving one tenant from two​

GET/POST /platform/api/tenants/{slug}/replicas, and DELETE .../replicas/{hostId}. A replica is a second machine serving the same tenant; the tenant edge then weights both.

It is a different answer from a bigger plan, and the two solve different problems:

WantReach for
more cores or memory for one tenanta larger plan — it resizes on the next update
more containers inside the plan's budgetyour own compose file, in packaging
to survive the loss of a machinea second machine

A replica's plan figures are booked against the second machine too, because that machine is running the tenant's stack as well.

Close — the ending, and what happens to the data​

POST /platform/api/tenants/{slug}/close with {"backups": "retain" | "delete"}, which is required and has no default.

  • retain takes a final copy while the stack is still running, then keeps everything held for the deployment's retention window, after which the backup pass deletes the copies and the escrow records together. A dump is ciphertext without the data-at-rest key sealed in its escrow record, so one without the other is either a file nobody can restore or a key protecting nothing.
  • delete removes them with the stack, which is what clearing a tenant off a development machine means.

Neither can be inferred from what the control plane knows — a development tenant is usually being cleared and a production tenant usually has a contract behind it, but acting on usually with a customer's last remaining copy cannot be undone. A closure asked to keep the copies and unable to take the final one changes nothing at all, because the copies are the thing being preserved.

The closure is recorded; the tenant is not deleted. The edge leaves it out, so the name stops being served; the backup pass skips it; the per-buyer quotas stop counting it; and what happened to its data stays answerable. Closing again finishes a closure whose machine was unreachable, and closing with delete ends a retention window early.

A closed name is not handed to another tenant while its data is still held. Copies live in a directory named after the tenant, so a new tenant under that name would inherit them — and the newest copy a move or a restore reads back would be the previous tenant's data. A provision for such a name is refused, naming the date; once nothing is held, the same name provisions fresh.

A tenant that withdrew its agreement to copies cannot be closed with retain: keeping a final copy is the thing that tenant said not to do, so the closure is refused and names delete. One that only paused has not withdrawn, and can be closed either way.

What the control plane watches meanwhile​

Two reads answer "is this still true", and both are taken when asked rather than stored:

  • The fleet comparison asks every registered machine what it holds and compares it with the ledger. Drift is reported per kind — a tenant the ledger knows and no machine reports, a tenant a machine reports that the ledger does not, a tenant whose placement was never recorded.
  • Usage (GET /platform/api/tenants/{slug}/usage) reports what each of a tenant's services is using against the ceiling it was given, on every machine serving it, with any machine that could not be read named rather than omitted.

Conditions are raised before they hurt rather than after: a tenant being killed for exceeding its memory, a tenant sitting at its CPU ceiling, a production tenant with no recoverable copy, a backup destination on the machine that could lose it.

See also​