Fly.ioExplainer
How We Built Fly Postgres
Summary
Fly.io describes how it built Fly Postgres as an automated database app rather than a managed database service. After initially resisting durable storage and database work, the company added attached disk storage and designed a deployable Postgres application with convenience commands, using Postgres streaming replication, Stolon, and Consul to support high availability. A two-node cluster can designate a writable leader and asynchronous standby, while Stolon’s sentinels, keepers, and proxies coordinate state, elect a replacement leader, and route connections; Consul introduces an additional failure mode. Backups use point-in-time, block-level snapshots of the volume, a platform capability that can also support other file-system databases. The post concludes that automated Postgres serves many apps, while managed database partnerships may suit users seeking a simpler experience.
Context
Fly.io began as a platform for edge applications without durable storage, expecting applications to use off-platform databases. As customers wanted complete applications on Fly.io and the appeal of maintaining a stateless platform diminished, the company needed a way to support reliable database workloads without replicating a managed service such as RDS.
Approach / What changed
Fly.io built a deployable Postgres application around persistent volumes, asynchronous streaming replication, Stolon, and Consul. Stolon uses sentinels, keepers, and proxies to manage cluster state, promote a replica, and route connections, while convenience commands automate deployment and management. Database recovery uses point-in-time block-level volume snapshots restored onto new block devices.
Takeaways
Fly Postgres is an automated application customers deploy on Fly.io, not a fully managed database service.
Stolon’s sentinels, keepers, and proxies use Consul to coordinate leader election, replica management, and routing to the healthy leader.
Point-in-time snapshots of raw volume block devices provide Postgres restores and can generalize to other file-system-based databases.
Source and freshness
- Source
- fly.io
- Published
- Added to Yomu
- Last updated
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.