Fly Postgres,由 Supabase 管理
Fly Postgres, Managed by Supabase

原始链接: https://supabase.com/blog/postgres-on-fly-by-supabase

Fly.io 推出了最新产品 Fly PostgreSQL,这是一个快速且功能齐全的 PostgreSQL 数据库,具有各种扩展功能,例如矢量/AI 工作负载、分支、可观察性和每日备份。 与传统的托管 PostgreSQL 选项不同,Supabase 和 Fly 的集成利用 Fly 基础设施来处理扩展、备份管理、主要版本更新以及开发人员的其他职责。 这种方法提供了比 Amazon Web Services 更快的响应时间,特别是在解决基于网络的约束时。 用户目前可以在正式发布之前通过等候名单注册预览版。 两家公司合作利用 Firecracker 虚拟机在全球范围内分发 Postgres。 然而,Fly 中的网络限制和备份等挑战正在与未来潜在的发展一起解决,包括 Logflare 发送机器日志和 Fly 计划的 blob 存储。 此外,发布的第一周还举办了为期五天的活动,展示 Supabase 的工具和库版本。 最新消息包括 Supabase 库 V2 简介:支持 Python、Swift、Kotlin、Flutter 和 TypeScript。 请访问 www.supabase.com/blog 了解更多信息或联系他们立即启动项目。

Supabase 和 Fly 之间的新合作旨在简化功能齐全的托管 PostgreSQL 服务的使用,同时避免与自我管理基础设施相关的成本,并在可与 Fly 平台一起轻松扩展的环境中实现这一目标。 与替代解决方案不同,Fly.io 根据使用的资源提供可预测的定价,提供完全的价格透明度,而替代解决方案往往具有不透明且高度可变的成本。 两家公司还力求避免其他流行平台遇到的陷阱,包括 Cloudflare Workers,其方法提出了严格的全球分发要求。 最终,这种合作关系旨在为用户提供一个强大且经济实惠的 PostgresQL 环境,以跟上扩展需求。
相关文章

原文

We're launching Fly Postgres, a managed Postgres offering by Supabase and Fly.io.

Fly Postgres databases launch on Fly.io's edge computing platform from any of their 37+ locations. You get everything you expect from a Supabase managed database:

This is deployed within the Fly infrastructure, making it the fastest Postgres database for your data intensive applications deployed on Fly.

Managing expectations

Before you get too excited, this will be a progressive rollout. It turns out that building inter-company integrations is a lot of work when you factor in billing, support handoff, and educating Supabase staff on how to understand sandwich analogies.

We've been working with a few early testers and we have some bugs to iron out. You can sign up for the waitlist if you want to help with testing. We'll accept more testers next month, and we'll communicate more release timelines as soon as we're confident that your data is safe.

Supabase + Fly = SupaFly?

We're excited about what this partnership means for 2024. Namely, distributing Postgres across the planet. The Firecracker VM gives us some neat ideas for Postgres. Integrating with Fly also puts a bunch of easy-to-spin-up compute resources right next to the database. That sounds like fun.

Managed vs unmanaged Postgres

Fly's current Postgres offering is unmanaged. This means that you're responsible for handling scaling, point-in-time backups, replication, major version upgrades, etc. We'll run Fly's managed Postgres, which means that we do all that for you, and you can concentrate on building.

The managed service is built with the Fly extension API (also used by Fly Redis).

Testers can launch a Postgres database using the fly extensions command:


_10

fly extensions supabase create


Once the service is stable, it will be swapped for the postgres namespace:

With Fly Postgres, the database is deployed within Fly infrastructure leading to a much lower latency for data heavy applications.

Under the hood

Let's dig into the implementation.

Working with Fly machines

Fly Postgres is built on top of Fly machines. Machines are light-weight Firecracker VMs. The Machines API offers substantial control over an application's lifecycle. They can be suspended during inactivity and resumed within a couple of seconds whenever a new request arrives.

We built fly-admin, a Typescript wrapper to simplify our interaction with the Fly API. Supabase bundles a few extra services into Postgres, so we prepared a single Docker image which we can pass to the Fly Machines API. Our current build process outputs an AMI for AWS using Packer. We re-use parts of that pipeline to build an All In One Image. This image has all the services to run a Supabase project within a single Docker container.

Move to multi-cloud

With this launch, Supabase is officially multi-cloud. We deliberately avoided using AWS's managed services when building Supabase to simplify our multi-cloud transition. These transitions are never simple - even the base primitives offered between cloud providers can vary significantly.

For example, Fly Machines offer a simple method for suspending a VM when it's not in use, transparently resuming it within seconds. This simplifies the process of pausing inactive databases. There is no direct primitive on AWS to achieve this.

On the other hand, we had to work around a few AWS primitives that Fly doesn't provide. Fly machines don't have network-attached storage, so we treat any data in Fly volumes as ephemeral. We run physical backups for all projects running on Fly using WAL-G. Database changes are continuously streamed to S3. When there is a host or volume corruption, we restore the project to a new Fly host using the latest data in S3.

To capture host issues on AWS, we listen to AWS Health events. For Fly, we send the Machine logs to Logflare using the fly-log-shipper.

In addition to publishing images in AWS's container registry, we publish the All In One image to Fly's Docker registry. This improved the reliability and performance of project launches on Fly.

Building the Fly extension

Fly has an excellent approach for extending their platform. We added a few routes to our API to provision users and projects and we were on our way.

Fly users can access the Supabase dashboard using their existing Fly credentials. The Supabase API initiates an OAuth flow with Fly to authenticate the user. Our Auth team created a Fly OAuth provider to make the integration with our API easier.

Challenges

We're still working through a few challenges with the Fly team.

Support for Network Restrictions

The network restrictions feature relies on the container receiving the correct IP of the client connecting to it. With our current setup, the container sees the Fly proxy IP instead. Connections run through the Fly proxy, which exposes the Proxy protocol. Postgres can't use this information directly, but we're looking at making Supavisor proxy-protocol aware.

Backups within Fly

Fly projects are backed up to AWS S3 as Fly doesn't provide managed Blob storage (yet). This incurs inter-cloud bandwidth fees. Luckily, Fly are working on Blob Storage, watch this space.

Getting started

Sign up for the preview here, wait till we allowlist your org, and get started with the Quickstart in our docs.

Fly organizations will get one free project. We're still working through some of the finer details on billing, but the pricing will remain relatively unchanged from our current pricing.

联系我们 contact @ memedata.com