Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
cfab748
feat(docker): make analytics stack optional via compose overlay
luizfelmach Apr 28, 2026
3aa4b17
docs(env): add analytics overlay usage comments to .env.example
luizfelmach Apr 28, 2026
3df7b94
docs(readme): mark analytics as optional with overlay instructions
luizfelmach Apr 28, 2026
013841e
test(container-logs): support optional analytics service
luizfelmach Apr 28, 2026
0b3bbde
fix: minor changes to remove redundant vars
aantti May 7, 2026
555e651
fix: add start_period for studio and analytics
aantti May 7, 2026
88adbea
chore: minor edits to comments
aantti May 7, 2026
5f1ec9b
chore: add comments to test logs script and add check for envoy too
aantti May 7, 2026
4c4c0ad
Merge branch 'master' into feat/make-analytics-optional-in-compose
aantti May 14, 2026
510d430
fix: use cmd-shell and -f for curl
aantti May 14, 2026
8862bcd
fix: add depends_on analytics for vector
aantti May 17, 2026
0db05a9
Merge branch 'master' into feat/make-analytics-optional-in-compose
luizfelmach May 21, 2026
9c8eded
Revert "chore: add comments to test logs script and add check for env…
luizfelmach May 21, 2026
13f80cb
Revert "test(container-logs): support optional analytics service"
luizfelmach May 21, 2026
10e777b
Merge branch 'master' into feat/make-analytics-optional-in-compose
Ziinc May 26, 2026
efb10df
chore: resolve conflicts
aantti May 26, 2026
ff2890c
Merge branch 'master' into feat/make-analytics-optional-in-compose
aantti May 26, 2026
3ecb3a4
Merge branch 'master' into feat/make-analytics-optional-in-compose
aantti May 26, 2026
9bb2259
Merge branch 'master' of github.com:supabase/supabase into feat/make-…
aantti May 26, 2026
e7c584f
Merge branch 'master' into feat/make-analytics-optional-in-compose
aantti May 26, 2026
6beb51c
Merge branch 'feat/make-analytics-optional-in-compose' of github.com:…
aantti May 26, 2026
1885a92
chore: add bigquery conf placholders back
aantti May 26, 2026
7b6618c
chore: remove an unneeded space
aantti May 26, 2026
90737b4
chore: correct selinux flags for functions
aantti May 26, 2026
ecc3bca
chore: reorg env vars for analytics in compose
aantti May 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions docker/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ VAULT_ENC_KEY=your-32-character-encryption-key
PG_META_CRYPTO_KEY=your-encryption-key-32-chars-min

# Analytics - API tokens for log ingestion/querying, and for management
# If Logflare has to be externally exposed - configure securely!
# Used in the docker-compose.logs.yml override.
LOGFLARE_PUBLIC_ACCESS_TOKEN=your-super-secret-and-long-logflare-key-public
LOGFLARE_PRIVATE_ACCESS_TOKEN=your-super-secret-and-long-logflare-key-private

Expand Down Expand Up @@ -300,18 +302,24 @@ PGRST_DB_EXTRA_SEARCH_PATH=public


############
# Analytics - Configuration for Logflare
# Logs and Analytics
############

# Check the LOGFLARE_* access token configuration _above_.
# If Logflare has to be externally exposed - configure securely!
## Vector log collection and routing

# Docker socket location - required for proper Vector operation
DOCKER_SOCKET_LOCATION=/var/run/docker.sock
# For Podman use the following:
# DOCKER_SOCKET_LOCATION=/run/podman/podman.sock

## Analytics (Logflare)

# Check the LOGFLARE_* access token configuration _above_.
# If Logflare has to be externally exposed - configure securely!

# Google Cloud Project details
# Documentation:
# https://supabase.com/docs/reference/self-hosting-analytics/introduction
GOOGLE_PROJECT_ID=GOOGLE_PROJECT_ID
GOOGLE_PROJECT_NUMBER=GOOGLE_PROJECT_NUMBER

Expand Down
99 changes: 99 additions & 0 deletions docker/docker-compose.logs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# This override adds the following to the self-hosted Supabase configuration:
# - Logflare: Log management and event analytics platform
# - Vector: High-performance observability data pipeline for logs
#
# Usage:
# docker compose -f docker-compose.yml -f docker-compose.logs.yml up -d

services:

studio:
depends_on:
analytics:
condition: service_healthy
environment:
LOGFLARE_PRIVATE_ACCESS_TOKEN: ${LOGFLARE_PRIVATE_ACCESS_TOKEN}
LOGFLARE_URL: http://analytics:4000
ENABLED_FEATURES_LOGS_ALL: "true"

analytics:
container_name: supabase-analytics
image: supabase/logflare:1.36.1
restart: unless-stopped
#ports:
# - 4000:4000
healthcheck:
test:
[
"CMD-SHELL",
"curl -sSfL -o /dev/null http://localhost:4000/health"
]
timeout: 5s
interval: 5s
retries: 10
start_period: 30s
depends_on:
db:
# Disable this if you are using an external Postgres database
condition: service_healthy
environment:
LOGFLARE_NODE_HOST: 127.0.0.1

DB_USERNAME: supabase_admin
DB_DATABASE: _supabase
DB_HOSTNAME: ${POSTGRES_HOST}
DB_PORT: ${POSTGRES_PORT}
DB_PASSWORD: ${POSTGRES_PASSWORD}
DB_SCHEMA: _analytics

# Enable single-tenant mode for Logflare
LOGFLARE_SINGLE_TENANT: "true"
# Seed Supabase-related metadata
LOGFLARE_SUPABASE_MODE: "true"

LOGFLARE_PUBLIC_ACCESS_TOKEN: ${LOGFLARE_PUBLIC_ACCESS_TOKEN}
LOGFLARE_PRIVATE_ACCESS_TOKEN: ${LOGFLARE_PRIVATE_ACCESS_TOKEN}

LOGFLARE_FEATURE_FLAG_OVERRIDE: multibackend=true

# Comment out the following two variables when switching to
# the BigQuery backend for logs
POSTGRES_BACKEND_URL: postgresql://supabase_admin:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/_supabase
POSTGRES_BACKEND_SCHEMA: _analytics

# Uncomment to use the BigQuery backend for logs
#GOOGLE_PROJECT_ID: ${GOOGLE_PROJECT_ID}
#GOOGLE_PROJECT_NUMBER: ${GOOGLE_PROJECT_NUMBER}
# Uncomment to use the BigQuery backend for logs (requires gcloud.json
# service account key from Google Cloud Console)
#volumes:
# - ./gcloud.json:/opt/app/rel/logflare/bin/gcloud.json:ro,z

vector:
container_name: supabase-vector
image: timberio/vector:0.53.0-alpine
restart: unless-stopped
volumes:
- ./volumes/logs/vector.yml:/etc/vector/vector.yml:ro,z
- ${DOCKER_SOCKET_LOCATION}:/var/run/docker.sock:ro,z
healthcheck:
test:
[
"CMD-SHELL",
"wget --no-verbose --tries=1 --spider http://vector:9001/health"
]
timeout: 5s
interval: 5s
retries: 3
depends_on:
analytics:
condition: service_healthy
environment:
LOGFLARE_PUBLIC_ACCESS_TOKEN: ${LOGFLARE_PUBLIC_ACCESS_TOKEN}
command:
[
"--config",
"/etc/vector/vector.yml"
]
security_opt:
- "label=disable"
106 changes: 8 additions & 98 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ services:
timeout: 10s
interval: 5s
retries: 3
depends_on:
analytics:
condition: service_healthy
start_period: 20s
environment:
# Listen on all IPv4 interfaces
# Listen on all IPv4 interfaces
HOSTNAME: "0.0.0.0"

STUDIO_PG_META_URL: http://meta:8080
Expand Down Expand Up @@ -58,22 +56,14 @@ services:
SUPABASE_PUBLISHABLE_KEY: ${SUPABASE_PUBLISHABLE_KEY}
SUPABASE_SECRET_KEY: ${SUPABASE_SECRET_KEY}

# LOGFLARE_API_KEY is deprecated
LOGFLARE_API_KEY: ${LOGFLARE_PUBLIC_ACCESS_TOKEN}
LOGFLARE_PUBLIC_ACCESS_TOKEN: ${LOGFLARE_PUBLIC_ACCESS_TOKEN}
LOGFLARE_PRIVATE_ACCESS_TOKEN: ${LOGFLARE_PRIVATE_ACCESS_TOKEN}

LOGFLARE_URL: http://analytics:4000
NEXT_PUBLIC_ENABLE_LOGS: "true"
# Comment to use Big Query backend for analytics
NEXT_ANALYTICS_BACKEND_PROVIDER: postgres
# Uncomment to use Big Query backend for analytics
# NEXT_ANALYTICS_BACKEND_PROVIDER: bigquery
# See: docker-compose.logs.yml
ENABLED_FEATURES_LOGS_ALL: "false"

SNIPPETS_MANAGEMENT_FOLDER: /app/snippets
EDGE_FUNCTIONS_MANAGEMENT_FOLDER: /app/edge-functions
volumes:
- ./volumes/snippets:/app/snippets:Z
- ./volumes/functions:/app/edge-functions:Z
- ./volumes/snippets:/app/snippets:ro,z
- ./volumes/functions:/app/edge-functions:ro,z

kong:
container_name: supabase-kong
Expand All @@ -95,7 +85,6 @@ services:
- ${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,z
- ./volumes/api/kong-entrypoint.sh:/home/kong/kong-entrypoint.sh:ro,z
#- ./volumes/api/server.crt:/home/kong/server.crt:ro
Expand Down Expand Up @@ -443,7 +432,7 @@ services:
image: supabase/edge-runtime:v1.71.2
restart: unless-stopped
volumes:
- ./volumes/functions:/home/deno/functions:Z
- ./volumes/functions:/home/deno/functions:z
- deno-cache:/root/.cache/deno
depends_on:
kong:
Expand All @@ -469,52 +458,6 @@ services:
"/home/deno/functions/main"
]

analytics:
container_name: supabase-analytics
image: supabase/logflare:1.36.1
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-SHELL",
"curl -sSfL -o /dev/null http://localhost:4000/health"
]
timeout: 5s
interval: 5s
retries: 10
depends_on:
db:
# Disable this if you are using an external Postgres database
condition: service_healthy
environment:
LOGFLARE_NODE_HOST: 127.0.0.1
DB_USERNAME: supabase_admin
DB_DATABASE: _supabase
DB_HOSTNAME: ${POSTGRES_HOST}
DB_PORT: ${POSTGRES_PORT}
DB_PASSWORD: ${POSTGRES_PASSWORD}
DB_SCHEMA: _analytics
LOGFLARE_PUBLIC_ACCESS_TOKEN: ${LOGFLARE_PUBLIC_ACCESS_TOKEN}
LOGFLARE_PRIVATE_ACCESS_TOKEN: ${LOGFLARE_PRIVATE_ACCESS_TOKEN}
LOGFLARE_SINGLE_TENANT: "true"
LOGFLARE_SUPABASE_MODE: "true"

# Comment variables to use Big Query backend for analytics
POSTGRES_BACKEND_URL: postgresql://supabase_admin:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/_supabase
POSTGRES_BACKEND_SCHEMA: _analytics
LOGFLARE_FEATURE_FLAG_OVERRIDE: multibackend=true
# Uncomment to use Big Query backend for analytics
# GOOGLE_PROJECT_ID: ${GOOGLE_PROJECT_ID}
# GOOGLE_PROJECT_NUMBER: ${GOOGLE_PROJECT_NUMBER}

# Comment out everything below this point if you are using an external Postgres database
db:
container_name: supabase-db
Expand Down Expand Up @@ -570,39 +513,6 @@ services:
"log_min_messages=fatal" # prevents Realtime polling queries from appearing in logs
]

vector:
container_name: supabase-vector
image: timberio/vector:0.53.0-alpine
restart: unless-stopped
volumes:
- ./volumes/logs/vector.yml:/etc/vector/vector.yml:ro,z
- ${DOCKER_SOCKET_LOCATION}:/var/run/docker.sock:ro,z
healthcheck:
test:
[
"CMD",
"wget",
"--no-verbose",
"--tries=1",
"--spider",
"http://vector:9001/health"
]
timeout: 5s
interval: 5s
retries: 3
depends_on:
analytics:
condition: service_healthy
environment:
LOGFLARE_PUBLIC_ACCESS_TOKEN: ${LOGFLARE_PUBLIC_ACCESS_TOKEN}
command:
[
"--config",
"/etc/vector/vector.yml"
]
security_opt:
- "label=disable"

# Update the DATABASE_URL if you are using an external Postgres database
supavisor:
container_name: supabase-pooler
Expand Down