Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Further improvements to the self-hosting setup

Paul Copplestone86368f815432
diff --git a/docker/.env b/docker/.env
index 4067170fdda..c7c746e393b 100644
--- a/docker/.env
+++ b/docker/.env
@@ -11,6 +11,13 @@ SMTP_PORT=
SMTP_USER=
SMTP_PASS=
+# storage config
+STORAGE_BACKEND=file # file | s3
+STORAGE_S3_BUCKET=supa-storage-testing # name of s3 bucket where you want to store objects
+STORAGE_REGION=us-east-1 # region where your bucket is located
+# STORAGE_AWS_ACCESS_KEY_ID=XXXX # replace-with-your-aws-key and don't commit this to github
+# STORAGE_AWS_SECRET_ACCESS_KEY=XXXX # replace-with-your-aws-key and don't commit this to github
+FILE_SIZE_LIMIT=us-east-1 # region where your bucket is located
# predefined; don't change these unless you know what you're doing
POSTGRES_PORT=5432
diff --git a/docker/README.md b/docker/README.md
index 4b0f64e1546..7879034c363 100644
--- a/docker/README.md
+++ b/docker/README.md
@@ -1,14 +1,12 @@
# Supabase Docker
-You can run Supabase on your local machine or a server using `docker-compose`.
-For a more secure setup to use on a server (e.g. using HTTPS), have a look at the *supabase-traefik* setup.
-
+Run Supabase locally.
## Configuration
-Add your passwords to the .env file.
-For better customization and security, please make sure you read the [self-hosting guide](https://supabase.io/docs/guides/self-hosting#running-supabase).
+Add your passwords to the `.env` file.
+For better customization and security, please read the [self-hosting guide](https://supabase.io/docs/guides/self-hosting#running-supabase).
-## Run via docker-compose
+## Run via `docker-compose`
- Starting all services: `docker-compose up`
- Stopping all services: `docker-compose down`
@@ -30,4 +28,5 @@ Accessing the services directly:
- GoTrue: http://localhost:8000/auth/v1/?apikey=<anon-apikey-from-kong.yml>
- PostgREST: http://localhost:8000/rest/v1/?apikey=<anon-apikey-from-kong.yml>
- Realtime: http://localhost:8000/realtime/v1/?apikey=<anon-apikey-from-kong.yml>
+ - Storage: http://localhost:8000/storage/v1/?apikey=<anon-apikey-from-kong.yml>
- Postgres: http://localhost:5432
\ No newline at end of file
diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
index e0c4af21e53..a569d2f3e9a 100644
--- a/docker/docker-compose.yml
+++ b/docker/docker-compose.yml
@@ -82,19 +82,19 @@ services:
- rest
restart: on-failure
environment:
- ANON_KEY: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzdXBhYmFzZSIsImlhdCI6MTYwMzk2ODgzNCwiZXhwIjoxNjkwNDQzMTM1LCJhdWQiOiIiLCJzdWIiOiIiLCJSb2xlIjoiYW5vbiIsImp0aSI6ImQ1N2ZkMjFlLTNkYjQtNDk3YS1hNGViLTI4ZDY3Yzg2NjEwMiJ9.YySz_BoYxYco0b2aP3iBMt-dVUqC6RpnQiSb4Zt-L-o
- SERVICE_KEY: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzdXBhYmFzZSIsImlhdCI6MTYwMzk2ODgzNCwiZXhwIjoxNjkwNDQzMTM1LCJhdWQiOiIiLCJyb2xlIjoic2VydmljZV9yb2xlIiwianRpIjoiOTk4MzJiYmItNDdhNS00NzJhLTgxMDQtYzY4ZGVjZDQyZDVlIn0._DToQdxDcSLsp3tPpacsxswv0p1KRti0QOTmnbfs5JY
+ ANON_KEY: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzdXBhYmFzZSIsImlhdCI6MTYwMzk2ODgzNCwiZXhwIjoxNjIwNzQyMTM1LCJhdWQiOiIiLCJzdWIiOiIiLCJSb2xlIjoiYW5vbiIsImp0aSI6ImQ1N2ZkMjFlLTNkYjQtNDk3YS1hNGViLTI4ZDY3Yzg2NjEwMiJ9.Uc0w024BLhWjMAAdzMJfkMxaFa82N-6pBxAtEGzrXCQ
+ SERVICE_KEY: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzdXBhYmFzZSIsImlhdCI6MTYwMzk2ODgzNCwiZXhwIjoxNjIwNzQyMTU1LCJhdWQiOiIiLCJzdWIiOiIiLCJSb2xlIjoic2VydmljZV9yb2xlIiwianRpIjoiOTk4MzJiYmItNDdhNS00NzJhLTgxMDQtYzY4ZGVjZDQyZDVlIn0.zQXx74dQyhpkcqZOMxsx961DPsDz4-nWxTLrCAd-ioI
PROJECT_REF: bjwdssmqcnupljrqypxz # can be any random string
POSTGREST_URL: http://rest:3000
PGRST_JWT_SECRET: ${JWT_SECRET}
DATABASE_URL: postgres://postgres:${POSTGRES_PASSWORD}@db:${POSTGRES_PORT}/postgres
PGOPTIONS: "-c search_path=storage"
FILE_SIZE_LIMIT: 52428800
- REGION: us-east-1 # region where your bucket is located
- GLOBAL_S3_BUCKET: supa-storage-testing # name of s3 bucket where you want to store objects
+ REGION: ${STORAGE_REGION} # region where your bucket is located
+ GLOBAL_S3_BUCKET: ${STORAGE_S3_BUCKET} # name of s3 bucket where you want to store objects
# AWS_ACCESS_KEY_ID: replace-with-your-aws-key
# AWS_SECRET_ACCESS_KEY: replace-with-your-aws-secret
- STORAGE_BACKEND: file
+ STORAGE_BACKEND: ${STORAGE_BACKEND}
FILE_STORAGE_BACKEND_PATH: /var/data/storage
db:
container_name: supabase-db
diff --git a/docker/supabase-traefik/README.md b/docker/supabase-traefik/README.md
index 37bb549fb02..7c7c5026c22 100644
--- a/docker/supabase-traefik/README.md
+++ b/docker/supabase-traefik/README.md
@@ -1,5 +1,7 @@
# Supabase Docker with Traefik
+Note: this setup is unnofficial. It is supported by the Supabase community only.
+
This guide is covering a self-hosted Supabase setup with [Traefik](https://github.com/traefik/traefik) as a reverse proxy.
Please make sure you read the [self-hosting guide](https://supabase.io/docs/guides/self-hosting#running-supabase).
diff --git a/examples/nextjs-ts-user-management/package.json b/examples/nextjs-ts-user-management/package.json
index 56bd89b0c3b..7e499aa5ebd 100644
--- a/examples/nextjs-ts-user-management/package.json
+++ b/examples/nextjs-ts-user-management/package.json
@@ -1,5 +1,5 @@
{
- "name": "next-storage",
+ "name": "nextjs-ts-user-management",
"version": "0.1.0",
"private": true,
"scripts": {
diff --git a/web/docs/guides/self-hosting.mdx b/web/docs/guides/self-hosting.mdx
index d5d3074e40b..c96cdad0f76 100644
--- a/web/docs/guides/self-hosting.mdx
+++ b/web/docs/guides/self-hosting.mdx
@@ -5,7 +5,7 @@ description: How to use configure and deploy Supabase.
---
Supabase is a [Hosted Platform](https://app.supabase.io), so you don't _have_ to deploy it yourself.
-However, if you _want_ to configure and deploy it yourself, this is also possible.
+However, if you want to configure and deploy it yourself, that's also possible.
## Before you begin
@@ -13,7 +13,7 @@ If you are about to step through this Guide, please record your steps! You can h
missing details and fixing errors.
The self-hosted version of Supabase does not include a UI yet.
-We are working on this in stages, starting with our [UI library](https://github.com/supabase/ui)
+We are working on this in stages, starting with our [UI library](https://github.com/supabase/ui) and with a [WIP PR here](https://github.com/supabase/supabase/pull/2281)
([more context](https://github.com/supabase/supabase/discussions/1001#discussioncomment-558696)).
In the meantime, here are some suggested tools for interacting with your Postgres Database:
@@ -54,40 +54,21 @@ git clone https://github.com/supabase/supabase
cd supabase/docker
```
-### Option 3: Using a shallow clone
-If you use Git version >2.25, you can use a shallow clone to download this folder to your local machine:
-
-```bash
-# 1. Copy an empty repo
-git clone --no-checkout https://github.com/supabase/supabase
-
-# 2. Move into the empty repo
-cd supabase
+## Running Supabase
-# 3. Initialize sparse-checkout
-git sparse-checkout init --cone
+### (Optional) Update secrets
-# 4. Checkout the folder
-git sparse-checkout set docker
-```
+If you are deploying to production, you should update the default [passwords and secrets](https://github.com/supabase/supabase/blob/master/docker/.env).
-## Running Supabase
-
-Now that you have the Docker set up on your local machine, you can start it here by running
+### (Optional) Update API keys
-```bash
-docker-compose up
-```
+If you are deploying to production, you should encode a new `anon` and `service_role` API key and update
+them [here](https://github.com/supabase/supabase/blob/b1e99d2ce1f63ba728230fb53a6de444f60bce1f/docker/dockerfiles/kong/kong.yml#L42).
-**Important**
-Make sure you update the default [passwords and secrets](https://github.com/supabase/supabase/blob/master/docker/.env)
-before running in Production.
-After you have regenerated the JWT secret, you will need to encode a new `anon` and `service_role` API key and update
-them [here](https://github.com/supabase/supabase/blob/b1e99d2ce1f63ba728230fb53a6de444f60bce1f/docker/dockerfiles/kong/kong.yml#L42). For example, using [jsonwebtoken.io](https://www.jsonwebtoken.io/).
+After you have regenerated the JWT secret in the step above, use a JWT generator (for example, using [jsonwebtoken.io](https://www.jsonwebtoken.io/)) to regenerate the API Keys using the payloads below:
-The data you will need to encode includes:
```bash
# anon Payload:
@@ -111,6 +92,14 @@ The data you will need to encode includes:
```
+### Run the Docker set up
+
+Now that you have the Docker set up on your local machine, you can start it here by running
+
+```bash
+docker-compose up
+```
+
## Configuring each service
Supabase is made up of several services. We have prefilled the `docker-compose` file with all the configuration you need to get started.
@@ -122,6 +111,7 @@ Here are a list of environment variables for each service:
- [PostgREST](https://postgrest.org/en/v7.0.0/configuration.html)
- [Realtime](https://github.com/supabase/realtime#server-set-up)
- [GoTrue](https://github.com/supabase/gotrue)
+- [Storage](https://github.com/supabase/storage-api)
- [Kong](https://docs.konghq.com/install/docker/)
### Configuring email
@@ -149,7 +139,7 @@ See the following guides to deploy Docker Compose setup using your preferred too
## One-click deploys
-For some individual tools, we also provide images and deployments into cloud marketplaces:
+For some tools we also provide images and deployments into cloud marketplaces:
### Postgres