supabase
by VastIO B.V.
Supabase is the Postgres development platform.
About this chart
Supabase Helm 3
Community Charts, VastIO Helm Repository
These are the official community Helm charts for Supabase.
The charts are sourced from GitHub, where you can find their original documentation and more details about the project.
This repository automatically syncs the charts daily at 1 AM CET, ensuring they are up to date.
No changes are made to the original charts, except appending this header for clarity.
Supabase for Kubernetes with Helm
This directory contains the configurations and scripts required to run Supabase inside a Kubernetes cluster.
Disclamer
We use supabase/postgres to create and manage the Postgres database. This permit you to use replication if needed but you'll have to use the Postgres image provided Supabase or build your own on top of it. You can also choose to use other databases provider like StackGres or Postgres Operator.
For the moment we are using a root container to permit the installation of the missing pgjwt and wal2json extension inside the initdbScripts. This is considered a security issue, but you can use your own Postgres image instead with the extension already installed to prevent this. We provide an example of Dockerfilefor this purpose, you can use ours or build and host it on your own.
The database configuration we provide is an example using only one master. If you want to go to production, we highly recommend you to use a replicated database.
Usage example
For this section we're using Minikube and Docker to create a Kubernetes cluster
-
Create a cluster with Minikube:
minikube start --driver=docker minikube addons enable ingress echo "$(minikube ip) supabase.local" | sudo tee -a /etc/hosts > /dev/null -
Add the Supabase Helm repository:
helm repo add supabase https://supabase-community.github.io/supabase-kubernetes -
Install Supabase:
helm install demo supabase/supabase -
The first deployment can take some time to complete (especially auth service). You can view the status of the pods using:
kubectl get pod -l app.kubernetes.io/instance=demo NAME READY STATUS RESTARTS AGE demo-supabase-auth-xxxxxxxxxx-xxxxx 1/1 Running 0 47s demo-supabase-db-0-xxxxxxxxxx-xxxxx 1/1 Running 0 47s demo-supabase-functions-xxxxxxxxxx-xxxxx 1/1 Running 0 47s demo-supabase-imgproxy-xxxxxxxxxx-xxxxx 1/1 Running 0 47s demo-supabase-kong-xxxxxxxxxx-xxxxx 1/1 Running 0 47s demo-supabase-meta-xxxxxxxxxx-xxxxx 1/1 Running 0 47s demo-supabase-realtime-xxxxxxxxxx-xxxxx 1/1 Running 0 47s demo-supabase-rest-xxxxxxxxxx-xxxxx 1/1 Running 0 47s demo-supabase-storage-xxxxxxxxxx-xxxxx 1/1 Running 0 47s demo-supabase-studio-xxxxxxxxxx-xxxxx 1/1 Running 0 47sNote:
analytics(Logflare) andvectorare disabled by default. To enable the Logs section in Studio, set bothdeployment.analytics.enabled=trueanddeployment.vector.enabled=true. -
Open Supabase Studio in your browser: http://supabase.local
Use the default credentials below (for local development only):
- Username:
supabase - Password:
this_password_is_insecure_and_should_be_updated
- Username:
-
Uninstall Supabase example:
helm uninstall demo minikube delete sudo sed -i '/[[:space:]]supabase\.local$/d' /etc/hosts
Customize
You should consider to adjust the following values in values.yaml:
RELEASE_NAME: Name used for helm releaseSTUDIO.EXAMPLE.COMURL to Studio
If you want to use mail, consider to adjust the following values in values.yaml:
SMTP_ADMIN_MAILSMTP_HOSTSMTP_PORTSMTP_SENDER_NAME
JWT Secret
We encourage you to use your own JWT keys by generating a new Kubernetes secret and reference it in values.yaml:
secret:
jwt:
anonKey: <new-anon-jwt>
serviceKey: <new-service-role-jwt>
secret: <jwt-secret>
32 characters long secret can be generated with
openssl rand 64 | base64You can use the JWT Tool to generate anon and service keys.
SMTP Secret
Connection credentials for the SMTP mail server will also be provided via Kubernetes secret referenced in values.yaml:
secret:
smtp:
username: <your-smtp-username>
password: <your-smtp-password>
DB Secret
DB credentials will also be stored in a Kubernetes secret and referenced in values.yaml:
secret:
db:
password: <db-password>
database: <supabase-database-name>
The secret can be created with kubectl via command-line:
If you depend on database providers like StackGres, Postgres Operator or self-hosted Postgres instance, configure
secret.db.host/secret.db.port(or maphost/portfromsecret.db.secretRef) and adjust any additional Postgres attributes (e.g.PGPORT) as needed. Refer to values.yaml for more details.
Dashboard secret
By default, a username and password is required to access the Supabase Studio dashboard. Simply change them at:
secret:
dashboard:
username: supabase
password: this_password_is_insecure_and_should_be_updated
Analytics secret
Analytics/Vector (logs) are disabled by default. To enable the Logs feature in Studio, set both deployment.analytics.enabled=true and deployment.vector.enabled=true.
A new logflare secret API key is required for securing communication between all of the Supabase services. To set the secret, generate a new 32 characters long secret similar to the step above.
secret:
analytics:
publicAccessToken: "your-super-secret-and-long-logflare-key-public"
privateAccessToken: "your-super-secret-and-long-logflare-key-private"
BigQuery secret
When using BigQuery as analytics backend, provide a GCP service account JSON key via secret values:
bigQuery:
enabled: true
secret:
bigquery:
gcloudJson: '{"type":"service_account", ...}'
You can also reference an existing Kubernetes Secret:
secret:
bigquery:
secretRef: my-bigquery-secret
secretRefKey:
gcloudJson: gcloud.json
Autoscaling
Autoscaling is disabled by default. To enable it for a component, set autoscaling.<component>.enabled=true and configure CPU and/or memory requests for that component. Kubernetes HPA utilization metrics require metrics-server and container resources.requests.
deployment:
auth:
resources:
requests:
cpu: 100m
autoscaling:
auth:
enabled: true
minReplicas: 1
maxReplicas: 5
targetCPUUtilizationPercentage: 80
S3 secret
Supabase storage supports the use of S3 object-storage. To enable S3 for Supabase storage:
- Set S3 key ID and access key:
secret:
s3:
keyId: your-s3-key-id
accessKey: your-s3-access-key
- Set storage S3 environment variables:
environment:
auth:
- name: API_EXTERNAL_URL
value: http://supabase.local
- name: GOTRUE_SITE_URL
value: http://supabase.local
- name: GOTRUE_URI_ALLOW_LIST
value: "*"
- name: GOTRUE_EXTERNAL_AZURE_SECRET
valueFrom:
secretKeyRef:
name: azure-secret
key: secret
- (Optional) Enable internal minio deployment
minio:
enabled: true
Environment variables
[!NOTE] Starting with chart version
0.7.1,environment.<component>is an array of Kubernetes env entries instead of a map. Each entry supportsvalue:orvalueFrom:.
Example:
environment:
auth:
- name: GOTRUE_API_HOST
value: "0.0.0.0"
- name: GOTRUE_EXTERNAL_AZURE_SECRET
valueFrom:
secretKeyRef:
name: azure-secret
key: secret
User-provided entries are rendered after the chart defaults, so any chart-managed env var can be overridden by adding an entry with the same name to the component array.
How to use in Production
We didn't provide a complete configuration to go production because of the multiple possibility.
But here are the important points you have to think about:
- Use a replicated version of the Postgres database.
- Add SSL to the Postgres database.
- Add SSL configuration to the ingresses endpoints using either the
cert-manageror a LoadBalancer provider. - Change the domain used in the ingresses endpoints.
- Generate a new secure JWT Secret.
Migration
Migration from local development is made easy by adding migration scripts at db.config field. This will apply all of the migration scripts during the database initialization. For example:
db:
config:
20230101000000_profiles.sql: |
create table profiles (
id uuid references auth.users not null,
updated_at timestamp with time zone,
username text unique,
avatar_url text,
website text,
primary key (id),
unique(username),
constraint username_length check (char_length(username) >= 3)
);
To make copying scripts easier, use this handy bash script:
#!/bin/bash
for file in $1/*; do
clipboard+=" $(basename $file): |\n"
clipboard+=$(cat $file | awk '{print " "$0}')
clipboard+="\n"
done
echo -e "$clipboard"
and pipe it to your system clipboard handler:
# Using xclip as an example
./script.sh supabase/migrations | xclip -sel clipboard
Troubleshooting
Ingress Controller and Ingress Class
Depending on your Kubernetes version you might want to fill the className property instead of the kubernetes.io/ingress.class annotations. For example:
kong:
ingress:
enabled: 'true'
className: "nginx"
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
Testing suite
Before creating a merge request, you can test the charts locally by using helm/chart-testing. If you have Docker and a Kubernetes environment to test with, simply run:
# Run chart-testing (lint)
docker run -it \
--workdir=/data \
--volume $(pwd)/charts/supabase:/data \
quay.io/helmpack/chart-testing:v3.7.1 \
ct lint --validate-maintainers=false --chart-dirs . --charts .
# Run chart-testing (install)
docker run -it \
--network host \
--workdir=/data \
--volume ~/.kube/config:/root/.kube/config:ro \
--volume $(pwd)/charts/supabase:/data \
quay.io/helmpack/chart-testing:v3.7.1 \
ct install --chart-dirs . --charts .
Version compatibility
0.6.x to 0.7.x
This chart version bumps the default Postgres image from 15.8.1.085 to 17.6.1.136 and the initDb image from 15-alpine to 17-alpine.
Warning: Before upgrading, make sure you have a recent backup of your database. Major version upgrades can fail and may require rollback.
Important: We strongly recommend taking a snapshot or backup of the DB PersistentVolumeClaim (PVC) before running the upgrade. The upgrade script modifies the data directory in-place, and a PVC snapshot is the safest way to recover if anything goes wrong.
New installs
New installations automatically use Postgres 17:
helm repo update
helm install demo supabase/supabase
Upgrading an existing Postgres 15 deployment
For existing deployments running Postgres 15, use the scripts/upgrade-pg17.sh helper provided in the chart. This script is the Kubernetes equivalent of the Docker utils/upgrade-pg17.sh and performs an in-place pg_upgrade:
bash scripts/upgrade-pg17.sh -n <namespace> -r <release> [-c <chart-path>] [--yes]
Required flags:
-n, --namespace: Kubernetes namespace where Supabase is deployed-r, --release: Helm release name
Optional flags:
-c, --chart: Path to this Helm chart (auto-detected by default)--yes, -y: Skip confirmation prompts
What the script does:
- Builds a PG 17 upgrade tarball from the Supabase
supabase/postgres:17.6.1.063image - Scales down all Supabase services
- Runs
pg_upgrade(Postgres 15 → 17) inside a temporary PG 15 pod - Runs
complete.shinside a temporary PG 17 pod for post-upgrade patches - Swaps the data directories inside the DB PVC
- Upgrades the Helm release to the PG 17 image (
supabase/postgres:17.6.1.136) - Applies the PG 17 role and extension migrations
- Verifies the final Postgres version and extension list
The original Postgres 15 data is preserved inside the DB PVC as postgres-data.bak.pg15. You can remove it after confirming the upgrade was successful.
Rollback (if needed)
If the upgrade fails before the Helm release is updated, scale the DB StatefulSet back to 1 to resume Postgres 15. If the Helm release was already updated to Postgres 17, use the scripts/rollback-pg15.sh helper to roll back to Postgres 15:
bash scripts/rollback-pg15.sh -n <namespace> -r <release> [-c <chart-path>] [--yes]
Required flags:
-n, --namespace: Kubernetes namespace where Supabase is deployed-r, --release: Helm release name
Optional flags:
-c, --chart: Path to this Helm chart (auto-detected by default)--yes, -y: Skip confirmation prompts
What the script does:
- Scales down all Supabase services belonging t
Deploy supabase with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has supabase on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartsupabase is pinned at v0.7.2 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply