#
# See: https://github.com/apache/nifi/blob/main/nifi-docker/dockerhub/Dockerfile
#

services:

  init-nifi:
    image: apache/nifi:2.4.0
    entrypoint: ["bash", "-c"]
    command: ["test -f /tmp/bootstrap.conf || cp -v /opt/nifi/nifi-current/conf/* /tmp"]
    volumes:
      - init-nifi-conf:/opt/nifi/nifi-current/conf
      - ./data/nifi/conf:/tmp

  nifi:
    image: apache/nifi:2.4.0
    ports:
      - "8443:8443"
    volumes:
      - ./data/nifi/conf:/opt/nifi/nifi-current/conf
      - ./data/nifi/database_repository:/opt/nifi/nifi-current/database_repository
      - ./data/nifi/flowfile_repository:/opt/nifi/nifi-current/flowfile_repository
      - ./data/nifi/content_repository:/opt/nifi/nifi-current/content_repository
      - ./data/nifi/provenance_repository:/opt/nifi/nifi-current/provenance_repository
      - ./data/nifi/python_extensions:/opt/nifi/nifi-current/python_extensions
      - ./data/nifi/nar_extensions:/opt/nifi/nifi-current/nar_extensions
      - ./data/nifi/state:/opt/nifi/nifi-current/state
      - ./data/nifi/logs:/opt/nifi/nifi-current/logs
    environment:
      - NIFI_WEB_HTTPS_HOST=nifi
      - NIFI_WEB_HTTPS_PORT=8443
      - NIFI_JVM_HEAP_INIT=8g
      - NIFI_JVM_HEAP_MAX=16g
      - SINGLE_USER_CREDENTIALS_USERNAME=admin
      - SINGLE_USER_CREDENTIALS_PASSWORD=@hello@world@ # at least 12 characters
    depends_on:
      - init-nifi
    hostname: nifi
    restart: unless-stopped

  registry:
    image: apache/nifi-registry:2.4.0
    ports:
      - "18080:18080"
    volumes:
      - ./data/registry/database:/opt/nifi-registry/nifi-registry-current/database
      - ./data/registry/flow_storage:/opt/nifi-registry/nifi-registry-current/flow_storage
      - ./data/registry/logs:/opt/nifi-registry/nifi-registry-current/logs
    environment:
      - NIFI_REGISTRY_WEB_HTTP_PORT=18080
    hostname: registry
    restart: unless-stopped

volumes:
  init-nifi-conf:
