version: '3.8'

services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:8.12.1
    container_name: elasticsearch
    environment:
      - discovery.type=single-node
      - xpack.security.enabled=true
      - ELASTIC_PASSWORD=espasswd
      - xpack.security.http.ssl.enabled=false
      - ES_JAVA_OPTS=-Xms2g -Xmx2g
    ports:
      - 9200:9200
    networks:
      - elk
    volumes:
      - ./es-data:/usr/share/elasticsearch/data

  kibana:
    image: docker.elastic.co/kibana/kibana:8.12.1
    container_name: kibana
    ports:
      - 5601:5601
    networks:
      - elk
    depends_on:
      - elasticsearch
    environment:
      - SERVER_PUBLICBASEURL=https://es.evosphere-solutions.com
      - ELASTICSEARCH_HOSTS=http://elasticsearch:9200
      - ELASTICSEARCH_USERNAME=kibana_user
      - ELASTICSEARCH_PASSWORD=kibanapasswd
      - NODE_OPTIONS=--openssl-legacy-provider

  redis_pc:
    image: redis:7
    container_name: redis_pc
    ports:
      - "6380:6379"
    volumes:
      - ./redis.conf:/usr/local/etc/redis/redis.conf
      - redis_data_pc:/data
    command: [ "redis-server", "/usr/local/etc/redis/redis.conf" ]
    restart: unless-stopped

  rabbitmq_pc:
    image: rabbitmq:3-management
    container_name: rabbitmq_pc
    ports:
      - '5673:5672' # Cổng AMQP
      - '15673:15672' # Cổng web quản lý RabbitMQ
    environment:
      RABBITMQ_DEFAULT_USER: guest
      RABBITMQ_DEFAULT_PASS: guest
    restart: always

volumes:
  redis_data_pc:


networks:
  elk:
    driver: bridge
