# docker-compose.yml

version: '3'
services:
  storage:
    image: supabase/storage-api:latest
    ports:
      - '5000:5000'
    depends_on:
      tenant_db:
        condition: service_healthy
      pg_bouncer:
          condition: service_started
      minio_setup:
          condition: service_completed_successfully
    environment:
      # Server
      SERVER_PORT: 5000
      # Auth
      AUTH_JWT_SECRET: f023d3db-39dc-4ac9-87b2-b2be72e9162b
      AUTH_JWT_ALGORITHM: HS256
      # Single tenant Mode
      DATABASE_URL: postgres://postgres:postgres@tenant_db:5432/postgres
      DATABASE_POOL_URL: postgresql://postgres:postgres@pg_bouncer:6432/postgres
      # Migrations
      DB_INSTALL_ROLES: true # set to false if you want to manage roles yourself
      # Storage
      STORAGE_BACKEND: s3
      STORAGE_S3_BUCKET: supa-storage-bucket  # name of s3 bucket where you want to store objects
      STORAGE_S3_ENDPOINT: http://minio:9000
      STORAGE_S3_FORCE_PATH_STYLE: "true"
      STORAGE_S3_REGION: us-east-1
      AWS_ACCESS_KEY_ID: supa-storage
      AWS_SECRET_ACCESS_KEY: secret1234
      # Upload
      UPLOAD_FILE_SIZE_LIMIT: 524288000
      UPLOAD_FILE_SIZE_LIMIT_STANDARD: 52428800
      UPLOAD_SIGNED_URL_EXPIRATION_TIME: 120
      TUS_URL_PATH: /upload/resumable
      TUS_URL_EXPIRY_MS: 3600000
      # Image Transformation
      IMAGE_TRANSFORMATION_ENABLED: "true"
      IMGPROXY_URL: http://imgproxy:8080
      IMGPROXY_REQUEST_TIMEOUT: 15
      # S3 Protocol
      S3_PROTOCOL_ACCESS_KEY_ID: 625729a08b95bf1b7ff351a663f3a23c
      S3_PROTOCOL_ACCESS_KEY_SECRET: 850181e4652dd023b7a98c58ae0d2d34bd487ee0cc3254aed6eda37307425907

  tenant_db:
    extends:
      service: tenant_db
      file: ./.docker/docker-compose-infra.yml

  pg_bouncer:
    extends:
      service: pg_bouncer
      file: ./.docker/docker-compose-infra.yml

  minio:
    extends:
      service: minio
      file: ./.docker/docker-compose-infra.yml

  minio_setup:
    extends:
      service: minio_setup
      file: ./.docker/docker-compose-infra.yml
    depends_on:
      minio:
        condition: service_healthy

  imgproxy:
    extends:
      service: imgproxy
      file: ./.docker/docker-compose-infra.yml

#  Optional for rate-limiting
#  redis:
#    extends:
#      service: redis
#      file: ./.docker/docker-compose-infra.yml

#  Optional for monitoring
#  pg_bouncer_exporter:
#    extends:
#      service: pg_bouncer_exporter
#      file: ./.docker/docker-compose-monitoring.yml

#  postgres_exporter:
#    extends:
#      service: postgres_exporter
#      file: ./.docker/docker-compose-monitoring.yml
#
#  grafana:
#    extends:
#      service: grafana
#      file: ./.docker/docker-compose-monitoring.yml
#
#  prometheus:
#    extends:
#      service: prometheus
#      file: ./.docker/docker-compose-monitoring.yml
#
#  otel:
#    extends:
#      service: otel-collector
#      file: ./.docker/docker-compose-monitoring.yml
#
#  jaeger:
#    extends:
#      service: jaeger
#      file: ./.docker/docker-compose-monitoring.yml