Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Supabase #1923

Merged
merged 1 commit into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions about/pricing.html.markerb
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ We bill for data leaving your app destined for the public internet or for apps o

* Data egress to the Internet, from Machine to edge server to Internet
* Data transfer over private network between regions, from Machine to edge server and edge server to Machine
* Data transfer to some extensions like Supabase or Upstash Redis (excludes Tigris Object Storage)
* Data transfer to some extensions like Upstash Redis (excludes Tigris Object Storage)

The following types of traffic are free:

Expand Down Expand Up @@ -229,7 +229,7 @@ The [Machine price](#compute) and [volume price](#persistent-storage-volumes) fo

## Extensions

Fly.io offers managed services operated by third parties, such as [Tigris Object Storage](/docs/tigris), [Supabase Postgres](/docs/supabase/) and [Upstash Redis](/docs/upstash/redis/).
Fly.io offers managed services operated by third parties, such as [Tigris Object Storage](/docs/tigris) and [Upstash Redis](/docs/upstash/redis/).

When you provision their services, you become their customer, and you pay their list prices via your monthly Fly.io bill. Charges are updated daily in your Fly.io dashboard.

Expand Down
5 changes: 0 additions & 5 deletions blueprints/cell-based.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,6 @@ As mentioned above, backups are crucial. Items to explore:
backups and have your application periodiacally POST copies there.
* [Rsync](https://rsync.samba.org/) is a utility available with Linux
distributions that can be used to efficiently copy changes between Machines.
* Use a traditional database.
[Supabase](https://fly.io/docs/supabase/), for example, supports
[custom
claims](https://github.com/supabase-community/supabase-custom-claims) that
can be used to build a multi-tenancy option for your database.
* Run multiple Machines per cell so that you get the full benefits of
traditional high availability configurations. If you have implemented an
admin web UI, you can automate the deployment of new clusters easily.
4 changes: 1 addition & 3 deletions database-storage-guides.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The solution to persistent data storage is to usually connect your Fly App to a

## Fly Volumes - Disk storage

The Fly Machines in your app provide ephemeral storage, so you get a blank slate on every startup. For persistent storage on Fly.io, use Fly Volumes. You can attach volumes on an app directly, or run a separate database app with volume storage and connect an app to that.
The Fly Machines in your app provide ephemeral storage, so you get a blank slate on every startup. For persistent storage on Fly.io, use Fly Volumes. You can attach volumes on an app directly, or run a separate database app with volume storage and connect an app to that.

- **[Fly Volumes](/docs/volumes/):** A Fly Volume is a slice of NVMe disk storage attached to the server that hosts your Machine. Read the [Fly Volumes overview](/docs/volumes/overview/) to find out if volumes are the best solution for your use case.

Expand All @@ -27,8 +27,6 @@ _Object storage service from our extension partners._

_Managed database services from our extension partners._

- **[Supabase Postgres (public alpha)](/docs/supabase/)** - [Supabase](https://supabase.com/database+external) Postgres is a full-featured and fully-managed Postgres database on Fly.io infrastructure.

- **[Upstash for Redis](/docs/upstash/redis/)** - [Redis](https://redis.io/+external) is an in-memory database commonly used for caching. A managed service by [Upstash](https://upstash.com/+external).

---
Expand Down
2 changes: 0 additions & 2 deletions deep-dive/postgresql.html.markerb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ nav: demo

Fly Postgres is deployed as a separate app, and that app comes initially configured with a single [Fly Postgres](/docs/postgres/) Machine. That's fine for development, but for production you need redundancy and scalability. With a [few commands](/docs/postgres/advanced-guides/high-availability-and-global-replication/) you can create an HA cluster in your primary region and read-only replicas elsewhere.

If you're interested in a managed offering, [Supabase Postgres](/docs/supabase/) is in public alpha.

And there is no lock in here. We have a list of [recommended external providers](/docs/postgres/getting-started/what-you-should-know/#recommended-external-providers), but you're free to host your database literally anywhere.

Before moving on, one last observation on the relational database. While you want and need your application to be on the internet, you are much better off if your relational database is NOT directly exposed to the internet, but can only be accessed via your application. That’s the value of an [internal private network](/docs/networking/private-networking/). The private connection from the demo app to the Postgres app was configured automatically for you.
96 changes: 0 additions & 96 deletions js/frameworks/nextjs.html.markerb
Original file line number Diff line number Diff line change
Expand Up @@ -141,102 +141,6 @@ our [Vanilla with Candy Sprinkles](https://fly.io/blog/vanilla-candy-sprinkles/)
blog entry and select the configuration that most closely matches your
application. If you still have questions, post on our [community forum](https://community.fly.io/).

### Connecting to Supabase Postgres

[Supabase](https://fly.io/docs/supabase/#create-and-manage-a-supabase-postgres-database) is a managed Postgres service deployed at Fly.io infrastructure.

You can create a Supabase Postgres instance at Fly.io and use the provided `DATABASE_URL`
as described above. Alternatively, you can connect with a dedicated JavaScript client and leverage its API. In this section we'll help you to get started with such setup.

Start off with provisioning a Supabase project:

<aside class="callout">Running the following command in a Fly.io app context -- inside an app directory or specifying `-a yourapp` -- will automatically pick a region and set secrets on your app.</aside>

```cmd
flyctl ext supabase create
```
```output
? Choose a name, use the default, or leave blank to generate one: hello-nextjs-db
? Choose the primary region (can't be changed later) Warsaw, Poland (waw)

Your Supabase database (hello-nextjs-db) in waw is ready. See details and next steps with: https://fly.io/docs/supabase/

Setting the following secrets on hello-nextjs:
DATABASE_POOLER_URL
DATABASE_URL

...

-------
✔ [1/2] Machine 1781344b935d38 [app] update succeeded
✔ [2/2] Machine e82de57a07e528 [app] update succeeded
-------
```

Next, go to the Supabase Dashboard (`fly ext supabase dashboard`) and copy the _Project URL_ and _API Key_ into an `.env` file in the root of the project:

```env
SUPABASE_URL=<PROJECT URL>
SUPABASE_ANON_KEY=<API KEY>
```

Finally, install the [supabase.js](https://www.npmjs.com/package/@supabase/supabase-js) `npm install @supabase/supabase-js`.

With the above setup in place, let's create a simple to-do list on a new page `app/todos/page.tsx` (we'll add some items to the database later):

```jsx
import { createClient } from '@supabase/supabase-js'

const supabaseUrl = process.env.SUPABASE_URL ?? ''
const supabaseKey = process.env.SUPABASE_ANON_KEY ?? ''

export default async function Page() {
const supabase = createClient(supabaseUrl, supabaseKey)
const { data: todos } = await supabase.from('todos').select()

return (
<ul>
{todos?.map((todo) => (
<li key={todo.id}>
{todo.title}
</li>
))}
</ul>
)
}
```

If you try to run your app locally (`npm run dev`) and visit `http://localhost:3000/todos`, you'll get an empty page. That's totally expected since we need to create the table and fill it in with some data!
To do that, return to the Supabase dashboard (`fly ext supabase dashboard`), navigate to _SQL Editor_, and create a table named `todo` and insert some sample tasks:

```sql
-- Create the table
create table todos (
id serial primary key,
title text
);

-- Insert some sample data
insert into todos (title)
values
('Create a Supabase project'),
('Configure the Next.js project to use Supabase'),
('Deploy to Fly.io');
```

And that's it! You should see your to-do items served locally at `http://localhost:3000/todos` from Supabase as well as when you redeploy the app to Fly.io with `fly deploy`.

<aside class="callout">This is the basic setup that to get you started and connect your Next.js app to a Fly.io-hosted Supabase Postgres. For more comprehensive guide look at [Supabase Frameworks Quickstarts](https://supabase.com/docs/guides/getting-started/quickstarts/nextjs).</aside>

## Static site generation with databases

Some applications may require database access at build time. By default, the build Machine on Fly.io does not have access to your production
database. This means you won't be able to access your database from
inside methods like `getStaticProps`.

Should this be something your application requires, there are two approaches for addressing this: **build time secrets** and
**deferring the static site generation** until after deployment.

### Build time secrets

This approach allows you to inject secrets (such as database URLs) that are only available at build time.
Expand Down
3 changes: 1 addition & 2 deletions partials/_firecracker_nav.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
{ text: "Tigris Object Storage", path: "/docs/tigris/" },
{ text: "Fly Postgres", path: "/docs/postgres/" },
{ text: "SQLite & LiteFS", path: "/docs/litefs/" },
{ text: "Supabase Postgres", path: "/docs/supabase/" },
{ text: "Upstash for Redis®", path: "/docs/upstash/redis/" },
{ text: "Upstash Kafka", path: "/docs/upstash/kafka/" },
{ text: "Upstash Vector", path: "/docs/upstash/vector/" }
Expand Down Expand Up @@ -184,7 +183,7 @@
{ text: "Machine Migration", path: "/docs/reference/machine-migration/" },
{ text: "Multiple Processes in Apps", path: "/docs/app-guides/multiple-processes/" },
{ text: "Fly Proxy", path: "/docs/reference/fly-proxy/" },
{ text: "Fly Proxy Autostop/Autostart", path: "/docs/reference/fly-proxy-autostop-autostart/" },
{ text: "Fly Proxy Autostop/Autostart", path: "/docs/reference/fly-proxy-autostop-autostart/" },
{ text: "Regions", path: "/docs/reference/regions/" }
]
},
Expand Down
6 changes: 3 additions & 3 deletions postgres/getting-started/what-you-should-know.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ Deploying a Fly Postgres database means you may need to manage the following:
- **Monitoring & alerts** - Fly.io collects and exposes relevant Prometheus metrics, but you'll have to configure your own monitoring and alerts to keep tabs on the performance and resource utilization of your database instances.
- **Recovering from outages** - If the volume in your database fills up, a replica fails, etc. you'll have to do a little bit of work to bring your database back to health.
- **Global replication** - You can add read-only replicas outside the primary region to [speed up read-heavy globally distributed apps](https://fly.io/blog/globally-distributed-postgres/), by scaling your Fly Postgres app. It's up to you to tweak your application to get writes to the leader instance, but the [Fly-Replay header](https://fly.io/docs/reference/fly-replay/) simplifies that.
- **Configuration Tuning** - You may need to tune your Postgres configuration to match your application's needs.
- **Configuration Tuning** - You may need to tune your Postgres configuration to match your application's needs.
There are a lot of knobs to turn, but `fly pg config` only supports a few of them out of the box. For more details, see [Postgres Configuration Tuning](https://fly.io/docs/postgres/managing/configuration-tuning/).
- **Advanced customization** - TimescaleDB is included in the default image and can be enabled with these [instructions](https://fly.io/docs/postgres/managing/enabling-timescale/). If your application demands additional Postgres extensions or something else in the VM, you can [fork and maintain your own branch of Fly's open source Postgres Flex app](https://github.com/fly-apps/postgres-flex).
- **Advanced customization** - TimescaleDB is included in the default image and can be enabled with these [instructions](https://fly.io/docs/postgres/managing/enabling-timescale/). If your application demands additional Postgres extensions or something else in the VM, you can [fork and maintain your own branch of Fly's open source Postgres Flex app](https://github.com/fly-apps/postgres-flex).

### Recommended External Providers

Expand All @@ -41,7 +41,7 @@ If you want a fully managed database solution for your Fly Apps, there are many
- [Crunchy Bridge Managed Postgres](https://www.crunchydata.com/products/crunchy-bridge+external) (on AWS, Azure, GCP, or Heroku)
- [Neon Serverless Postgres](https://neon.tech/+external)
- [PlanetScale Serverless MySQL](https://planetscale.com/+external) ([guide to use with Fly Apps](https://fly.io/docs/app-guides/planetscale/))
- [Supabase Postgres](https://supabase.com/database+external)
- [Supabase Postgres](https://supabase.com/)

### Other Places

Expand Down
100 changes: 3 additions & 97 deletions supabase/index.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,102 +6,8 @@ nav: firecracker
redirect_from: /docs/reference/supabase/
---

[Supabase](https://supabase.com) offers managed Postgres databases on Fly.io infrastructure. Provisioning Supabase on Fly.io ensures low-latency database access from applications hosted on Fly.io.

<aside class="callout">
This service is in **public alpha**. Here's what you should know.

Supabase Databases run on single machines and are susceptible to hardware issues. Restoring an affected database may require contacting support.

During the alpha, you won't be charged for usage, but your usage will show up as a preview on your Fly.io bill.

Most Supabase features besides raw Postgres are not enabled yet, such as [auth](https://supabase.com/docs/guides/auth) or [storage](https://supabase.com/docs/guides/storage).

Supabase's connection pooler runs on AWS infrastructure, so using it may add connection latency depending on your region's [proximity to AWS servers](https://rtt.fly.dev/).
</aside>

## Create and manage a Supabase Postgres database

Creating and managing databases happens exclusively via the [Fly CLI](/docs/flyctl/install/). Install it, then [signup for a Fly account](/docs/getting-started/sign-up-sign-in/).

<aside class="callout">Running the following command in a Fly.io app context -- inside an app directory or specifying `-a yourapp` -- will automatically pick a region and set secrets on your app.</aside>

```cmd
flyctl ext supabase create
```
```output
? Select Organization: soupedup (soupedup)
? Choose a name, use the default, or leave blank to generate one:
? Choose the primary region (can't be changed later) Miami, Florida (US) (mia)
Your Supabase database (icy-wind-1879) in mia is ready.
Set one or more of the following secrets on your target app.
DATABASE_URL: postgres://postgres:password@db.kworhjwentroqhegh.supabase.co:5432/postgres?sslmode=disable
DATABASE_POOLER_URL: postgres://postgres.kworhjwentroqhegh@password@fly-0-mia.pooler.supabase.com:6543/postgres
```

`DATABASE_URL` offers a direct IPv6 connection to your database. Use this URL from your Fly.io applications.

`DATABASE_POOLER_URL` runs connections through a connection pooler. Currently, the connection pooler runs outside of Fly.io and may introduce connection latency. Use this URL to test connection pooling behavior, or to connect from locations that don't support IPv6, like many household ISPs.

## Pricing and Billing

<aside class="callout">
To test more than one database, or to test Supabase addons, you must upgrade your Supabase organization to the Supabase Pro Plan. Use `flyctl ext supabase dashboard --org yourorg` to sign in and upgrade.
</aside>

Supabase offers one free, resource-limited database per Fly.io user. After that, all databases are billed on pay-as-you-go basis under the [Supabase Pro plan](https://supabase.com/pricing#compare-plans). Check the official [Supabase Pricing](https://supabase.com/pricing) page for details.

While you won't be charged during alpha, database usage and Supabase plan fees will show up on your monthly Fly.io bill. You can track database usage details in the [Supabase web console](#the-supabase-web-console).


### The Supabase web console

To view more details about database usage, connection strings, and more, use:

```cmd
flyctl ext supabase dashboard <database_name>
```

Or, visit your organization-level overview for billing and organization settings:

```cmd
flyctl ext supabase dashboard --org <org_name>
```

### List your databases and view status
Get a list of all of your Supabase databases.

```cmd
flyctl ext supabase list
```
```output
NAME ORG PRIMARY REGION
js-supabase-staging-db fly-ephemeral mad
late-surf-5384 fly-ephemeral mad
```

Note the database name, then fetch its status.

```cmd
fly ext supabase status late-surf-5384
```
```output
Status
Name = late-surf-5384
Primary Region = mia
Status = created
```

### Delete a Supabase database

Deleting can't be undone. Be careful!
[Supabase](https://supabase.com) Managed Postgres on Fly.io infrastructure is no longer available. If you're interested in using Supabase Postgres, please see [their official documentation](https://supabase.com/).

```cmd
fly ext supabase destroy wispy-resonance-270
```
```output
Destroying a Supabase database is not reversible.
? Destroy Supabase database wispy-resonance-270? Yes
Your Supabase database wispy-resonance-270 was destroyed
```
Existing databases will continue to work and be supported by Supabase.
</aside>