Skip to content

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

storage working with a file system backend

Inian635dab60dcdc
diff --git a/docker/README.md b/docker/README.md
index 041594405a7..4b0f64e1546 100644
--- a/docker/README.md
+++ b/docker/README.md
@@ -3,10 +3,7 @@
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.
-Update the docker-compose file with your valid AWS_SECRET_ACCESS_KEY and AWS_ACCESS_KEY_ID in the storage section. The key must have permissions to `s3:PutObject , s3:GetObject, s3:DeleteObject` in the bucket you have chosen.
-In production, PGRST_JWT_SECRET and derived keys from the JWT secret like ANON_KEY need to be changed to different values.
-
-You can run Supabase on your local machine using `docker-compose`:
+## 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).
@@ -30,9 +27,7 @@ const supabase = createClient(SUPABASE_URL, SUPABASE_KEY)
Accessing the services directly:
- Kong: http://localhost:8000
- - GoTrue: http://localhost:8000/auth/v1/
- - PostgREST: http://localhost:8000/rest/v1/
- - Realtime: http://localhost:8000/realtime/v1/
- - Supabase: http://localhost:8000/storage/v1
-- Postgres: http://localhost:5432
-
+ - 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>
+- Postgres: http://localhost:5432
\ No newline at end of file
diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
index 513e427a129..a8d17f1138f 100644
--- a/docker/docker-compose.yml
+++ b/docker/docker-compose.yml
@@ -17,57 +17,92 @@ services:
- ${AUTH_PORT}
depends_on:
- db
- restart: always
- environment:
- PGRST_DB_URI: postgres://postgres:postgres@db:5432/postgres
- PGRST_DB_SCHEMA: public, storage
- PGRST_DB_ANON_ROLE: postgres
- PGRST_JWT_SECRET: super-secret-jwt-token-with-at-least-32-characters-long
- realtime:
- image: supabase/realtime:latest
- ports:
- - '4000:4000'
- depends_on:
+ environment:
+ GOTRUE_JWT_SECRET: ${JWT_SECRET}
+ GOTRUE_JWT_EXP: 3600
+ GOTRUE_JWT_DEFAULT_GROUP_NAME: authenticated
+ GOTRUE_DB_DRIVER: postgres
+ DB_NAMESPACE: auth
+ API_EXTERNAL_URL: localhost
+ GOTRUE_API_HOST: 0.0.0.0
+ PORT: ${AUTH_PORT}
+
+ GOTRUE_SMTP_HOST: ${SMTP_HOST}
+ GOTRUE_SMTP_PORT: ${SMTP_PORT}
+ GOTRUE_SMTP_USER: ${SMTP_USER}
+ GOTRUE_SMTP_PASS: ${SMTP_PASS}
+
+ GOTRUE_DISABLE_SIGNUP: 'false'
+ GOTRUE_SITE_URL: localhost
+ GOTRUE_MAILER_AUTOCONFIRM: 'true'
+ GOTRUE_LOG_LEVEL: DEBUG
+ GOTRUE_OPERATOR_TOKEN: ${OPERATOR_TOKEN}
+ DATABASE_URL: 'postgres://postgres:${POSTGRES_PASSWORD}@db:${POSTGRES_PORT}/postgres?sslmode=disable'
+
+ rest:
+ container_name: supabase-rest
+ image: postgrest/postgrest:latest
+ ports:
+ - ${REST_PORT}:3000
+ depends_on:
- db
- restart: on-failure
- environment:
- DB_HOST: db
- DB_NAME: postgres
- DB_USER: postgres
- DB_PASSWORD: postgres
- DB_PORT: 5432
- PORT: 4000
- HOSTNAME: localhost
- # Disable JWT Auth locally. The JWT_SECRET will be ignored.
- SECURE_CHANNELS: 'false'
- JWT_SECRET: super-secret-jwt-token-with-at-least-32-characters-long
- storage:
- image: supabase/storage-api:v0.1.4
- ports:
- - '5000:5000'
- depends_on:
+ restart: always
+ environment:
+ PGRST_DB_URI: postgres://postgres:${POSTGRES_PASSWORD}@db:${POSTGRES_PORT}/postgres
+ PGRST_DB_SCHEMA: public, storage
+ PGRST_DB_ANON_ROLE: anon
+ PGRST_JWT_SECRET: ${JWT_SECRET}
+
+ realtime:
+ container_name: supabase-realtime
+ image: supabase/realtime:latest
+ ports:
+ - ${REALTIME_PORT}
+ depends_on:
- db
- - rest
- restart: on-failure
- environment:
- ANON_KEY: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlhdCI6MTYxMzUzMTk4NSwiZXhwIjoxOTI5MTA3OTg1fQ.ReNhHIoXIOa-8tL1DO3e26mJmOTnYuvdgobwIYGzrLQ
- SERVICE_KEY: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoic2VydmljZV9yb2xlIiwiaWF0IjoxNjEzNTMxOTg1LCJleHAiOjE5MjkxMDc5ODV9.FhK1kZdHmWdCIEZELt0QDCw6FIlCS8rVmp4RzaeI2LM
- PROJECT_REF: bjwdssmqcnupljrqypxz # can be any random string
- REGION: us-east-1 # region where your bucket is located
- POSTGREST_URL: http://rest:3000
- GLOBAL_S3_BUCKET: supa-storage-testing # name of s3 bucket where you want to store objects
- PGRST_JWT_SECRET: super-secret-jwt-token-with-at-least-32-characters-long
- DATABASE_URL: postgres://postgres:postgres@db:5432/postgres
- PGOPTIONS: "-c search_path=storage"
- AWS_ACCESS_KEY_ID: replace-with-your-aws-key
- AWS_SECRET_ACCESS_KEY: replace-with-your-aws-secret
- FILE_SIZE_LIMIT: 52428800
- db:
- build:
- context: ./postgres
- ports:
- - 5432:5432
- command:
+ restart: on-failure
+ environment:
+ DB_HOST: db
+ DB_NAME: postgres
+ DB_USER: postgres
+ DB_PASSWORD: ${POSTGRES_PASSWORD}
+ DB_PORT: ${POSTGRES_PORT}
+ PORT: ${REALTIME_PORT}
+ HOSTNAME: localhost
+ # Disable JWT Auth locally. The JWT_SECRET will be ignored.
+ SECURE_CHANNELS: 'false'
+ JWT_SECRET: ${JWT_SECRET}
+
+ storage:
+ image: supabase/storage-api:v0.8.3
+ ports:
+ - '5000:5000'
+ depends_on:
+ - db
+ - rest
+ restart: on-failure
+ environment:
+ ANON_KEY: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzdXBhYmFzZSIsImlhdCI6MTYwMzk2ODgzNCwiZXhwIjoxNjkwNDQzMTM1LCJhdWQiOiIiLCJzdWIiOiIiLCJSb2xlIjoiYW5vbiIsImp0aSI6ImQ1N2ZkMjFlLTNkYjQtNDk3YS1hNGViLTI4ZDY3Yzg2NjEwMiJ9.YySz_BoYxYco0b2aP3iBMt-dVUqC6RpnQiSb4Zt-L-o
+ SERVICE_KEY: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzdXBhYmFzZSIsImlhdCI6MTYwMzk2ODgzNCwiZXhwIjoxNjkwNDQzMTM1LCJhdWQiOiIiLCJyb2xlIjoic2VydmljZV9yb2xlIiwianRpIjoiOTk4MzJiYmItNDdhNS00NzJhLTgxMDQtYzY4ZGVjZDQyZDVlIn0._DToQdxDcSLsp3tPpacsxswv0p1KRti0QOTmnbfs5JY
+ 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
+ # AWS_ACCESS_KEY_ID: replace-with-your-aws-key
+ # AWS_SECRET_ACCESS_KEY: replace-with-your-aws-secret
+ STORAGE_BACKEND: file
+ FILE_STORAGE_BACKEND_PATH: /var/data/storage
+ db:
+ container_name: supabase-db
+ build:
+ context: ./dockerfiles/postgres
+ ports:
+ - ${POSTGRES_PORT}:${POSTGRES_PORT}
+ command:
- postgres
- -c
- wal_level=logical
@@ -75,4 +110,4 @@ services:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
- POSTGRES_PORT: ${POSTGRES_PORT}
+ POSTGRES_PORT: ${POSTGRES_PORT}
\ No newline at end of file
diff --git a/docker/postgres/storage-schema.sql b/docker/dockerfiles/postgres/storage-schema.sql
similarity index 100%
rename from docker/postgres/storage-schema.sql
rename to docker/dockerfiles/postgres/storage-schema.sql