Merge pull request #280 from buster-so/dal/self-hosting-guide

Dal/self-hosting-guide
This commit is contained in:
dal 2025-05-07 09:48:28 -07:00 committed by GitHub
commit e3740cf464
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 149 additions and 156 deletions

View File

@ -1,31 +1,128 @@
# General Application Settings
ENVIRONMENT="development"
DATABASE_URL="postgresql://postgres:your-super-secret-and-long-postgres-password@db:5432/postgres"
POOLER_URL="postgresql://postgres:your-super-secret-and-long-postgres-password@db:5432/postgres"
JWT_SECRET="super-secret-jwt-token-with-at-least-32-characters-long"
REDIS_URL="redis://redis:6379"
LANGFUSE_API_URL="https://us.cloud.langfuse.com"
LANGFUSE_PUBLIC_API_KEY=""
LANGFUSE_PRIVATE_API_KEY=""
OPENAI_API_KEY=""
EMBED_VEC_LENGTH="1536"
POSTHOG_API_KEY=""
RESEND_API_KEY=""
BUSTER_URL="http://web:3000"
BUSTER_WH_TOKEN="buster-wh-token"
# --- API Service Specific ---
# Direct Database Connection (for API service and potentially others)
DATABASE_URL="postgresql://postgres:your-super-secret-and-long-postgres-password@db:5432/postgres"
# Pooled Database Connection (for API service, uses Supavisor)
POOLER_URL="postgresql://postgres:your-super-secret-and-long-postgres-password@db:5432/postgres"
# Redis Connection
REDIS_URL="redis://buster-redis:6379"
# Supabase Connection for API service
SUPABASE_URL="http://kong:8000"
SUPABASE_SERVICE_ROLE_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ey AgCiAgICAicm9sZSI6ICJzZXJ2aWNlX3JvbGUiLAogICAgImlzcyI6ICJzdXBhYmFzZS1kZW1vIiwKICAgICJpYXQiOiAxNjQxNzY5MjAwLAogICAgImV4cCI6IDE3OTk1MzU2MDAKfQ.DaYlNEoUrrEn2Ig7tqibS-PHK5vgusbcbo7X36XVt4Q"
# --- LLM / AI Services ---
EMBEDDING_PROVIDER="ollama"
EMBEDDING_MODEL="mxbai-embed-large"
COHERE_API_KEY=""
OPENAI_API_KEY="" # For OpenAI models or Supabase Studio assistant
LLM_API_KEY="test-key"
LLM_BASE_URL="http://localhost:8000"
LLM_BASE_URL="http://litellm:4001"
# --- Web Client (Next.js) Specific ---
NEXT_PUBLIC_API_URL="http://localhost:3001" # External URL for the API service (buster-api)
NEXT_PUBLIC_URL="http://localhost:3000" # External URL for the Web service (buster-web)
NEXT_PUBLIC_SUPABASE_URL="http://localhost:8000" # External URL for Supabase (Kong proxy)
NEXT_PUBLIC_SUPABASE_ANON_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ey AgCiAgICAicm9sZSI6ICJhbm9uIiwKICAgICJpc3MiOiAic3VwYWJhc2UtZGVtbyIsCiAgICAiaWF0IjogMTY0MTc2OTIwMCwKICAgICJleHAiOiAxNzk5NTM1NjAwCn0.dc_X5iR_VP_qT0zsiyj_I_OZ2T9FtRU2BBNWN8Bu4GE"
NEXT_PRIVATE_SUPABASE_SERVICE_ROLE_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ey AgCiAgICAicm9sZSI6ICJzZXJ2aWNlX3JvbGUiLAogICAgImlzcyI6ICJzdXBhYmFzZS1kZW1vIiwKICAgICJpYXQiOiAxNjQxNzY5MjAwLAogICAgImV4cCI6IDE3OTk1MzU2MDAKfQ.DaYlNEoUrrEn2Ig7tqibS-PHK5vgusbcbo7X36XVt4Q"
#################################################
# Supabase Stack Configuration Variables
# These are primarily used by the Supabase services themselves
# (defined in supabase/docker-compose.yml)
# and are sourced from this .env file when `docker compose up` is run.
#################################################
NEXT_PUBLIC_API_URL="http://127.0.0.1:3001"
NEXT_PUBLIC_URL="http://localhost:3000"
NEXT_PUBLIC_SUPABASE_URL="http://kong:8000"
NEXT_PUBLIC_SUPABASE_ANON_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJhbm9uIiwKICAgICJpc3MiOiAic3VwYWJhc2UtZGVtbyIsCiAgICAiaWF0IjogMTY0MTc2OTIwMCwKICAgICJleHAiOiAxNzk5NTM1NjAwCn0.dc_X5iR_VP_qT0zsiyj_I_OZ2T9FtRU2BBNWN8Bu4GE"
NEXT_PRIVATE_SUPABASE_SERVICE_ROLE_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU"
NEXT_PRIVATE_SUPABASE_CONNECT_CLIENT_ID=""
NEXT_PRIVATE_SUPABASE_CONNECT_CLIENT_SECRET=""
NEXT_PUBLIC_USER="chad@buster.so"
NEXT_PUBLIC_USER_PASSWORD="password"
############
# Secrets
############
POSTGRES_PASSWORD="your-super-secret-and-long-postgres-password"
JWT_SECRET="your-super-secret-jwt-token-with-at-least-32-characters-long"
ANON_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ey AgCiAgICAicm9sZSI6ICJhbm9uIiwKICAgICJpc3MiOiAic3VwYWJhc2UtZGVtbyIsCiAgICAiaWF0IjogMTY0MTc2OTIwMCwKICAgICJleHAiOiAxNzk5NTM1NjAwCn0.dc_X5iR_VP_qT0zsiyj_I_OZ2T9FtRU2BBNWN8Bu4GE"
SERVICE_ROLE_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ey AgCiAgICAicm9sZSI6ICJzZXJ2aWNlX3JvbGUiLAogICAgImlzcyI6ICJzdXBhYmFzZS1kZW1vIiwKICAgICJpYXQiOiAxNjQxNzY5MjAwLAogICAgImV4cCI6IDE3OTk1MzU2MDAKfQ.DaYlNEoUrrEn2Ig7tqibS-PHK5vgusbcbo7X36XVt4Q"
DASHBOARD_USERNAME="supabase"
DASHBOARD_PASSWORD="this_password_is_insecure_and_should_be_updated"
############
# Database
############
POSTGRES_HOST="db"
POSTGRES_DB="postgres"
POSTGRES_PORT="5432"
############
# Supavisor -- Database pooler
############
POOLER_PROXY_PORT_TRANSACTION="6543"
POOLER_DEFAULT_POOL_SIZE="20"
POOLER_MAX_CLIENT_CONN="100"
POOLER_TENANT_ID="your-tenant-id"
############
# API Proxy - Kong
############
KONG_HTTP_PORT="8000"
KONG_HTTPS_PORT="8443"
############
# API - PostgREST
############
PGRST_DB_SCHEMAS="public,storage,graphql_public"
############
# Auth - GoTrue
############
SITE_URL="http://localhost:3000" # Default base URL for the site (used in emails, etc.)
ADDITIONAL_REDIRECT_URLS=""
JWT_EXPIRY="3600"
DISABLE_SIGNUP="false"
API_EXTERNAL_URL="http://localhost:8000" # Publicly accessible URL for the Supabase API (via Kong)
## Mailer Config
MAILER_URLPATHS_CONFIRMATION="/auth/v1/verify"
MAILER_URLPATHS_INVITE="/auth/v1/verify"
MAILER_URLPATHS_RECOVERY="/auth/v1/verify"
MAILER_URLPATHS_EMAIL_CHANGE="/auth/v1/verify"
## Email auth
ENABLE_EMAIL_SIGNUP="true"
ENABLE_EMAIL_AUTOCONFIRM="false"
SMTP_ADMIN_EMAIL="admin@buster.so"
SMTP_HOST="supabase-mail"
SMTP_PORT="2500"
SMTP_USER=""
SMTP_PASS=""
SMTP_SENDER_NAME="Buster"
ENABLE_ANONYMOUS_USERS="true"
## Phone auth
ENABLE_PHONE_SIGNUP="true"
ENABLE_PHONE_AUTOCONFIRM="true"
############
# Studio - Supabase Dashboard
############
STUDIO_DEFAULT_ORGANIZATION="Default Organization"
STUDIO_DEFAULT_PROJECT="Default Project"
STUDIO_PORT="3003"
SUPABASE_PUBLIC_URL="http://localhost:8000" # Public URL for Supabase (Kong), used by Studio
# Image Proxy
IMGPROXY_ENABLE_WEBP_DETECTION="true"
############
# Functions - Supabase Edge Functions
############
FUNCTIONS_VERIFY_JWT="false"
############
# Logs - Logflare
############
LOGFLARE_LOGGER_BACKEND_API_KEY="your-super-secret-and-long-logflare-key"
LOGFLARE_API_KEY="your-super-secret-and-long-logflare-key"
DOCKER_SOCKET_LOCATION="/var/run/docker.sock"
GOOGLE_PROJECT_ID="GOOGLE_PROJECT_ID"
GOOGLE_PROJECT_NUMBER="GOOGLE_PROJECT_NUMBER"

View File

@ -7,6 +7,8 @@ services:
container_name: buster-redis
ports:
- "6379:6379"
volumes:
- buster_redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 1s
@ -14,25 +16,17 @@ services:
retries: 30
api:
build:
context: ./api
image: ghcr.io/buster-so/buster/api:latest
container_name: buster-api
env_file:
- .env
environment:
- DATABASE_URL=${DATABASE_URL}
- REDIS_URL=${REDIS_URL}
- OPENAI_API_KEY=${OPENAI_API_KEY}
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
- JWT_SECRET=${JWT_SECRET}
- SUPABASE_URL=${SUPABASE_URL}
- SUPABASE_SERVICE_ROLE_KEY=${SUPABASE_SERVICE_ROLE_KEY}
- POOLER_URL=${POOLER_URL}
- LANGFUSE_API_URL=${LANGFUSE_API_URL}
- LANGFUSE_PUBLIC_API_KEY=${LANGFUSE_PUBLIC_API_KEY}
- LANGFUSE_PRIVATE_API_KEY=${LANGFUSE_PRIVATE_API_KEY}
- EMBED_VEC_LENGTH=${EMBED_VEC_LENGTH}
- POSTHOG_API_KEY=${POSTHOG_API_KEY}
- RESEND_API_KEY=${RESEND_API_KEY}
- BUSTER_URL=${BUSTER_URL}
- BUSTER_WH_TOKEN=${BUSTER_WH_TOKEN}
- EMBEDDING_PROVIDER=${EMBEDDING_PROVIDER}
@ -54,28 +48,33 @@ services:
depends_on:
redis:
condition: service_healthy
db:
supavisor:
condition: service_healthy
kong:
condition: service_healthy
web:
build:
context: ./web
args:
- NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
- NEXT_PUBLIC_URL=${NEXT_PUBLIC_URL}
- NEXT_PUBLIC_SUPABASE_URL=${NEXT_PUBLIC_SUPABASE_URL}
- NEXT_PUBLIC_SUPABASE_ANON_KEY=${NEXT_PUBLIC_SUPABASE_ANON_KEY}
environment:
- NEXT_PRIVATE_SUPABASE_SERVICE_ROLE_KEY=${NEXT_PRIVATE_SUPABASE_SERVICE_ROLE_KEY}
- NEXT_PRIVATE_SUPABASE_CONNECT_CLIENT_ID=${NEXT_PRIVATE_SUPABASE_CONNECT_CLIENT_ID}
- NEXT_PRIVATE_SUPABASE_CONNECT_CLIENT_SECRET=${NEXT_PRIVATE_SUPABASE_CONNECT_CLIENT_SECRET}
- NODE_ENV=production
env_file:
- .env
image: ghcr.io/buster-so/buster/web:latest
container_name: buster-web
ports:
- "3000:3000"
depends_on:
- api
api:
condition: service_healthy
litellm:
image: ghcr.io/berriai/litellm:main-stable
container_name: buster-litellm
restart: always
ports:
- "4001:4001"
env_file:
- .env
environment:
- LITELLM_ENV=local
depends_on:
supavisor:
condition: service_healthy
volumes:
db_data:
buster_redis_data:

View File

@ -5,8 +5,8 @@
POSTGRES_PASSWORD=your-super-secret-and-long-postgres-password
JWT_SECRET=your-super-secret-jwt-token-with-at-least-32-characters-long
ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJhbm9uIiwKICAgICJpc3MiOiAic3VwYWJhc2UtZGVtbyIsCiAgICAiaWF0IjogMTY0MTc2OTIwMCwKICAgICJleHAiOiAxNzk5NTM1NjAwCn0.dc_X5iR_VP_qT0zsiyj_I_OZ2T9FtRU2BBNWN8Bu4GE
SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJzZXJ2aWNlX3JvbGUiLAogICAgImlzcyI6ICJzdXBhYmFzZS1kZW1vIiwKICAgICJpYXQiOiAxNjQxNzY5MjAwLAogICAgImV4cCI6IDE3OTk1MzU2MDAKfQ.DaYlNEoUrrEn2Ig7tqibS-PHK5vgusbcbo7X36XVt4Q
ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ey AgCiAgICAicm9sZSI6ICJhbm9uIiwKICAgICJpc3MiOiAic3VwYWJhc2UtZGVtbyIsCiAgICAiaWF0IjogMTY0MTc2OTIwMCwKICAgICJleHAiOiAxNzk5NTM1NjAwCn0.dc_X5iR_VP_qT0zsiyj_I_OZ2T9FtRU2BBNWN8Bu4GE
SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ey AgCiAgICAicm9sZSI6ICJzZXJ2aWNlX3JvbGUiLAogICAgImlzcyI6ICJzdXBhYmFzZS1kZW1vIiwKICAgICJpYXQiOiAxNjQxNzY5MjAwLAogICAgImV4cCI6IDE3OTk1MzU2MDAKfQ.DaYlNEoUrrEn2Ig7tqibS-PHK5vgusbcbo7X36XVt4Q
DASHBOARD_USERNAME=supabase
DASHBOARD_PASSWORD=this_password_is_insecure_and_should_be_updated
@ -66,9 +66,9 @@ ENABLE_EMAIL_AUTOCONFIRM=false
SMTP_ADMIN_EMAIL=admin@buster.so
SMTP_HOST=supabase-mail
SMTP_PORT=2500
SMTP_SENDER_NAME=buster
SMTP_USER=
SMTP_PASS=
SMTP_SENDER_NAME=Buster
ENABLE_ANONYMOUS_USERS=true
## Phone auth

View File

@ -16,46 +16,6 @@ services:
- '9000:9000' # web interface
- '1100:1100' # POP3
studio:
container_name: supabase-studio
image: supabase/studio:20241202-71e5240
restart: unless-stopped
healthcheck:
test:
[
"CMD",
"node",
"-e",
"fetch('http://studio:3000/api/profile').then((r) => {if (r.status !== 200) throw new Error(r.status)})"
]
timeout: 10s
interval: 5s
retries: 3
depends_on:
analytics:
condition: service_healthy
environment:
STUDIO_PG_META_URL: http://meta:8080
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
DEFAULT_ORGANIZATION_NAME: ${STUDIO_DEFAULT_ORGANIZATION}
DEFAULT_PROJECT_NAME: ${STUDIO_DEFAULT_PROJECT}
OPENAI_API_KEY: ${OPENAI_API_KEY:-}
SUPABASE_URL: http://kong:8000
SUPABASE_PUBLIC_URL: ${SUPABASE_PUBLIC_URL}
SUPABASE_ANON_KEY: ${ANON_KEY}
SUPABASE_SERVICE_KEY: ${SERVICE_ROLE_KEY}
AUTH_JWT_SECRET: ${JWT_SECRET}
LOGFLARE_API_KEY: ${LOGFLARE_API_KEY}
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
kong:
container_name: supabase-kong
image: kong:2.8.1
@ -187,52 +147,6 @@ services:
PGRST_APP_SETTINGS_JWT_EXP: ${JWT_EXPIRY}
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
depends_on:
db:
# Disable this if you are using an external Postgres database
condition: service_healthy
analytics:
condition: service_healthy
healthcheck:
test:
[
"CMD",
"curl",
"-sSfL",
"--head",
"-o",
"/dev/null",
"-H",
"Authorization: Bearer ${ANON_KEY}",
"http://localhost:4000/api/tenants/realtime-dev/health"
]
timeout: 5s
interval: 5s
retries: 3
restart: unless-stopped
environment:
PORT: 4000
DB_HOST: ${POSTGRES_HOST}
DB_PORT: ${POSTGRES_PORT}
DB_USER: supabase_admin
DB_PASSWORD: ${POSTGRES_PASSWORD}
DB_NAME: ${POSTGRES_DB}
DB_AFTER_CONNECT_QUERY: 'SET search_path TO _realtime'
DB_ENC_KEY: supabaserealtime
API_JWT_SECRET: ${JWT_SECRET}
SECRET_KEY_BASE: UpNVntn3cDxHJpq99YMc1T1AQgQpc8kfYTuRgBiYa15BLrx8etQoXz3gZv1/u2oq
ERL_AFLAGS: -proto_dist inet_tcp
DNS_NODES: "''"
RLIMIT_NOFILE: "10000"
APP_NAME: realtime
SEED_SELF_HOST: true
RUN_JANITOR: true
# To use S3 backed storage: docker compose -f docker-compose.yml -f docker-compose.s3.yml up
storage:
container_name: supabase-storage
image: supabase/storage-api:v1.11.13
@ -292,24 +206,6 @@ services:
volumes:
- ./volumes/storage:/var/lib/storage:z
meta:
container_name: supabase-meta
image: supabase/postgres-meta:v0.84.2
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}
PG_META_DB_PORT: ${POSTGRES_PORT}
PG_META_DB_NAME: ${POSTGRES_DB}
PG_META_DB_USER: supabase_admin
PG_META_DB_PASSWORD: ${POSTGRES_PASSWORD}
functions:
container_name: supabase-edge-functions
image: supabase/edge-runtime:v1.65.3
@ -428,7 +324,6 @@ services:
healthcheck:
test:
[
"CMD",
"wget",
"--no-verbose",

View File

@ -8,12 +8,14 @@ ARG NEXT_PUBLIC_API_URL
ARG NEXT_PUBLIC_URL
ARG NEXT_PUBLIC_SUPABASE_URL
ARG NEXT_PUBLIC_SUPABASE_ANON_KEY
ARG NEXT_PUBLIC_WEB_SOCKET_URL
# Set public env vars for build time
ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
ENV NEXT_PUBLIC_URL=$NEXT_PUBLIC_URL
ENV NEXT_PUBLIC_SUPABASE_URL=$NEXT_PUBLIC_SUPABASE_URL
ENV NEXT_PUBLIC_SUPABASE_ANON_KEY=$NEXT_PUBLIC_SUPABASE_ANON_KEY
ENV NEXT_PUBLIC_WEB_SOCKET_URL=$NEXT_PUBLIC_WEB_SOCKET_URL
# Copy package files and install dependencies first for better caching
COPY package*.json ./