You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/docs/app/supabase.md
+25-20Lines changed: 25 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,7 @@
1
1
---
2
2
title: "Enterprise Self-Hosted Supabase"
3
3
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.
6
5
module: [SOFTWARE]
7
6
categories: [Reference]
8
7
---
@@ -17,10 +16,10 @@ Pigsty can help you deploy enterprise-grade Supabase on your own servers (physic
17
16
18
17
## TL;DR
19
18
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:
@@ -56,7 +60,7 @@ Supabase aims to provide developers with a one-stop backend solution, reducing t
56
60
It allows developers to skip most backend development work — **you only need to understand database design and frontend to ship quickly!**
57
61
Developers can use vibe coding to create a frontend and database schema to rapidly build complete applications.
58
62
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.
60
64
Supabase also offers a "generous" free tier for small startups — free 500 MB storage, more than enough for storing user tables and analytics data.
61
65
62
66
------
@@ -65,18 +69,18 @@ Supabase also offers a "generous" free tier for small startups — free 500 MB s
65
69
66
70
If Supabase cloud is so attractive, why self-host?
67
71
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.
70
74
71
75
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.
74
78
75
79
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.
77
81
78
82
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):
80
84
81
85
| Extension | Description |
82
86
|---|---|
@@ -108,7 +112,7 @@ Let's start with single-node Supabase deployment. We'll cover multi-node high av
108
112
then run [`docker.yml`](/docs/docker/playbook#dockeryml) and `app.yml` to start stateless Supabase containers (default ports `8000`/`8433`).
If configured correctly, after about ten minutes, you can access the Supabase Studio GUI at `http://<your_ip_address>:8000` on your local network.
125
127
Default username and password are `supabase` and `pigsty`.
126
128
127
129

128
130
129
131
**Notes:**
130
132
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.
132
135
- If you need object storage functionality, you must access Supabase via domain and HTTPS, otherwise errors will occur.
133
136
- For serious production deployments, **always** change all default passwords!
134
137
@@ -147,7 +150,8 @@ However, single-node deployment still has significant advantages over the offici
147
150
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.
148
151
This deployment provides a minimum safety net RTO (hour-level recovery time) / RPO (MB-level data loss) disaster recovery in single-node conditions.
149
152
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.
151
155
152
156
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.
153
157
@@ -171,7 +175,8 @@ For serious production deployments, we strongly recommend changing Pigsty compon
171
175
-[`patroni_password`](/docs/pgsql/param/#patroni_password): `Patroni.API`, Patroni HA component password
-[`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`
175
180
176
181
These are Pigsty component passwords. Strongly recommended to set before installation.
177
182
@@ -221,7 +226,6 @@ sed -ie 's/supa.pigsty/supa.pigsty.cc/g' ~/pigsty/pigsty.yml
221
226
If not configured beforehand, reload Nginx and Supabase configuration:
222
227
223
228
```bash
224
-
make nginx # Reload nginx configuration
225
229
make cert # Request certbot free HTTPS certificate
226
230
./app.yml # Reload Supabase configuration
227
231
```
@@ -231,7 +235,9 @@ The modified configuration should look like:
231
235
```yaml
232
236
all:
233
237
vars:
238
+
certbot_sign: true # Use certbot to sign real certificates
234
239
infra_portal:
240
+
home: i.pigsty.cc # Replace with your domain!
235
241
supa:
236
242
domain: supa.pigsty.cc # Replace with your domain!
237
243
endpoint: "10.10.10.10:8000"
@@ -251,7 +257,6 @@ all:
251
257
252
258
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.
@@ -261,7 +266,7 @@ For complete domain/HTTPS configuration, see [Certificate Management](/docs/infr
261
266
262
267
You can use S3 or S3-compatible services for PostgreSQL backups and Supabase object storage. Here we use Alibaba Cloud OSS as an example.
263
268
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.
265
270
266
271
First, modify the S3 configuration in `all.children.supa.vars.apps.[supabase].conf` to point to Alibaba Cloud OSS:
0 commit comments