Skip to content

Commit 693cfa8

Browse files
committed
add supabase asciinema demo
1 parent 5c894fc commit 693cfa8

File tree

4 files changed

+1849
-21
lines changed

4 files changed

+1849
-21
lines changed

content/docs/app/supabase.md

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
---
22
title: "Enterprise Self-Hosted Supabase"
33
weight: 555
4-
date: 2024-11-30
5-
description: Self-host enterprise-grade Supabase with Pigsty, featuring monitoring, high availability, PITR, IaC, and 400+ PostgreSQL extensions.
4+
description: Self-host enterprise-grade Supabase with Pigsty, featuring monitoring, high availability, PITR, IaC, and 440+ PostgreSQL extensions.
65
module: [SOFTWARE]
76
categories: [Reference]
87
---
@@ -17,10 +16,10 @@ Pigsty can help you deploy enterprise-grade Supabase on your own servers (physic
1716

1817
## TL;DR
1918

20-
[Prepare](/docs/deploy/prepare) a [Linux](/docs/deploy/prepare) server, follow the Pigsty [standard installation](/docs/setup/install) process with the `supabase` configuration template:
19+
[Prepare](/docs/deploy/prepare) a [**Linux**](/docs/deploy/prepare) server, follow the Pigsty [standard installation](/docs/setup/install) process with the `supabase` configuration template:
2120

2221
```bash
23-
curl -fsSL https://repo.pigsty.io/get | bash; cd ~/pigsty
22+
curl -fsSL https://repo.pigsty.cc/get | bash; cd ~/pigsty
2423
./configure -c supabase # Use supabase config (change credentials in pigsty.yml)
2524
vi pigsty.yml # Edit domain, passwords, keys...
2625
./deploy.yml # Install Pigsty
@@ -32,6 +31,11 @@ After installation, access Supa Studio on port `8000` with username `supabase` a
3231

3332
![](/img/docs/supabase-login.png)
3433

34+
{{< asciinema file="demo/supabase.cast" markers="0:Check,11:Install,43:Config,307:Docker,321:Domain,340:App,350:Verify" theme="solarized-light" speed="1.3" autoplay="true" loop="true" >}}
35+
36+
37+
38+
3539
------
3640

3741
## Table of Contents
@@ -56,7 +60,7 @@ Supabase aims to provide developers with a one-stop backend solution, reducing t
5660
It allows developers to skip most backend development work — **you only need to understand database design and frontend to ship quickly!**
5761
Developers can use vibe coding to create a frontend and database schema to rapidly build complete applications.
5862

59-
Currently, Supabase is the most popular open-source project in the [PostgreSQL ecosystem](https://ossrank.com/cat/368-postgresql-ecosystem), with over [80,000](https://github.com/supabase/supabase/) GitHub stars.
63+
Currently, Supabase is the most popular open-source project in the [PostgreSQL ecosystem](https://ossrank.com/cat/368-postgresql-ecosystem), with over [90,000](https://github.com/supabase/supabase/) GitHub stars.
6064
Supabase also offers a "generous" free tier for small startups — free 500 MB storage, more than enough for storing user tables and analytics data.
6165

6266
------
@@ -65,18 +69,18 @@ Supabase also offers a "generous" free tier for small startups — free 500 MB s
6569

6670
If Supabase cloud is so attractive, why self-host?
6771

68-
The most obvious reason is what we discussed in "[Is Cloud Database an IQ Tax?](https://blog.vonng.com/cloud/rds/)": when your data/compute scale exceeds the cloud computing sweet spot (Supabase: 4C/8G/500MB free storage), costs can explode.
69-
And nowadays, reliable [local enterprise NVMe SSDs](https://blog.vonng.com/cloud/bonus/) have three to four orders of magnitude cost advantage over [cloud storage](https://blog.vonng.com/cloud/ebs/), and self-hosting can better leverage this.
72+
The most obvious reason is what we discussed in "[Is Cloud Database an IQ Tax?](https://vonng.com/cloud/rds/)": when your data/compute scale exceeds the cloud computing sweet spot (Supabase: 4C/8G/500MB free storage), costs can explode.
73+
And nowadays, reliable [local enterprise NVMe SSDs](https://vonng.com/cloud/bonus/) have three to four orders of magnitude cost advantage over [cloud storage](https://vonng.com/cloud/ebs/), and self-hosting can better leverage this.
7074

7175
Another important reason is **functionality** — Supabase cloud features are limited. Many powerful PostgreSQL extensions aren't available in cloud services due to multi-tenant security challenges and licensing.
72-
Despite [extensions being PostgreSQL's core feature](https://blog.vonng.com/pg/pg-eat-db-world), only **64** extensions are available on Supabase cloud.
73-
Self-hosted Supabase with Pigsty provides up to [**437**](https://pgext.cloud/list) ready-to-use PostgreSQL extensions.
76+
Despite [extensions being PostgreSQL's core feature](https://vonng.com/pg/pg-eat-db-world), only **64** extensions are available on Supabase cloud.
77+
Self-hosted Supabase with Pigsty provides up to [**440**](https://pgext.cloud/list) ready-to-use PostgreSQL extensions.
7478

7579
Additionally, self-control and vendor lock-in avoidance are important reasons for self-hosting. Although Supabase aims to provide a vendor-lock-free open-source Google Firebase alternative, self-hosting enterprise-grade Supabase is not trivial.
76-
Supabase includes a series of PostgreSQL extensions they develop and maintain, and plans to replace the native PostgreSQL kernel with [OrioleDB](/docs/pgsql/kernel/orioledb) (which they acquired). These kernels and extensions are not available in the official PGDG repository.
80+
Supabase includes a series of PostgreSQL extensions they develop and maintain, and plans to replace the native PostgreSQL kernel with [**OrioleDB**](/docs/pgsql/kernel/orioledb) (which they acquired). These kernels and extensions are not available in the official PGDG repository.
7781

7882
This is implicit vendor lock-in, preventing users from self-hosting in ways other than the supabase/postgres Docker image. Pigsty provides an open, transparent, and universal solution.
79-
We package all 10 missing Supabase extensions into ready-to-use RPM/DEB packages, ensuring they work on all [major Linux distributions](/docs/deploy/prepare):
83+
We package all 10 missing Supabase extensions into ready-to-use RPM/DEB packages, ensuring they work on all [major Linux distributions](/docs/ref/linux):
8084

8185
| Extension | Description |
8286
|---|---|
@@ -108,7 +112,7 @@ Let's start with single-node Supabase deployment. We'll cover multi-node high av
108112
then run [`docker.yml`](/docs/docker/playbook#dockeryml) and `app.yml` to start stateless Supabase containers (default ports `8000`/`8433`).
109113

110114
```bash
111-
curl -fsSL https://repo.pigsty.io/get | bash; cd ~/pigsty
115+
curl -fsSL https://repo.pigsty.cc/get | bash; cd ~/pigsty
112116
./configure -c supabase # Use supabase config (change credentials in pigsty.yml)
113117
vi pigsty.yml # Edit domain, passwords, keys...
114118
./deploy.yml # Install Pigsty
@@ -119,16 +123,15 @@ vi pigsty.yml # Edit domain, passwords, keys...
119123
Before deploying Supabase, modify the auto-generated `pigsty.yml` configuration file (domain and passwords) according to your needs.
120124
For local development/testing, you can skip this and customize later.
121125

122-
{{< asciinema src="/img/asciinema/supabase.svg" poster="npt:2:24" >}}
123-
124126
If configured correctly, after about ten minutes, you can access the Supabase Studio GUI at `http://<your_ip_address>:8000` on your local network.
125127
Default username and password are `supabase` and `pigsty`.
126128

127129
![](/img/docs/supabase-home.png)
128130

129131
**Notes:**
130132

131-
- In mainland China, Pigsty uses 1Panel and 1ms DockerHub mirrors by default, which may be slow. You can configure your own [proxy](/docs/docker/param#proxy) and [registry mirror](/docs/docker/param#registry), then manually pull images with `cd /opt/supabase; docker compose pull`. We also offer expert consulting services including complete offline installation packages.
133+
- In mainland China, Pigsty uses 1Panel and 1ms DockerHub mirrors by default, which may be slow.
134+
- You can configure your own [proxy](/docs/docker/usage#proxy) and [registry mirror](/docs/docker/usage#registry-mirror), then manually pull images with `cd /opt/supabase; docker compose pull`. We also offer expert consulting services including complete offline installation packages.
132135
- If you need object storage functionality, you must access Supabase via domain and HTTPS, otherwise errors will occur.
133136
- For serious production deployments, **always** change all default passwords!
134137

@@ -147,7 +150,8 @@ However, single-node deployment still has significant advantages over the offici
147150
If you only have one server or choose to self-host on cloud servers, Pigsty recommends using external S3 instead of local MinIO for object storage to hold PostgreSQL backups and Supabase Storage.
148151
This deployment provides a minimum safety net RTO (hour-level recovery time) / RPO (MB-level data loss) disaster recovery in single-node conditions.
149152

150-
For serious production deployments, Pigsty recommends at least 3-4 nodes, ensuring both MinIO and PostgreSQL use enterprise-grade multi-node high availability deployments. You'll need more nodes and disks, adjusting cluster configuration in `pigsty.yml` and Supabase cluster configuration to use high availability endpoints.
153+
For serious production deployments, Pigsty recommends at least 3-4 nodes, ensuring both MinIO and PostgreSQL use enterprise-grade multi-node high availability deployments.
154+
You'll need more nodes and disks, adjusting cluster configuration in `pigsty.yml` and Supabase cluster configuration to use high availability endpoints.
151155

152156
Some Supabase features require sending emails, so SMTP service is needed. Unless purely for internal use, production deployments should use SMTP cloud services. Self-hosted mail servers' emails are often marked as spam.
153157

@@ -171,7 +175,8 @@ For serious production deployments, we strongly recommend changing Pigsty compon
171175
- [`patroni_password`](/docs/pgsql/param/#patroni_password): `Patroni.API`, Patroni HA component password
172176
- [`haproxy_admin_password`](/docs/node/param/#haproxy_admin_password): `pigsty`, Load balancer admin password
173177
- [`minio_secret_key`](/docs/minio/param/#minio_secret_key): `S3User.MinIO`, MinIO root user secret
174-
- Additionally, strongly recommend changing the [PostgreSQL business user](https://github.com/pgsty/pigsty/blob/main/conf/supabase.yml#L68) password for Supabase, default is `DBUser.Supa`
178+
- [`etcd_root_password`](/docs/etcd/param/#etcd_root_password): `Etcd.Root`, ETCD root user password
179+
- Additionally, strongly recommend changing the [PostgreSQL business user](https://github.com/pgsty/pigsty/blob/main/conf/supabase.yml#L72) password for Supabase, default is `DBUser.Supa`
175180

176181
These are Pigsty component passwords. Strongly recommended to set before installation.
177182

@@ -221,7 +226,6 @@ sed -ie 's/supa.pigsty/supa.pigsty.cc/g' ~/pigsty/pigsty.yml
221226
If not configured beforehand, reload Nginx and Supabase configuration:
222227

223228
```bash
224-
make nginx # Reload nginx configuration
225229
make cert # Request certbot free HTTPS certificate
226230
./app.yml # Reload Supabase configuration
227231
```
@@ -231,7 +235,9 @@ The modified configuration should look like:
231235
```yaml
232236
all:
233237
vars:
238+
certbot_sign: true # Use certbot to sign real certificates
234239
infra_portal:
240+
home: i.pigsty.cc # Replace with your domain!
235241
supa:
236242
domain: supa.pigsty.cc # Replace with your domain!
237243
endpoint: "10.10.10.10:8000"
@@ -251,7 +257,6 @@ all:
251257
252258
For complete domain/HTTPS configuration, see [Certificate Management](/docs/infra/admin/cert). You can also use Pigsty's built-in local static resolution and self-signed HTTPS certificates as fallback.
253259
254-
{{< asciinema src="/img/asciinema/supa-domain.svg" poster="npt:2:24" >}}
255260
256261
257262
@@ -261,7 +266,7 @@ For complete domain/HTTPS configuration, see [Certificate Management](/docs/infr
261266
262267
You can use S3 or S3-compatible services for PostgreSQL backups and Supabase object storage. Here we use Alibaba Cloud OSS as an example.
263268
264-
> Pigsty provides a [`terraform/spec/aliyun-meta-s3.tf`](https://github.com/pgsty/pigsty/blob/main/terraform/spec/aliyun-meta-s3.tf) template for provisioning a server and OSS bucket on Alibaba Cloud.
269+
> Pigsty provides a [`terraform/spec/aliyun-s3.tf`](https://github.com/pgsty/pigsty/blob/main/terraform/spec/aliyun-s3.tf) template for provisioning a server and OSS bucket on Alibaba Cloud.
265270

266271
First, modify the S3 configuration in `all.children.supa.vars.apps.[supabase].conf` to point to Alibaba Cloud OSS:
267272

content/docs/conf/supabase.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ Source: [`pigsty/conf/supabase.yml`](https://github.com/pgsty/pigsty/blob/main/c
3737

3838
{{< readfile file="yaml/supabase.yml" code="true" lang="yaml" >}}
3939

40+
--------
41+
42+
## Installation Demo
43+
44+
{{< asciinema file="demo/supabase.cast" markers="0:Check,11:Install,43:Config,307:Docker,321:Domain,340:App,350:Verify" theme="solarized-light" speed="1.3" autoplay="true" loop="true" >}}
45+
4046

4147
--------
4248

content/docs/pgsql/kernel/supabase.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ then access `https://supa.pigsty` through a browser to enter the Supabase Studio
5353

5454
> Default username and password: supabase / pigsty
5555
56-
[![asciicast](https://asciinema.org/a/692194.svg)](https://asciinema.org/a/692194)
56+
{{< asciinema file="demo/supabase.cast" markers="0:Check,11:Install,43:Config,307:Docker,321:Domain,340:App,350:Verify" theme="solarized-light" speed="1.3" autoplay="true" loop="true" >}}
57+
5758

5859

5960
-------

0 commit comments

Comments
 (0)