Configure the instance artifact bucket
By default SupaCloud keeps artifacts on local disk (see
Configure artifact storage). An operator can instead give
the instance one bucket that every workspace uses unless it chose its own s3
Resource. The bytes then live outside the server’s volume, and a redeploy or a second
replica sees the same files.
1. Create the bucket and a key
Section titled “1. Create the bucket and a key”Create a private bucket and an application key that can reach only that bucket,
with these capabilities: listBuckets, listFiles, readFiles, writeFiles,
deleteFiles.
Give the bucket no age-based lifecycle rule. Storage keys are content-addressed per
workspace, one object can back artifacts of several retention classes, and each plan
has its own retention, so SupaCloud’s hourly sweep owns retention. On Backblaze B2 add
exactly one rule that purges hidden versions after a day (B2 turns an S3 DELETE into
a hide):
{ "daysFromHidingToDeleting": 1, "daysFromUploadingToHiding": null, "fileNamePrefix": "" }2. Set the environment
Section titled “2. Set the environment”| Variable | Default | Meaning |
|---|---|---|
SUPACLOUD_ARTIFACT_S3_ENDPOINT |
unset | The S3 endpoint, for example https://s3.eu-central-003.backblazeb2.com. Must be https:// in production. |
SUPACLOUD_ARTIFACT_S3_REGION |
us-east-1 |
The signing region, for example eu-central-003. |
SUPACLOUD_ARTIFACT_S3_BUCKET |
unset | The bucket name. |
SUPACLOUD_ARTIFACT_S3_ACCESS_KEY_ID |
unset | The key id. |
SUPACLOUD_ARTIFACT_S3_SECRET_ACCESS_KEY |
unset | The secret key. |
Endpoint and bucket go together: one without the other stops a production server at
boot. Leave SUPACLOUD_ARTIFACT_BACKEND unset.
The key pair is read per request:
- both
SUPACLOUD_ARTIFACT_S3_ACCESS_KEY_IDandSUPACLOUD_ARTIFACT_S3_SECRET_ACCESS_KEYfrom the environment, else - both keys of the same names from OpenBao
supacloud/app, read fresh with a 60-second cache.
A pair is never assembled from two sources, and half a pair in either place is an error. A rotated key in OpenBao is in effect within a minute, without a restart.
3. Health and fallback
Section titled “3. Health and fallback”At boot and every five minutes each server probes the bucket: it writes a two-byte
object under _supacloud/probe/, reads it back, compares it and deletes it.
- While the probe succeeds, new artifacts of every workspace without an override go to the bucket.
- When it fails, new artifacts go to local disk, the server logs an error (at most once
a minute), and the audit log records
artifact.instance_store_unhealthy. The recovery recordsartifact.instance_store_recovered. - Admin › Features shows the bucket as configured and, when the last probe failed, as Unreachable.
The result is shared by the whole fleet: every probe is written to the database and every replica adopts the last one within a minute, so all replicas place new artifacts on the same answer. A transition is audited once, by the replica whose probe changed it.
Existing artifacts are always read from where they were written, so a failed probe never hides a file already in the bucket.
4. Move the files already on local disk
Section titled “4. Move the files already on local disk”Every minute, while the bucket is healthy, each server copies up to 50 local-disk artifacts of the workspaces that use the bucket. For each file it uploads the bytes, reads the object back, re-computes the sha256, and only when the hash matches marks the row as stored in the bucket and deletes the local file. A file that does not read back identically stays on local disk and is counted as failed.
A server copies only the files on its own disk. With several replicas, each one moves its own files; a file not present on a replica is counted as missing there and is not an error.
Follow the progress as an instance admin under Settings › Data & sync › Storage,
or with GET /api/admin/artifact-store/backfill (remaining_rows, remaining_bytes
and the last pass of the replica that answered).
5. What workspaces see
Section titled “5. What workspaces see”Settings › Data & sync › Storage shows every member where new artifacts go, the
stored bytes and this month’s downloads against the plan, the retention and the bytes
per kind. Owners and admins can override the store (local disk, or one of the
workspace’s own s3 Resources), lower a per-kind size cap, and shorten the retention.
An override wins over the instance bucket.


6. Downloads are always attachments
Section titled “6. Downloads are always attachments”Every object of a type a browser could run (HTML, SVG, scripts, documents) is stored
with Content-Disposition: attachment, and every presigned download link signs the
same override into the URL. A link to such a file therefore downloads it; it never
opens as a page on the bucket’s domain.
7. Form limits
Section titled “7. Form limits”A page with a form (see Collect answers on an agent page) saves drafts and accepts responses under rate limits: 30 draft saves a minute per document and person, 20 responses an hour per document and person and 100 an hour per share link, and 20 new guests an hour per share link and client address. These windows are counted in the database, like the row caps (50 responses per person and document, 2000 per document, 2000 drafts per version), so they hold across replicas. A guest is told apart by the client address the server resolves; behind a proxy, set the forwarding posture so it sees the real one.
8. A second hub host without a shared filesystem
Section titled “8. A second hub host without a shared filesystem”A replica on another host reads nothing from the first host’s disk. Configure, on every replica:
SUPACLOUD_APP_UPLOAD_S3_BUCKET— a second bucket on the same endpoint and key pair for App form uploads, binary App files and App build artifacts. Their rows then hold an object key (app-uploads/<workspace>/<run>/<file>), never a host path, and existing local App blobs are copied by the same minute-by-minute backfill (each host copies its own). Unset, App blobs stay onSUPACLOUD_APP_UPLOAD_ROOTand only one host can serve them.
On a fleet, an interrupted generic upload stores an immutable prefix generation under
_supacloud/staging/. A workspace-scoped database pointer acknowledges its exact length
and object identity only after storage confirms the PUT. Another replica uses that same
pointer and checks storage before reporting or resuming its offset. A failed PUT, HEAD
or cancelled request cannot overwrite the acknowledged generation or turn an unreadable
prefix into offset zero. The complete file still passes its size and whole-file hash
checks before publication. An external attempt keeps its existing durable writer-session
and physical-debt authority.
Keep existing mutable staging mirrors and host-only prefixes for exact migration before enabling another replica. Their names and local lengths do not prove a shared committed offset; fleet ingress refuses an unqualified legacy prefix instead of adopting or discarding it. A single host keeps its local resume behavior.
Generic requests claim a durable exact writer nonce in a short transaction, leaving
pool connections free while the body or storage is awaited. Ordinary cancellation
releases only that nonce; delayed older writes cannot publish after its release. A
process crash keeps its nonce and refuses retries without a timeout takeover. Recovery
first inspects the exact workspace/scope/hash authority row read-only with
GET /api/operator/v1/artifact-staging?workspace_id=…&scope_id=…&sha256=… and freshly
checks the pointed object’s identity and length. Only after proving the original process
and request quiescent may the operator release the recorded exact nonce with
POST /api/operator/v1/artifact-staging/release (workspace_id, scope_id, sha256,
the nonce the inspection returned and a reason). A nonce that no longer owns the
authority answers 409 and changes nothing; every release decision is audited as
operator.artifact_staging.release. That release changes no pointer, object, quota or
debt and does not itself prove resumability. Cleanup detaches
an exact pointer only after known final publication or proved expiry, before deleting its
immutable object. A refused hash keeps the acknowledged predecessor.
Two uploads of the same bytes in one workspace share one physical-effect custody. The
second waits up to 20 seconds for the first to settle and then reuses its stored object
instead of storing it twice. A busy attempt changes nothing, so the wait never adopts a
retained crash nonce; after 20 seconds the upload answers the retryable
artifact_staging_busy refusal. An answer screenshot whose storage exceeds its
60-second deadline answers the retryable artifact_staging_store_unavailable refusal
while the storage itself runs to completion and releases its own custody; its unlinked
private copy is reclaimed with the abandoned upload reservation.
Add NO lifecycle rule for this prefix: B2 refuses overlapping prefix rules, and the
bucket keeps only the hidden-version purge above. Every hour ONE replica continues a
durable raw-key cursor, at most ten pages per tick. Protected, unknown and unreadable-age
keys do not prevent later pages from being visited. Expiry reads current object identity
and age under the same writer custody before deleting a prefix older than two days.
Active sessions, recent generic activity, open attempt debt and unqualified names are
retained. An unknown attempt DELETE retains its durable nonce for exact reconciliation;
no timeout takes it over. Cleanup failures produce typed warning counts rather than a
successful deletion count. The bucket key needs listFiles for this sweep.
LIST responses are bounded, fully framed XML documents. Numeric and named references preserve the exact decoded key, including whitespace and Unicode. Missing or malformed truncation fields and malformed pages fail without clearing the last durable cursor; unreadable ages advance pagination but never qualify an object for deletion.
The hourly local-file sweep also claims the exact durable custody before checking age
and unlinking a regular, non-reparse file. Active or unknown sessions, unsettled attempt
debt, legacy names and failed authority reads retain their bytes. A local copy of the
acknowledged generation needs fresh matching remote length and ETag before removal.
The artifact RPC maps temporary staging custody/store failures to bounded-retry
Aborted/Unavailable; quota, invalid bytes and assignment fences keep their terminal
policy. A quarantined crash nonce stays quarantined when that retry budget is exhausted.
With SUPACLOUD_HUB_REPLICAS above 1 an unhealthy bucket no longer sends new artifacts to
local disk: the write is refused with a retryable error until the bucket recovers, and an
upload reports and resumes its offset only from qualified shared staging. One replica
keeps the local fallback.
Visual-verify captures are read from the artifact store (the capture step uploads its manifest), so the signed capture links and the chat previews work on every replica.
Verify
Section titled “Verify”- Restart the server and open Admin › Features: Instance artifact bucket is available and not marked unreachable.
- Let an agent store a file (
artifact.put) in a workspace without an override. - Open Settings › Data & sync › Storage in that workspace: new artifacts go to Instance bucket, and the file’s kind shows up in the table.
- List the bucket: the object sits under
<workspace id>/<two hex>/<sha256>.