Skip to content

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

chore: refactor docker-compose.yml unify syntax style (#32668)

RampantDespaird1bf79838a9b
diff --git a/docker/.env.example b/docker/.env.example
index 1e773721541..bb74500874d 100644
--- a/docker/.env.example
+++ b/docker/.env.example
@@ -9,6 +9,9 @@ ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJhbm9uIiwKIC
SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJzZXJ2aWNlX3JvbGUiLAogICAgImlzcyI6ICJzdXBhYmFzZS1kZW1vIiwKICAgICJpYXQiOiAxNjQxNzY5MjAwLAogICAgImV4cCI6IDE3OTk1MzU2MDAKfQ.DaYlNEoUrrEn2Ig7tqibS-PHK5vgusbcbo7X36XVt4Q
DASHBOARD_USERNAME=supabase
DASHBOARD_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=postgres
POSTGRES_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 Assistant
OPENAI_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/introduction
diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
index 5496e5a38d5..d3ca3d1b1d8 100644
--- a/docker/docker-compose.yml
+++ b/docker/docker-compose.yml
@@ -8,6 +8,7 @@
name: supabase
services:
+
studio:
container_name: supabase-studio
image: supabase/studio:20250113-83c9420
@@ -52,11 +53,12 @@ services:
container_name: supabase-kong
image: kong:2.8.1
restart: 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:ro
depends_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-auth
image: 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-stopped
healthcheck:
test:
[
@@ -98,7 +94,12 @@ services:
timeout: 5s
interval: 5s
retries: 3
- restart: unless-stopped
+ depends_on:
+ db:
+ # Disable this if you are using an external Postgres database
+ condition: service_healthy
+ analytics:
+ condition: service_healthy
environment:
GOTRUE_API_HOST: 0.0.0.0
GOTRUE_API_PORT: 9999
@@ -162,13 +163,13 @@ services:
rest:
container_name: supabase-rest
image: postgrest/postgrest:v12.2.0
+ restart: unless-stopped
depends_on:
db:
# Disable this if you are using an external Postgres database
condition: service_healthy
analytics:
condition: service_healthy
- restart: unless-stopped
environment:
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 subdomain
container_name: realtime-dev.supabase-realtime
image: supabase/realtime:v2.33.70
+ restart: unless-stopped
depends_on:
db:
# Disable this if you are using an external Postgres database
@@ -205,7 +210,6 @@ services:
timeout: 5s
interval: 5s
retries: 3
- restart: unless-stopped
environment:
PORT: 4000
DB_HOST: ${POSTGRES_HOST}
@@ -216,7 +220,7 @@ services:
DB_AFTER_CONNECT_QUERY: 'SET search_path TO _realtime'
DB_ENC_KEY: supabaserealtime
API_JWT_SECRET: ${JWT_SECRET}
- SECRET_KEY_BASE: UpNVntn3cDxHJpq99YMc1T1AQgQpc8kfYTuRgBiYa15BLrx8etQoXz3gZv1/u2oq
+ SECRET_KEY_BASE: ${SECRET_KEY_BASE}
ERL_AFLAGS: -proto_dist inet_tcp
DNS_NODES: "''"
RLIMIT_NOFILE: "10000"
@@ -228,14 +232,9 @@ services:
storage:
container_name: supabase-storage
image: 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:z
healthcheck:
test:
[
@@ -249,7 +248,14 @@ services:
timeout: 5s
interval: 5s
retries: 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_started
environment:
ANON_KEY: ${ANON_KEY}
SERVICE_KEY: ${SERVICE_ROLE_KEY}
@@ -265,14 +271,20 @@ services:
GLOBAL_S3_BUCKET: stub
ENABLE_IMAGE_TRANSFORMATION: "true"
IMGPROXY_URL: http://imgproxy:5001
- volumes:
- - ./volumes/storage:/var/lib/storage:z
imgproxy:
container_name: supabase-imgproxy
image: darthsim/imgproxy:v3.8.0
+ restart: unless-stopped
+ volumes:
+ - ./volumes/storage:/var/lib/storage:z
healthcheck:
- test: [ "CMD", "imgproxy", "health" ]
+ test:
+ [
+ "CMD",
+ "imgproxy",
+ "health"
+ ]
timeout: 5s
interval: 5s
retries: 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:z
meta:
container_name: supabase-meta
image: supabase/postgres-meta:v0.84.2
+ restart: unless-stopped
depends_on:
db:
# Disable this if you are using an external Postgres database
condition: service_healthy
analytics:
condition: service_healthy
- restart: unless-stopped
environment:
PG_META_PORT: 8080
PG_META_DB_HOST: ${POSTGRES_HOST}
@@ -306,6 +316,8 @@ services:
container_name: supabase-edge-functions
image: supabase/edge-runtime:v1.66.4
restart: unless-stopped
+ volumes:
+ - ./volumes/functions:/home/deno/functions:Z
depends_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/786
VERIFY_JWT: "${FUNCTIONS_VERIFY_JWT}"
- volumes:
- - ./volumes/functions:/home/deno/functions:Z
command:
- - start
- - --main-service
- - /home/deno/functions/main
+ [
+ "start",
+ "--main-service",
+ "/home/deno/functions/main"
+ ]
analytics:
container_name: supabase-analytics
image: 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: true
healthcheck:
- test: [ "CMD", "curl", "http://localhost:4000/health" ]
+ test:
+ [
+ "CMD",
+ "curl",
+ "http://localhost:4000/health"
+ ]
timeout: 5s
interval: 5s
retries: 10
- restart: unless-stopped
depends_on:
db:
# Disable this if you are using an external Postgres database
condition: 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: true
environment:
LOGFLARE_NODE_HOST: 127.0.0.1
DB_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 database
db:
container_name: supabase-db
image: 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 logs
restart: 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-vector
image: 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:ro
healthcheck:
test:
[
-
"CMD",
"wget",
"--no-verbose",
@@ -431,19 +461,35 @@ services:
timeout: 5s
interval: 5s
retries: 3
- volumes:
- - ./volumes/logs/vector.yml:/etc/vector/vector.yml:ro
- - ${DOCKER_SOCKET_LOCATION}:/var/run/docker.sock:ro
environment:
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 database
supavisor:
container_name: supabase-pooler
image: 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:ro
healthcheck:
- 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: 10s
timeout: 5s
retries: 5
@@ -452,33 +498,29 @@ services:
condition: service_healthy
analytics:
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}:6543
environment:
- - 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: