The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore: refactor docker-compose.yml unify syntax style (#32668)
RampantDespaird1bf79838a9b
diff --git a/docker/.env.example b/docker/.env.exampleindex 1e773721541..bb74500874d 100644--- a/docker/.env.example+++ b/docker/.env.example@@ -9,6 +9,9 @@ ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJhbm9uIiwKICSERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJzZXJ2aWNlX3JvbGUiLAogICAgImlzcyI6ICJzdXBhYmFzZS1kZW1vIiwKICAgICJpYXQiOiAxNjQxNzY5MjAwLAogICAgImV4cCI6IDE3OTk1MzU2MDAKfQ.DaYlNEoUrrEn2Ig7tqibS-PHK5vgusbcbo7X36XVt4QDASHBOARD_USERNAME=supabaseDASHBOARD_PASSWORD=this_password_is_insecure_and_should_be_updated+SECRET_KEY_BASE=UpNVntn3cDxHJpq99YMc1T1AQgQpc8kfYTuRgBiYa15BLrx8etQoXz3gZv1/u2oq+VAULT_ENC_KEY=your-encryption-key-32-chars-min+############# Database - You can change these to any PostgreSQL database that has logical replication enabled.@@ -19,6 +22,7 @@ POSTGRES_DB=postgresPOSTGRES_PORT=5432# default user is postgres+############# Supavisor -- Database pooler############@@ -93,12 +97,14 @@ IMGPROXY_ENABLE_WEBP_DETECTION=true# Add your OpenAI API key to enable SQL Editor AssistantOPENAI_API_KEY=+############# Functions - Configuration for Functions############# NOTE: VERIFY_JWT applies to all functions. Per-function VERIFY_JWT is not supported yet.FUNCTIONS_VERIFY_JWT=false+############# Logs - Configuration for Logflare# Please refer to https://supabase.com/docs/reference/self-hosting-analytics/introductiondiff --git a/docker/docker-compose.yml b/docker/docker-compose.ymlindex 5496e5a38d5..d3ca3d1b1d8 100644--- a/docker/docker-compose.yml+++ b/docker/docker-compose.yml@@ -8,6 +8,7 @@name: supabaseservices:+studio:container_name: supabase-studioimage: supabase/studio:20250113-83c9420@@ -52,11 +53,12 @@ services:container_name: supabase-kongimage: kong:2.8.1restart: unless-stopped- # https://unix.stackexchange.com/a/294837- entrypoint: bash -c 'eval "echo \"$$(cat ~/temp.yml)\"" > ~/kong.yml && /docker-entrypoint.sh kong docker-start'ports:- ${KONG_HTTP_PORT}:8000/tcp- ${KONG_HTTPS_PORT}:8443/tcp+ volumes:+ # https://github.com/supabase/supabase/issues/12661+ - ./volumes/api/kong.yml:/home/kong/temp.yml:rodepends_on:analytics:condition: service_healthy@@ -72,19 +74,13 @@ services:SUPABASE_SERVICE_KEY: ${SERVICE_ROLE_KEY}DASHBOARD_USERNAME: ${DASHBOARD_USERNAME}DASHBOARD_PASSWORD: ${DASHBOARD_PASSWORD}- volumes:- # https://github.com/supabase/supabase/issues/12661- - ./volumes/api/kong.yml:/home/kong/temp.yml:ro+ # https://unix.stackexchange.com/a/294837+ entrypoint: bash -c 'eval "echo \"$$(cat ~/temp.yml)\"" > ~/kong.yml && /docker-entrypoint.sh kong docker-start'auth:container_name: supabase-authimage: supabase/gotrue:v2.167.0- depends_on:- db:- # Disable this if you are using an external Postgres database- condition: service_healthy- analytics:- condition: service_healthy+ restart: unless-stoppedhealthcheck:test:[@@ -98,7 +94,12 @@ services:timeout: 5sinterval: 5sretries: 3- restart: unless-stopped+ depends_on:+ db:+ # Disable this if you are using an external Postgres database+ condition: service_healthy+ analytics:+ condition: service_healthyenvironment:GOTRUE_API_HOST: 0.0.0.0GOTRUE_API_PORT: 9999@@ -162,13 +163,13 @@ services:rest:container_name: supabase-restimage: postgrest/postgrest:v12.2.0+ restart: unless-stoppeddepends_on:db:# Disable this if you are using an external Postgres databasecondition: service_healthyanalytics:condition: service_healthy- restart: unless-stoppedenvironment:PGRST_DB_URI: postgres://authenticator:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}PGRST_DB_SCHEMAS: ${PGRST_DB_SCHEMAS}@@ -177,12 +178,16 @@ services:PGRST_DB_USE_LEGACY_GUCS: "false"PGRST_APP_SETTINGS_JWT_SECRET: ${JWT_SECRET}PGRST_APP_SETTINGS_JWT_EXP: ${JWT_EXPIRY}- command: "postgrest"+ command:+ [+ "postgrest"+ ]realtime:# This container name looks inconsistent but is correct because realtime constructs tenant id by parsing the subdomaincontainer_name: realtime-dev.supabase-realtimeimage: supabase/realtime:v2.33.70+ restart: unless-stoppeddepends_on:db:# Disable this if you are using an external Postgres database@@ -205,7 +210,6 @@ services:timeout: 5sinterval: 5sretries: 3- restart: unless-stoppedenvironment:PORT: 4000DB_HOST: ${POSTGRES_HOST}@@ -216,7 +220,7 @@ services:DB_AFTER_CONNECT_QUERY: 'SET search_path TO _realtime'DB_ENC_KEY: supabaserealtimeAPI_JWT_SECRET: ${JWT_SECRET}- SECRET_KEY_BASE: UpNVntn3cDxHJpq99YMc1T1AQgQpc8kfYTuRgBiYa15BLrx8etQoXz3gZv1/u2oq+ SECRET_KEY_BASE: ${SECRET_KEY_BASE}ERL_AFLAGS: -proto_dist inet_tcpDNS_NODES: "''"RLIMIT_NOFILE: "10000"@@ -228,14 +232,9 @@ services:storage:container_name: supabase-storageimage: supabase/storage-api:v1.14.5- depends_on:- db:- # Disable this if you are using an external Postgres database- condition: service_healthy- rest:- condition: service_started- imgproxy:- condition: service_started+ restart: unless-stopped+ volumes:+ - ./volumes/storage:/var/lib/storage:zhealthcheck:test:[@@ -249,7 +248,14 @@ services:timeout: 5sinterval: 5sretries: 3- restart: unless-stopped+ depends_on:+ db:+ # Disable this if you are using an external Postgres database+ condition: service_healthy+ rest:+ condition: service_started+ imgproxy:+ condition: service_startedenvironment:ANON_KEY: ${ANON_KEY}SERVICE_KEY: ${SERVICE_ROLE_KEY}@@ -265,14 +271,20 @@ services:GLOBAL_S3_BUCKET: stubENABLE_IMAGE_TRANSFORMATION: "true"IMGPROXY_URL: http://imgproxy:5001- volumes:- - ./volumes/storage:/var/lib/storage:zimgproxy:container_name: supabase-imgproxyimage: darthsim/imgproxy:v3.8.0+ restart: unless-stopped+ volumes:+ - ./volumes/storage:/var/lib/storage:zhealthcheck:- test: [ "CMD", "imgproxy", "health" ]+ test:+ [+ "CMD",+ "imgproxy",+ "health"+ ]timeout: 5sinterval: 5sretries: 3@@ -281,19 +293,17 @@ services:IMGPROXY_LOCAL_FILESYSTEM_ROOT: /IMGPROXY_USE_ETAG: "true"IMGPROXY_ENABLE_WEBP_DETECTION: ${IMGPROXY_ENABLE_WEBP_DETECTION}- volumes:- - ./volumes/storage:/var/lib/storage:zmeta:container_name: supabase-metaimage: supabase/postgres-meta:v0.84.2+ restart: unless-stoppeddepends_on:db:# Disable this if you are using an external Postgres databasecondition: service_healthyanalytics:condition: service_healthy- restart: unless-stoppedenvironment:PG_META_PORT: 8080PG_META_DB_HOST: ${POSTGRES_HOST}@@ -306,6 +316,8 @@ services:container_name: supabase-edge-functionsimage: supabase/edge-runtime:v1.66.4restart: unless-stopped+ volumes:+ - ./volumes/functions:/home/deno/functions:Zdepends_on:analytics:condition: service_healthy@@ -317,32 +329,39 @@ services:SUPABASE_DB_URL: postgresql://postgres:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}# TODO: Allow configuring VERIFY_JWT per function. This PR might help: https://github.com/supabase/cli/pull/786VERIFY_JWT: "${FUNCTIONS_VERIFY_JWT}"- volumes:- - ./volumes/functions:/home/deno/functions:Zcommand:- - start- - --main-service- - /home/deno/functions/main+ [+ "start",+ "--main-service",+ "/home/deno/functions/main"+ ]analytics:container_name: supabase-analyticsimage: supabase/logflare:1.4.0+ restart: unless-stopped+ ports:+ - 4000:4000+ # Uncomment to use Big Query backend for analytics+ # volumes:+ # - type: bind+ # source: ${PWD}/gcloud.json+ # target: /opt/app/rel/logflare/bin/gcloud.json+ # read_only: truehealthcheck:- test: [ "CMD", "curl", "http://localhost:4000/health" ]+ test:+ [+ "CMD",+ "curl",+ "http://localhost:4000/health"+ ]timeout: 5sinterval: 5sretries: 10- restart: unless-stoppeddepends_on:db:# Disable this if you are using an external Postgres databasecondition: service_healthy- # Uncomment to use Big Query backend for analytics- # volumes:- # - type: bind- # source: ${PWD}/gcloud.json- # target: /opt/app/rel/logflare/bin/gcloud.json- # read_only: trueenvironment:LOGFLARE_NODE_HOST: 127.0.0.1DB_USERNAME: supabase_admin@@ -363,38 +382,12 @@ services:# Uncomment to use Big Query backend for analytics# GOOGLE_PROJECT_ID: ${GOOGLE_PROJECT_ID}# GOOGLE_PROJECT_NUMBER: ${GOOGLE_PROJECT_NUMBER}- ports:- - 4000:4000# Comment out everything below this point if you are using an external Postgres databasedb:container_name: supabase-dbimage: supabase/postgres:15.8.1.020- healthcheck:- test: pg_isready -U postgres -h localhost- interval: 5s- timeout: 5s- retries: 10- depends_on:- vector:- condition: service_healthy- command:- - postgres- - -c- - config_file=/etc/postgresql/postgresql.conf- - -c- - log_min_messages=fatal # prevents Realtime polling queries from appearing in logsrestart: unless-stopped- environment:- POSTGRES_HOST: /var/run/postgresql- PGPORT: ${POSTGRES_PORT}- POSTGRES_PORT: ${POSTGRES_PORT}- PGPASSWORD: ${POSTGRES_PASSWORD}- POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}- PGDATABASE: ${POSTGRES_DB}- POSTGRES_DB: ${POSTGRES_DB}- JWT_SECRET: ${JWT_SECRET}- JWT_EXP: ${JWT_EXPIRY}volumes:- ./volumes/db/realtime.sql:/docker-entrypoint-initdb.d/migrations/99-realtime.sql:Z# Must be superuser to create event trigger@@ -413,14 +406,51 @@ services:- ./volumes/db/pooler.sql:/docker-entrypoint-initdb.d/migrations/99-pooler.sql:Z# Use named volume to persist pgsodium decryption key between restarts- db-config:/etc/postgresql-custom+ healthcheck:+ test:+ [+ "CMD",+ "pg_isready",+ "-U",+ "postgres",+ "-h",+ "localhost"+ ]+ interval: 5s+ timeout: 5s+ retries: 10+ depends_on:+ vector:+ condition: service_healthy+ environment:+ POSTGRES_HOST: /var/run/postgresql+ PGPORT: ${POSTGRES_PORT}+ POSTGRES_PORT: ${POSTGRES_PORT}+ PGPASSWORD: ${POSTGRES_PASSWORD}+ POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}+ PGDATABASE: ${POSTGRES_DB}+ POSTGRES_DB: ${POSTGRES_DB}+ JWT_SECRET: ${JWT_SECRET}+ JWT_EXP: ${JWT_EXPIRY}+ command:+ [+ "postgres",+ "-c",+ "config_file=/etc/postgresql/postgresql.conf",+ "-c",+ "log_min_messages=fatal" # prevents Realtime polling queries from appearing in logs+ ]vector:container_name: supabase-vectorimage: timberio/vector:0.28.1-alpine+ restart: unless-stopped+ volumes:+ - ./volumes/logs/vector.yml:/etc/vector/vector.yml:ro+ - ${DOCKER_SOCKET_LOCATION}:/var/run/docker.sock:rohealthcheck:test:[-"CMD","wget","--no-verbose",@@ -431,19 +461,35 @@ services:timeout: 5sinterval: 5sretries: 3- volumes:- - ./volumes/logs/vector.yml:/etc/vector/vector.yml:ro- - ${DOCKER_SOCKET_LOCATION}:/var/run/docker.sock:roenvironment:LOGFLARE_API_KEY: ${LOGFLARE_API_KEY}- command: [ "--config", "/etc/vector/vector.yml" ]+ command:+ [+ "--config",+ "/etc/vector/vector.yml"+ ]# Update the DATABASE_URL if you are using an external Postgres databasesupavisor:container_name: supabase-poolerimage: supabase/supavisor:1.1.56+ restart: unless-stopped+ ports:+ - ${POSTGRES_PORT}:5432+ - ${POOLER_PROXY_PORT_TRANSACTION}:6543+ volumes:+ - ./volumes/pooler/pooler.exs:/etc/pooler/pooler.exs:rohealthcheck:- test: curl -sSfL --head -o /dev/null "http://127.0.0.1:4000/api/health"+ test:+ [+ "CMD",+ "curl",+ "-sSfL",+ "--head",+ "-o",+ "/dev/null",+ "http://127.0.0.1:4000/api/health"+ ]interval: 10stimeout: 5sretries: 5@@ -452,33 +498,29 @@ services:condition: service_healthyanalytics:condition: service_healthy- command:- - /bin/sh- - -c- - /app/bin/migrate && /app/bin/supavisor eval "$$(cat /etc/pooler/pooler.exs)" && /app/bin/server- restart: unless-stopped- ports:- - ${POSTGRES_PORT}:5432- - ${POOLER_PROXY_PORT_TRANSACTION}:6543environment:- - PORT=4000- - POSTGRES_PORT=${POSTGRES_PORT}- - POSTGRES_DB=${POSTGRES_DB}- - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}- - DATABASE_URL=ecto://supabase_admin:${POSTGRES_PASSWORD}@db:${POSTGRES_PORT}/_supabase- - CLUSTER_POSTGRES=true- - SECRET_KEY_BASE=UpNVntn3cDxHJpq99YMc1T1AQgQpc8kfYTuRgBiYa15BLrx8etQoXz3gZv1/u2oq- - VAULT_ENC_KEY=your-encryption-key-32-chars-min- - API_JWT_SECRET=${JWT_SECRET}- - METRICS_JWT_SECRET=${JWT_SECRET}- - REGION=local- - ERL_AFLAGS=-proto_dist inet_tcp- - POOLER_TENANT_ID=${POOLER_TENANT_ID}- - POOLER_DEFAULT_POOL_SIZE=${POOLER_DEFAULT_POOL_SIZE}- - POOLER_MAX_CLIENT_CONN=${POOLER_MAX_CLIENT_CONN}- - POOLER_POOL_MODE=transaction- volumes:- - ./volumes/pooler/pooler.exs:/etc/pooler/pooler.exs:ro+ PORT: 4000+ POSTGRES_PORT: ${POSTGRES_PORT}+ POSTGRES_DB: ${POSTGRES_DB}+ POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}+ DATABASE_URL: ecto://supabase_admin:${POSTGRES_PASSWORD}@db:${POSTGRES_PORT}/_supabase+ CLUSTER_POSTGRES: true+ SECRET_KEY_BASE: ${SECRET_KEY_BASE}+ VAULT_ENC_KEY: ${VAULT_ENC_KEY}+ API_JWT_SECRET: ${JWT_SECRET}+ METRICS_JWT_SECRET: ${JWT_SECRET}+ REGION: local+ ERL_AFLAGS: -proto_dist inet_tcp+ POOLER_TENANT_ID: ${POOLER_TENANT_ID}+ POOLER_DEFAULT_POOL_SIZE: ${POOLER_DEFAULT_POOL_SIZE}+ POOLER_MAX_CLIENT_CONN: ${POOLER_MAX_CLIENT_CONN}+ POOLER_POOL_MODE: transaction+ command:+ [+ "/bin/sh",+ "-c",+ "/app/bin/migrate && /app/bin/supavisor eval \"$$(cat /etc/pooler/pooler.exs)\" && /app/bin/server"+ ]volumes:db-config: