version: '3.5'
services:
  parsedmarc:
    build: ./parsedmarc/
    restart: unless-stopped 
    volumes:
      - ./output_files:/output
    command: parsedmarc -c /parsedmarc.ini /input/* --debug
    depends_on:
      - elasticsearch
    networks:
      - parsedmarc-network

  elasticsearch:
    image: elasticsearch:8.12.1
    user: 1000:1000
    restart: unless-stopped
    mem_limit : 4g     #limitation de l'utilisation de la ram 
    environment:
      - discovery.type=single-node
      - xpack.security.enabled=false #desactivation du ssl, pour l'activer : https://www.elastic.co/guide/en/elasticsearch/reference/7.17/configuring-tls-docker.html
      - xpack.security.enrollment.enabled=false
      - "ES_JAVA_OPTS=-Xms2g -Xmx2g" #limitation de l'utilisation de la ram 
    networks:
      - parsedmarc-network
    volumes:
      - 'data01:/usr/share/elasticsearch/data'      

  grafana:
    build: ./grafana/
    restart: unless-stopped 
    ports:
      - 3001:3000
    user: root
    environment:
      GF_INSTALL_PLUGINS: grafana-piechart-panel,grafana-worldmap-panel
    networks:
      - parsedmarc-network
    volumes:
      - ./grafana/ssl:/var/ssl/
      - ./grafana/defaults.ini:/usr/share/grafana/conf/defaults.ini:ro

  geoipupdate:
    image: maxmindinc/geoipupdate
    restart: unless-stopped 
    env_file:
      - .env #editer le fichier avec vos infos https://www.maxmind.com
    environment:
      - "GEOIPUPDATE_EDITION_IDS=GeoLite2-Country"
      - GEOIPUPDATE_PRESERVE_FILE_TIMES=1
    volumes:
      - ./parsedmarc/:/usr/share/GeoIP:rw
    networks:
      - parsedmarc-network


volumes:
  data01:

networks:
  parsedmarc-network:
    ipam:
      config:
        - subnet: 172.80.0.0/16
  