diff --git a/.env.example b/.env.example index ed8f8fd57..bf3ece2a7 100644 --- a/.env.example +++ b/.env.example @@ -1,13 +1,13 @@ # General Application Settings ENVIRONMENT="development" -BUSTER_URL="http://web:3000" +BUSTER_URL="http://localhost: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" +DATABASE_URL="postgresql://postgres.your-tenant-id:your-super-secret-and-long-postgres-password@supavisor:5432/postgres" # Pooled Database Connection (for API service, uses Supavisor) -POOLER_URL="postgresql://postgres:your-super-secret-and-long-postgres-password@db:5432/postgres" +POOLER_URL="postgresql://postgres.your-tenant-id:your-super-secret-and-long-postgres-password@supavisor:5432/postgres" # Redis Connection REDIS_URL="redis://buster-redis:6379" # Supabase Connection for API service @@ -25,7 +25,8 @@ 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_URL="http://kong:8000" # External URL for Supabase (Kong proxy) +NEXT_PUBLIC_WS_URL="ws://localhost:3001" 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" diff --git a/docker-compose.yml b/docker-compose.yml index 8d873a282..cbb05bfe4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,12 +34,7 @@ services: - COHERE_API_KEY=${COHERE_API_KEY} ports: - "3001:3001" - deploy: - resources: - limits: - memory: 4G - reservations: - memory: 2G + - "3000:3000" healthcheck: test: ["CMD", "curl", "-f", "http://localhost:3001/health"] interval: 30s @@ -52,29 +47,16 @@ services: condition: service_healthy kong: condition: service_healthy - + web: image: ghcr.io/buster-so/buster/web:latest-arm64 container_name: buster-web - ports: - - "3000:3000" + env_file: + - .env depends_on: 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 + network_mode: "service:api" volumes: buster_redis_data: \ No newline at end of file diff --git a/start.sh b/start.sh deleted file mode 100644 index 06023d123..000000000 --- a/start.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -echo "Starting Supabase..." -cd supabase -docker compose up -d - -echo "Waiting for Supabase to be healthy..." -until curl -s http://localhost:54321/rest/v1/ > /dev/null; do - echo "Waiting for Supabase..." - sleep 5 -done - -echo "Supabase is ready! Starting main services..." -cd .. -docker compose up \ No newline at end of file diff --git a/supabase/.env.example b/supabase/.env.example deleted file mode 100644 index ed8f8fd57..000000000 --- a/supabase/.env.example +++ /dev/null @@ -1,128 +0,0 @@ -# General Application Settings -ENVIRONMENT="development" -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://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. -################################################# - -############ -# 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" \ No newline at end of file diff --git a/supabase/docker-compose.yml b/supabase/docker-compose.yml index 23ba55227..88c4f85ca 100644 --- a/supabase/docker-compose.yml +++ b/supabase/docker-compose.yml @@ -16,6 +16,46 @@ 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 @@ -147,6 +187,52 @@ 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 @@ -206,6 +292,24 @@ 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 @@ -379,7 +483,7 @@ services: - 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 + - POOLER_POOL_MODE=session volumes: - ./volumes/pooler/pooler.exs:/etc/pooler/pooler.exs:ro