version: '1'
services:

  processor:
    image: "processor:1"
    container_name: "processor"
    restart: always
    environment:
      - NODE_ENV=dev
    network_mode: host
    depends_on: 
      - redis
      - mysql 
    build: 
      context: ./docker_services/processor
      dockerfile: dockerfile
    
      
  mysql: 
    image: "mysql/mysql-server:8.0"
    restart: always
    container_name: "mysql"
    ports: 
      - "3306:3306"
    volumes:
      - mysql-data:/var/lib/mysql
    environment: 
      MYSQL_ROOT_PASSWORD: "root"
      MYSQL_ROOT_HOST: "%"

  redis:
    image: "redis"
    restart: always
    container_name: "redis"
    volumes:
      - redis-data:/data
    ports:
        - "6379:6379"

  elasticsearch: 
    image: "docker.elastic.co/elasticsearch/elasticsearch:7.10.2"
    restart: always
    container_name: "dev.elasticsearch"
    ports: 
      - 9200:9200
    volumes:
      - elasticsearch-data:/usr/share/elasticsearch/data
    environment: 
      - discovery.type=single-node
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    networks:
      - "elastic"

  kibana:
    image: docker.elastic.co/kibana/kibana:7.10.2
    container_name: "dev.kibana"
    ports:
      - 5601:5601
    environment:
      ELASTICSEARCH_URL: http://elasticsearch:9200
      ELASTICSEARCH_HOSTS: http://elasticsearch:9200
    networks:
      - "elastic"

volumes:
  mysql-data:
  redis-data:
  elasticsearch-data:

networks:
  elastic:
    driver: bridge