version: "3.8"
services:
  nae-admin:
    image: <Netgrif Docker repository>/netgrif-admin:latest
    restart: no
    container_name: netgrif-platform-admin
    healthcheck:
      test: [ "CMD", "sh", "-c", "curl -sf http://localhost:8888/manage/health | grep UP" ]
      interval: 30s
      timeout: 10s
      retries: 10
    environment:
      netgrif.admin.namespace: netgrif
      netgrif.admin.data.mongodb.uri: mongodb://nae-mongodb/netgrif_admin
      netgrif.admin.data.redis.host: nae-redis
      netgrif.admin.data.redis.namespace: netgrif
      netgrif.admin.setup.admin.password: password
      netgrif.admin.setup.zones[0].name: z1
      netgrif.admin.setup.zones[0].description: "Private ZONE je urÄenÃ© pre Workery, ktorÃ© budÃº pracovaÅ¥ s private procesmi"
    ports:
      - "8888:8888"
      - "9999:9999"
    depends_on:
      nae-mongodb:
        condition: service_started
      nae-redis:
        condition: service_started
    networks:
      - netgrif-platformnet
    extra_hosts:
      - "host.docker.internal:host-gateway"

  nae-gateway:
    image: <Netgrif Docker repository>/netgrif-gateway:latest
    restart: no
    container_name: netgrif-platform-gateway
    healthcheck:
      test: [ "CMD", "sh", "-c", "curl -sf http://localhost:8800/manage/health | grep UP" ]
      interval: 30s
      timeout: 10s
      retries: 10
    environment:
      netgrif.gateway.node.zone: z1
      netgrif.gateway.node.host: nae-gateway
      netgrif.gateway.node.admin-node.http-host: nae-admin
      netgrif.gateway.node.admin-node.grpc-host: nae-admin
    ports:
      - "8800:8800"
      - "9900:9900"
    depends_on:
      nae-admin:
        condition: service_healthy
      nae-root-engine:
        condition: service_healthy
    networks:
      - netgrif-platformnet
    extra_hosts:
      - "host.docker.internal:host-gateway"

  nae-search:
    image: <Netgrif Docker repository>/netgrif-search:latest
    restart: no
    container_name: netgrif-platform-search
    healthcheck:
      test: [ "CMD", "sh", "-c", "curl -sf http://localhost:8600/manage/health | grep UP" ]
      interval: 30s
      timeout: 10s
      retries: 10
    environment:
      netgrif.search.node.rest-port: 8600
      netgrif.search.node.grpc-port: 9600
      netgrif.search.data.elasticsearch.url: nae-elasticsearch
      netgrif.search.data.redis.host: nae-redis
      netgrif.search.node.admin-node.host: nae-admin
      netgrif.search.node.in-cloud: true
      netgrif.search.node.host: nae-search
      netgrif.search.data.redis.namespace: netgrif
      netgrif.search.node.zone: z1
      netgrif.search.security.server-patterns: /v3/api-docs,/v3/api-docs/**,/swagger-ui.html,/swagger-ui/**,/api/public/**,/manage/**
    ports:
      - "8600:8600"
      - "9600:9600"
    depends_on:
      nae-admin:
        condition: service_healthy
      nae-elasticsearch:
        condition: service_started
      nae-root-engine:
        condition: service_healthy
    networks:
      - netgrif-platformnet
    extra_hosts:
      - "host.docker.internal:host-gateway"

  nae-root-engine:
    image: <Netgrif Docker repository>/netgrif-nae-worker:latest
    restart: no
    container_name: netgrif-platform-root-engine
    healthcheck:
      test: [ "CMD", "sh", "-c", "curl -sf http://localhost:8080/manage/health | grep UP" ]
      interval: 30s
      timeout: 10s
      retries: 10
    environment:
      netgrif.engine.server.port: 8080
      netgrif.engine.data.database-name: netgrif_nae_root
      netgrif.engine.data.mongodb.uri: mongodb://nae-mongodb
      netgrif.engine.data.elasticsearch.url: nae-elasticsearch
      netgrif.engine.data.redis.host: nae-redis
      netgrif.engine.data.redis.namespace: netgrif
      netgrif.worker.node.name: NETGRIF Root Worker
      netgrif.worker.node.host: nae-root-engine
      netgrif.worker.node.node-type: ENGINE_ROOT
      netgrif.worker.node.admin-node.host: nae-admin
      netgrif.worker.node.in-cloud: false
      netgrif.worker.node.root: true
      netgrif.admin.client.zone: z1
      netgrif.otel.traces.exporter: none
      netgrif.otel.metrics.exporter: none
      netgrif.otel.logs.exporter: none
      netgrif.engine.logging.file.path: log
      netgrif.engine.management.endpoints.web.exposure.include: "*"
      netgrif.engine.management.health.ldap.enabled: false
      netgrif.engine..main.allow-bean-definition-overriding: true
      netgrif.engine.management.health.mail.enabled: false
      netgrif.engine.management.endpoint.health.show-details: always
      netgrif.engine.management.metrics.export.simple: enabled
      netgrif.engine.management.endpoints.web.base-path: /manage
      netgrif.engine.management.metrics.storage.cron: "0 0 2 * * *"
      netgrif.engine.security.server-patterns: /api/auth/signup,/api/auth/token/verify,/api/auth/reset,/api/auth/recover,/v3/api-docs,/v3/api-docs/**,/swagger-ui.html,/swagger-ui/**,/api/public/**,/manage/**
    ports:
      - "8080:8080"
      - "9090:9090"
    depends_on:
      nae-admin:
        condition: service_healthy
      nae-mongodb:
        condition: service_started
      nae-elasticsearch:
        condition: service_started
      nae-redis:
        condition: service_started
      nae-minio:
        condition: service_started
    networks:
      - netgrif-platformnet
    extra_hosts:
      - "host.docker.internal:host-gateway"
    volumes:
      - ./custom:/opt/netgrif/engine/modules/custom

  #  nae-worker1:
  #    image: <Netgrif Docker repository>/netgrif-nae-worker:latest
  #    restart: no
  #    container_name: netgrif-platform-worker1-engine
  #    healthcheck:
  #      test: [ "CMD", "sh", "-c", "curl -sf http://localhost:8080/manage/health | grep UP" ]
  #      interval: 30s
  #      timeout: 10s
  #      retries: 10
  #    environment:
  #      server.port: 8080
  #      DATABASE_NAME: netgrif_nae_worker1
  #      MONGO_URI: mongodb://nae-mongodb
  #      ELASTIC_URL: nae-elasticsearch
  #      REDIS_HOST: nae-redis
  #      ENGINE_NAME: NETGRIF Worker1
  #      ENGINE_HOST: nae-worker1
  #      ENGINE_NODE_TYPE: ENGINE
  #      spring.session.redis.namespace: netgrif
  #      nae.uri.name: worker1
  #      ADMIN_HOST: nae-admin
  #      ENGINE_IN_CLOUD: false
  #      ENGINE_IS_ROOT: false
  #      ENGINE_REST_PORT: 8080
  #      ENGINE_GRPC_PORT: 9090
  #      netgrif.admin.client.zone: z1
  #      otel.traces.exporter: none
  #      otel.metrics.exporter: none
  #      otel.logs.exporter: none
  #      management.health.ldap.enabled: false
  #      management.health.mail.enabled: false
  #      management.endpoint.health.show-details: always
  #      logging.file.path: log
  #      management.endpoints.web.exposure.include: "*"
  #      nae.security.server-patterns: /api/auth/signup,/api/auth/token/verify,/api/auth/reset,/api/auth/recover,/v3/api-docs,/v3/api-docs/**,/swagger-ui.html,/swagger-ui/**,/api/public/**,/manage/**
  #      nae.security.anonymous-exceptions: /api/auth/signup,/api/auth/token/verify,/api/auth/reset,/api/auth/recover,/manage/**
  #    ports:
  #      - "8081:8080"
  #      - "9091:9090"
  #    depends_on:
  #      nae-admin:
  #        condition: service_healthy
  #      nae-mongodb:
  #        condition: service_started
  #      nae-elasticsearch:
  #        condition: service_started
  #      nae-redis:
  #        condition: service_started
  #      nae-minio:
  #        condition: service_started
  #      nae-root-engine:
  #        condition: service_healthy
  #    networks:
  #      - netgrif-platformnet
  #    extra_hosts:
  #      - "host.docker.internal:host-gateway"
  #    volumes:
  #      - ./custom:/opt/netgrif/engine/modules/custom

  nae-mongodb:
    image: mongo:8.0.3
    healthcheck:
      test: [ "CMD", "mongosh", "--eval", "db.adminCommand('ping')" ]
      interval: 10s
      timeout: 5s
      retries: 10
    ports:
      - "27017:27017"
    networks:
      - netgrif-platformnet

  nae-elasticsearch:
    image: elasticsearch:8.15.3
    healthcheck:
      test: [ "CMD", "curl", "-sf", "http://localhost:9200/_cluster/health?wait_for_status=yellow&timeout=1s" ]
      interval: 10s
      timeout: 5s
      retries: 10
    environment:
      cluster.name: elasticsearch
      discovery.type: single-node
      http.host: 0.0.0.0
      xpack.security.enabled: false
      transport.host: 0.0.0.0
    ports:
      - "9200:9200"
      - "9300:9300"
    networks:
      - netgrif-platformnet

  nae-redis:
    image: redis:7.4.1
    healthcheck:
      test: [ "CMD", "redis-cli", "ping" ]
      interval: 10s
      timeout: 5s
      retries: 10
    ports:
      - "6379:6379"
    networks:
      - netgrif-platformnet

  nae-minio:
    image: docker.io/bitnami/minio:2022
    healthcheck:
      test: [ "CMD", "curl", "-sf", "http://localhost:9000/minio/health/ready" ]
      interval: 10s
      timeout: 5s
      retries: 10
    ports:
      - '9000:9000'
      - '9001:9001'
    environment:
      MINIO_ROOT_USER: root
      MINIO_ROOT_PASSWORD: password
      MINIO_DEFAULT_BUCKETS: default
    volumes:
      - 'minio_data:/data'
    networks:
      - netgrif-platformnet

volumes:
  minio_data:
    driver: local

networks:
  netgrif-platformnet:
    driver: bridge
    name: netgrif-platformnet
