Skip to content

Object storage

Anastro uses object storage for two things: Postgres backups (backup.store) and machine workspaces (filesystem.store). Each is configured as a named [storage.<name>] table. Backups and workspaces must use separate buckets, and no two stores may share overlapping prefixes. (Thread payloads currently stay inline in Postgres; pidurable.payload_store is accepted in config but unused.)

Provider Key fields Best for
r2 account_id, bucket, prefix, credentials, temp_credentials Cloudflare R2
s3 endpoint, region, bucket, prefix, path_style, credentials, sts_role_arn AWS S3 and S3-compatible stores (Garage, SeaweedFS, MinIO)
garage replication Workspaces only: built-in Garage on cluster storage nodes
local path (under /var/lib/anastro-objects/) Single-node clusters only: a directory on the node’s own disk

Any prefix must end with /. For s3, endpoint defaults to AWS for region (default us-east-1), and path_style defaults to true.

[storage.backups]
provider = "r2"
account_id = "a1b2c3d4e5f6"
bucket = "anastro-prod-backups"
prefix = "pg/"
access_key_id = "secret:storage/backups/access_key_id"
secret_access_key = "secret:storage/backups/secret_access_key"
[storage.workspaces]
provider = "r2"
account_id = "a1b2c3d4e5f6"
bucket = "anastro-prod-workspaces"
access_key_id = "secret:storage/workspaces/access_key_id"
secret_access_key = "secret:storage/workspaces/secret_access_key"
temp_credentials = { api_token = "secret:storage/workspaces/cf_api_token", max_ttl = "1h" }

Create two buckets and three tokens:

Token Permission Secrets in secrets.age
Backups Read + write on backups bucket storage/backups/access_key_id, secret_access_key
Workspaces Read + write + delete on workspaces bucket storage/workspaces/access_key_id, secret_access_key
Credential minter Cloudflare API token allowed to mint R2 temporary credentials for the workspaces bucket storage/workspaces/cf_api_token

Consider adding an R2 bucket lock rule on the backups bucket so even a compromised control plane can’t delete recent backups.

A workspaces store on S3 requires sts_role_arn so the control plane can mint read-only host credentials via STS AssumeRole:

[storage.workspaces]
provider = "s3"
endpoint = "https://s3.example.com"
bucket = "anastro-workspaces"
access_key_id = "secret:storage/workspaces/access_key_id"
secret_access_key = "secret:storage/workspaces/secret_access_key"
sts_role_arn = "arn:aws:iam::123456789012:role/anastro-workspaces-read"

You can host workspaces on your cluster’s own disks using nodes with the storage role. Anastro runs Garage and an internal gateway that mints scoped credentials just like R2—no external bucket or tokens to configure.

anastro.toml
[storage.workspaces]
provider = "garage"
replication = 3 # copies per object across storage nodes (default 3)
# nodes/cp1.toml
[node]
roles = ["controlplane", "storage"]
[node.storage]
objects_disk = "/dev/vdb" # formatted automatically if empty
zone = "rack-a" # failure domain (defaults to node name)
capacity = "90%" # share of objects_disk Garage may use
  • Replication: Garage keeps replication copies across distinct storage nodes and zones (with replication = 3, one storage node can be down for upgrades while writes continue). replication cannot exceed your number of storage nodes. Set zone to whatever fails together (e.g. physical host name).
  • Disks: multi-node clusters require objects_disk on every storage node; a single node can fall back to a local directory.
  • Secrets: after adding a garage store, run anastroctl cluster bundle init to generate Garage’s keys, then anastroctl cluster unseal. Storage-only nodes (not in control_plane) only unseal from anastroctl cluster unseal, not from peers.
  • Network: storage nodes talk to each other on TCP 3901 and 3903 within network.private.cidr; all other nodes reach gateways over iroh via local loopback 127.0.0.1:7448.
  • Keep backups external: only workspaces can use garage. Put backups on R2 or S3 so you can recover if the cluster loses its disks.

Once enough storage nodes are up, their gateways join Garage, apply the layout, create the bucket, and log garage is ready in journalctl -u anastro-objects. Verify with:

Terminal window
anastroctl cluster storage test workspaces

Rotate Garage credentials or remove a storage role

Section titled “Rotate Garage credentials or remove a storage role”

Before your first rotation, make sure every node runs a release that supports Garage credential generations (cluster bundle init initializes generation 0 without changing active keys).

Routine rotation:

Terminal window
anastroctl cluster bundle rotate-garage
git add secrets.age && git commit -m 'Rotate Garage credentials'
anastroctl cluster unseal -n <each-storage-node>
anastroctl cluster unseal
anastroctl cluster storage test workspaces

Unseal storage nodes first so control-plane clients never send new credentials to an older gateway, and unseal all storage nodes in one short window since Garage RPC shares a cluster-wide secret. Old S3 keys expire automatically after a 5-minute overlap window, and Garage records a generation floor on disk so replaying an older secrets.age is always rejected (keep your latest secrets.age backed up for recovery).

To remove the storage role from a node without handing it the replacement keys:

  1. Remove "storage" from that node’s file and run anastroctl cluster bundle rotate-garage.
  2. Unseal only the remaining storage nodes (-n), skipping the node being removed.
  3. Apply the removed node’s config within the 5-minute overlap window. It confirms Garage has bounded its old key, stops anastro-objects and Garage, and wipes its local Garage credentials.
  4. Apply the remaining nodes, then run cluster unseal on the removed node for cleanup.
  5. Confirm revoking the superseded garage key in anastro-objects logs and run anastroctl cluster storage test workspaces.

Master bucket credentials never leave the control plane. Workers read workspaces using temporary read-only credentials scoped to a single org’s prefix (roughly matching their lease), and upload each new data pack through a single-object presigned URL. Workers can never overwrite or delete objects—only control-plane garbage collection deletes. Backup credentials go solely to the Postgres primary for WAL-G.

Terminal window
anastroctl cluster storage test backups
anastroctl cluster storage test workspaces -n cp2

Runs an end-to-end probe from the node: put, get, range-get, list, delete, and a clock-skew check (must be within 5 minutes). For workspaces, it also mints a host credential and presigned upload URL and verifies neither can delete, overwrite, or read outside its org prefix. Run this after unsealing secrets.

The Postgres primary also checks every store in use with a single HEAD request every 5 minutes, and raises StoreUnreachable when one doesn’t answer within 10 seconds.

A workspace checkpoint becomes Portable once its data packs reach object storage; before that, it’s local to the host. Moves, worker removal, and writable workstation mounts always wait for a Portable checkpoint—an expired lease alone never discards unuploaded edits.

The schedd leader runs garbage collection on [filesystem.gc] schedule:

[filesystem.gc]
schedule = "daily 04:30" # UTC
grace = "24h" # protects in-flight uploads not yet committed
delete_after = "7d" # delay before deleting unreferenced objects
orphan_retention = "30d" # how long snapshots orphaned by a restore remain adoptable

Objects unique to a deleted workspace disappear after roughly grace + delete_after + 1d. If backups are enabled, keep backup.policy.pitr_window <= delete_after so point-in-time restores never reference deleted workspace data.

User pins, retained thread references, and fork heads protect their snapshots (pinning is serialized with GC so it can’t race deletion). See Keep a machine after archive for machine cleanup rules.

Terminal window
anastroctl cluster fs status # last GC pass and whether GC is waiting on a reindex
anastroctl cluster fs gc # full summary of last pass
anastroctl cluster fs gc --now # run GC immediately and wait

GcStalled fires when no pass has finished for an hour past its scheduled time, or the last pass reported errors.

The agents sidecar also cleans up abandoned rollback branches in Postgres after [pidurable] rolled_back_retention (default 30d), while preserving any history needed by surviving forks.

Rotate the DWFS root key without rewriting any workspace data:

Terminal window
anastroctl cluster bundle rekey --dwfs-root

This updates secrets.age, pushes both the new and previous root keys to control-plane nodes, rewraps all org keys, and drops the old root when done (re-run safely if interrupted, then commit secrets.age). This is independent of cluster bundle rekey --kek, which rotates the cluster secret store’s KEK.

To permanently crypto-shred an org’s workspace data, a human org owner runs:

Terminal window
anastroctl cluster fs org shred <org UUID> --confirm 'shred <org UUID>'

Thread credentials, service accounts, and API keys are refused. Existing encrypted data becomes unreadable immediately (older copies of the key remain in Postgres backups until those backups expire).

To migrate workspaces from one store to another (e.g., local → R2, or R2 → in-cluster Garage), define the new [storage.<name>] store, unseal its secrets, and run:

Terminal window
anastroctl cluster storage migrate workspaces --to workspaces-r2
anastroctl cluster apply
anastroctl cluster storage migrate workspaces --to workspaces-r2

The first migrate copies every object while verifying BLAKE3 hashes (skipping anything already present), updates anastro.toml to point at the new store, and marks the old store read_only = true. After cluster apply, the second migrate catches any objects written during the cutover. Snapshot IDs stay identical.

Backups.