# Optional overlay for fully selfhosted forecast backends.
# Usage: docker compose -f docker-compose.yml -f docker-compose.selfhosted.yml --profile selfhosted up -d
#
# Open-Meteo and Bright Sky require significant storage and setup.
# See docs/NEXT_STEPS.md for hardware recommendations.

services:
  open-meteo:
    profiles: ["selfhosted"]
    image: ghcr.io/open-meteo/open-meteo:latest
    container_name: hexawetter-open-meteo
    restart: unless-stopped
    ports:
      - "${OPEN_METEO_PORT:-8082}:8080"
    volumes:
      - open_meteo_data:/data
    environment:
      LOG_LEVEL: info

  brightsky-postgres:
    profiles: ["selfhosted"]
    image: postgis/postgis:16-3.4
    container_name: hexawetter-brightsky-postgres
    restart: unless-stopped
    environment:
      POSTGRES_DB: brightsky
      POSTGRES_USER: brightsky
      POSTGRES_PASSWORD: ${BRIGHTSKY_DB_PASSWORD:-brightsky}
    volumes:
      - brightsky_postgres_data:/var/lib/postgresql/data

  brightsky-redis:
    profiles: ["selfhosted"]
    image: redis:7-alpine
    container_name: hexawetter-brightsky-redis
    restart: unless-stopped
    volumes:
      - brightsky_redis_data:/data

  api:
    profiles: ["selfhosted"]
    environment:
      OPEN_METEO_BASE_URL: http://open-meteo:8080/v1
      BRIGHTSKY_BASE_URL: http://host.docker.internal:${BRIGHTSKY_PORT:-8083}

volumes:
  open_meteo_data:
  brightsky_postgres_data:
  brightsky_redis_data:
