← All posts

Providing object storage with Garage

Several of the applications I run can store data through an S3-compatible interface: an API for storing and fetching named objects in containers called buckets. That gives them a way to upload and retrieve objects without needing a shared filesystem mounted into every process.

Garage provides that interface inside Zebra, my Kubernetes cluster. It lets me supply object storage on infrastructure I operate, rather than adding a managed storage account for each application that expects S3.

The compatibility is useful because the applications already know how to speak that protocol. This is the sort of decision I describe in the zen of self-hosting: the interface saves integration work, but running it adds responsibility for another service. It still needs checking against the operations each application uses; an S3-compatible service should not be assumed to implement every feature of another provider.

Giving applications somewhere to write

Garage is used for application objects and database backups. The GitLab setup, for example, has several kinds of data outside its repositories. Object storage provides a common place for those components to put their files.

The tenant setup also provisions a bucket and restricted credentials for each tenant. That gives family and friends a storage option for their own applications without handing them administration of the object store. Quotas help keep one person's use within the capacity available to everyone.

This endpoint is intended for cluster workloads. An application can retrieve objects server-side and serve them through its own authorised interface. A browser outside the cluster cannot use a private endpoint merely because the application generated a link to it.

Application or database backup
             |
             v
       Garage S3 interface
          /          \
     metadata      object blocks
     NAS SSD       NAS HDD
          \          /
           same NAS

The two storage tiers still share the NAS and its physical location.

Understanding the storage underneath

Garage's data ultimately lives on TrueNAS, my network-attached storage server (NAS). The current layout separates metadata onto solid-state drives (SSDs) and object blocks onto hard disks (HDDs). Metadata describes the stored objects; blocks hold their contents. The SSD tier suits the metadata work, while HDD capacity serves the larger object collection. This lets me spend the faster storage where it helps rather than putting every object on SSD. It also makes the relationship between the volumes important during recovery.

S3 is the interface applications use to reach Garage, not another physical disk tier. Choosing it depends on what an application supports. A PostgreSQL instance can use local SSD for its working database and send backups to Garage; the live database and its recovery copies have different storage requirements.

This deployment is not highly available. Rescheduling or restarting its single Garage instance causes downtime, and the NAS remains a shared failure boundary. The software's support for distributed deployments does not make this particular installation distributed.

That is a trade-off to consider before placing more applications on it. A managed object store could remove some operational work; running Garage gives me more control over the service and its data location, with the availability responsibility left to me.

Recovering stored objects

A bucket containing database backups is useful only if I can still reach or recover it after the failure I am preparing for. Keeping those backups in Garage on the same storage platform creates a dependency that needs an independent recovery path.

Garage also needs its metadata and node identity as well as object blocks. With the split-volume layout, independently successful snapshots do not establish a compatible recovery pair. The Backblaze backup work includes unresolved coordinated-recovery checks, so I cannot describe the entire path as proven.

Platform database backups now use namespace-scoped buckets and non-owner credentials, rather than assuming one account-wide key is appropriate everywhere. That limits some access, but a separate bucket is not an independent copy and scoped write access does not prove immutable retention. I still need to validate deletion protection and off-site recovery against the data-failure scenarios.

Garage is useful because several of my applications already know how to talk to it. I can give them storage without another provider account, while keeping access and capacity bounded. That leaves me with the NAS dependency and the recovery work described here. If you only need a small bucket somewhere, a managed service may be the less demanding choice.

← Back to the notebook