# Eclipse Ditto - Smart City Digital Twin - Martinique
services:
  ditto-mongodb:
    image: mongo:6
    container_name: smart-city-ditto-mongodb
    restart: unless-stopped
    networks:
      traefik-public:
        aliases:
          - ditto-mongodb
    volumes:
      - ditto-mongo-data:/data/db

  ditto-policies:
    image: eclipse/ditto-policies:latest
    container_name: smart-city-ditto-policies
    restart: unless-stopped
    hostname: ditto-policies
    depends_on:
      - ditto-mongodb
    environment:
      - TZ=Europe/Berlin
      - BIND_HOSTNAME=0.0.0.0
      - DITTO_JWT_SECRET=my-ditto-jwt-secret-key-12345
      - MONGO_HOST=smart-city-ditto-mongodb
      - MONGO_PORT=27017
      - MONGO_DB=Policies
      - MONGODB_URI=mongodb://smart-city-ditto-mongodb:27017/Policies
      - AKKA_REMOTE_ENABLED=false
    networks:
      traefik-public:
        aliases:
          - ditto-cluster
          - ditto-policies
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.ditto-policies.rule=Host(`ditto-policies.digitribe.fr`)"
      - "traefik.http.routers.ditto-policies.entrypoints=web"
      - "traefik.http.services.ditto-policies.loadbalancer.server.port=8080"

  ditto-things:
    image: eclipse/ditto-things:latest
    container_name: smart-city-ditto-things
    restart: unless-stopped
    hostname: ditto-things
    depends_on:
      - ditto-mongodb
      - ditto-policies
    environment:
      - TZ=Europe/Berlin
      - BIND_HOSTNAME=0.0.0.0
      - DITTO_JWT_SECRET=my-ditto-jwt-secret-key-12345
      - MONGO_HOST=smart-city-ditto-mongodb
      - MONGO_PORT=27017
      - MONGO_DB=Things
      - MONGODB_URI=mongodb://smart-city-ditto-mongodb:27017/Things
      - AKKA_REMOTE_ENABLED=false
      - JAVA_TOOL_OPTIONS=-Dditto.things.authentication.devops.password=ditto-devops-secret
    networks:
      traefik-public:
        aliases:
          - ditto-cluster
          - ditto-things
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.ditto-things.rule=Host(`ditto-things.digitribe.fr`)"
      - "traefik.http.routers.ditto-things.entrypoints=web"
      - "traefik.http.services.ditto-things.loadbalancer.server.port=8080"

  ditto-gateway:
    image: eclipse/ditto-gateway:latest
    container_name: smart-city-ditto-gateway
    restart: unless-stopped
    hostname: ditto-gateway
    depends_on:
      - ditto-things
      - ditto-policies
    environment:
      - TZ=Europe/Berlin
      - BIND_HOSTNAME=0.0.0.0
      - DITTO_JWT_SECRET=my-ditto-jwt-secret-key-12345
      - DITTO_GATEWAY_PROXY_ENABLED=true
      - AKKA_REMOTE_ENABLED=false
      - DITTO_GW_STREAMING_ENABLED=true
      - DITTO_GW_MQTT_BROKER=smart-city-mosquitto:1883
      - DITTO_GW_MQTT_TOPIC_FILTER=smartcity/#
      - DEVOPS_PASSWORD=ditto-devops-secret
      - ENABLE_PRE_AUTHENTICATION=true
      - JAVA_TOOL_OPTIONS=-Dditto.gateway.authentication.devops.password=ditto-devops-secret -Dditto.gateway.authentication.devops.secured=true -Dditto.gateway.authentication.devops.devops-authentication-method=basic
    networks:
      traefik-public:
        aliases:
          - ditto-cluster
          - ditto-gateway
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.ditto-gateway.rule=Host(`ditto.digitribe.fr`)"
      - "traefik.http.routers.ditto-gateway.entrypoints=websecure"
      - "traefik.http.routers.ditto-gateway.tls.certresolver=letsencrypt"
      - "traefik.http.services.ditto-gateway.loadbalancer.server.port=8080"

networks:
  traefik-public:
    external: true

volumes:
  ditto-mongo-data:
    name: smart-city-digital-twin-martinique_ditto-mongo-data
