# documentation: https://github.com/get-convex/convex-backend/blob/main/self-hosted/README.md
# slogan: Convex is the open-source reactive database for app developers.
# category: backend
# tags: database, reactive, database, ai, agents, chatbot, api, team, bot, flows
# logo: svgs/convex.svg
# port: 6791

services:
  backend:
    image: ghcr.io/get-convex/convex-backend:a9a760ca10399ed42e1b4bb87c78539a235488c7
    volumes:
      - data:/convex/data
    environment:
      - SERVICE_URL_BACKEND_3210
      - SERVICE_URL_SITE_3211
      - INSTANCE_NAME=${INSTANCE_NAME:-self-hosted-convex}
      - INSTANCE_SECRET=${SERVICE_HEX_64_SECRET}
      - CONVEX_RELEASE_VERSION_DEV=${CONVEX_RELEASE_VERSION_DEV:-}
      - ACTIONS_USER_TIMEOUT_SECS=${ACTIONS_USER_TIMEOUT_SECS:-}
      # URL of the Convex API as accessed by the client/frontend.
      - CONVEX_CLOUD_ORIGIN=${SERVICE_URL_BACKEND}
      # URL of Convex HTTP actions as accessed by the client/frontend.
      - CONVEX_SITE_ORIGIN=${SERVICE_URL_SITE}
      - DATABASE_URL=${DATABASE_URL:-}
      - DISABLE_BEACON=${DISABLE_BEACON:?false}
      - REDACT_LOGS_TO_CLIENT=${REDACT_LOGS_TO_CLIENT:?false}
      - DO_NOT_REQUIRE_SSL=${DO_NOT_REQUIRE_SSL:?true}
      - POSTGRES_URL=${POSTGRES_URL:-}
      - MYSQL_URL=${MYSQL_URL:-}
      - RUST_LOG=${RUST_LOG:-info}
      - RUST_BACKTRACE=${RUST_BACKTRACE:-}
      - AWS_REGION=${AWS_REGION:-}
      - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-}
      - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY:-}
      - AWS_SESSION_TOKEN=${AWS_SESSION_TOKEN:-}
      - AWS_S3_FORCE_PATH_STYLE=${AWS_S3_FORCE_PATH_STYLE:-}
      - AWS_S3_DISABLE_SSE=${AWS_S3_DISABLE_SSE:-}
      - AWS_S3_DISABLE_CHECKSUMS=${AWS_S3_DISABLE_CHECKSUMS:-}
      - S3_STORAGE_EXPORTS_BUCKET=${S3_STORAGE_EXPORTS_BUCKET:-}
      - S3_STORAGE_SNAPSHOT_IMPORTS_BUCKET=${S3_STORAGE_SNAPSHOT_IMPORTS_BUCKET:-}
      - S3_STORAGE_MODULES_BUCKET=${S3_STORAGE_MODULES_BUCKET:-}
      - S3_STORAGE_FILES_BUCKET=${S3_STORAGE_FILES_BUCKET:-}
      - S3_STORAGE_SEARCH_BUCKET=${S3_STORAGE_SEARCH_BUCKET:-}
      - S3_ENDPOINT_URL=${S3_ENDPOINT_URL:-}
    healthcheck:
      test: curl -f http://127.0.0.1:3210/version
      interval: 5s
      start_period: 10s

  dashboard:
    image: ghcr.io/get-convex/convex-dashboard:a9a760ca10399ed42e1b4bb87c78539a235488c7
    environment:
      - SERVICE_URL_DASHBOARD_6791
      # URL of the Convex API as accessed by the dashboard (browser).
      - NEXT_PUBLIC_DEPLOYMENT_URL=${SERVICE_URL_BACKEND}
    depends_on:
      backend:
        condition: service_healthy
    healthcheck:
      test: curl -f http://127.0.0.1:6791/
      interval: 5s
      start_period: 5s
