# QuantumLeap for Stellio - Separate instance
# Usage: docker compose -f docker-compose.yml -f docker-compose.quantumleap-stellio.yml up -d
version: '3.8'

services:
  quantumleap-stellio:
    image: fiware/quantum-leap:latest
    container_name: smart-city-quantumleap-stellio
    restart: unless-stopped
    networks:
      - smartcity-shared
      - traefik-public
    environment:
      - CRATE_HOST=smart-city-cratedb-stellio
      - CRATE_PORT=4200
      - CRATE_DB_NAME=quantumleap_stellio
      - QL_CONFIG_DELETE_POLICY=oasis.settings.STELLIO_DELETE_POLICY
    ports:
      - "8669:8668"
    labels:
      - traefik.enable=true
      - traefik.http.routers.quantum-leap-stellio.rule=Host(`quantum-leap-stellio.digitribe.fr`)
      - traefik.http.services.quantum-leap-stellio.loadbalancer.server.port=8668
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8668/version"]
      interval: 30s
      timeout: 10s
      retries: 3
    depends_on:
      - smart-city-cratedb-stellio

  smart-city-cratedb-stellio:
    image: crate:latest
    container_name: smart-city-cratedb-stellio
    restart: unless-stopped
    networks:
      smartcity-shared:
        aliases:
          - smart-city-cratedb-stellio
    # Ports removed for security - accessed only via Docker network by QuantumLeap
    volumes:
      - smart-city-cratedb-stellio-data:/data
    command: -Ccluster.name=stellio
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:4200/"]
      interval: 30s
      timeout: 10s
      retries: 3

volumes:
  smart-city-cratedb-stellio-data:

networks:
  smartcity-shared:
    external: true
  traefik-public:
    external: true
