# EB deployment template — variables substituted by CI before packaging.
#
# CI substitutes ONLY: IMAGE_WEB, IMAGE_MCP  (via envsubst '$IMAGE_WEB $IMAGE_MCP')
#
# All other ${VAR} references are intentionally left as-is.
# EB exports every environment property as a host shell variable before invoking
# docker compose, so Docker Compose resolves them at container start time.
# (Same pattern as huginn/docker-compose.prod.yml)
#
# EB env vars required (set via aws elasticbeanstalk update-environment or CDK):
#   DJANGO_SECRET_KEY, DATABASE_URL, DJANGO_ALLOWED_HOSTS, CSRF_TRUSTED_ORIGINS
#   ANTHROPIC_API_KEY   — Galdr AI engine (secret, set manually in EB env)
#   GALDR_MODEL         — set by CDK (default: claude-sonnet-4-5)
#   GITHUB_TOKEN        — optional but recommended: PAT with Issues:write on GITHUB_BUG_REPO
#   GITHUB_BUG_REPO     — optional; default phainestai/mimir when resolved on host
#   MIMIR_GIT_REVISION  — set automatically by CI to release tag or branch-sha

services:
  web:
    image: ${IMAGE_WEB}
    ports:
      - "80:8000"
    environment:
      DJANGO_SETTINGS_MODULE: mimir.settings
      MIMIR_ENV: prod
      DJANGO_SECRET_KEY: ${DJANGO_SECRET_KEY}
      DATABASE_URL: ${DATABASE_URL}
      DJANGO_ALLOWED_HOSTS: ${DJANGO_ALLOWED_HOSTS}
      CSRF_TRUSTED_ORIGINS: ${CSRF_TRUSTED_ORIGINS}
      COOKIE_SECURE: ${COOKIE_SECURE:-true}
      ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY}
      GALDR_MODEL: ${GALDR_MODEL}
      AWS_SES_REGION_NAME: ${AWS_SES_REGION_NAME:-us-east-1}
      DEFAULT_FROM_EMAIL: ${DEFAULT_FROM_EMAIL:-noreply@featurefactory.io}
      AWS_SES_CONFIGURATION_SET: ${AWS_SES_CONFIGURATION_SET:-}
      FRONTEND_URL: ${FRONTEND_URL:-https://mimir.featurefactory.io}
      GITHUB_TOKEN: ${GITHUB_TOKEN:-}
      GITHUB_BUG_REPO: ${GITHUB_BUG_REPO:-phainestai/mimir}
      BUG_REPORT_DRY_RUN: ${BUG_REPORT_DRY_RUN:-}
      MIMIR_GIT_REVISION: ${MIMIR_GIT_REVISION:-unknown}
    restart: unless-stopped

  # mcp-facade is a client-side image (Docker Hub: featurefactory/mimir-mcp).
  # End users run it locally in their IDE pointing at the production URL.
  # It is NOT deployed on EB.
