# ============================================
# Syslog Consumer 部署配置
# ============================================
# 使用方法: docker compose -f docker-compose-consumer.yaml up -d
# ============================================


services:
  # ============================================
  # Syslog Consumer-rule - 数据消费规则服务(平台端)
  # ============================================
  syslog-consumer:
    build:
      context: ./consumer-rule
      dockerfile: Dockerfile
    image: syslog-consumer-rule:1.0.1    
    container_name: syslog-consumer-rule
    restart: unless-stopped
    environment:
      # 环境配置
      - SPRING_PROFILES_ACTIVE=prod
      - TZ=Asia/Shanghai
      # 数据库配置
      - spring.datasource.url=jdbc:postgresql://192.168.4.26:5432/ecosys
      - spring.datasource.username=postgres
      - spring.datasource.password=caZ2TcmXNSW8L2Ap
      - spring.datasource.driver-class-name=org.postgresql.Driver
      # HikariCP 连接池配置
      - spring.datasource.hikari.maximum-pool-size=50
      - spring.datasource.hikari.minimum-idle=5
      - spring.datasource.hikari.connection-timeout=30000
      - spring.datasource.hikari.idle-timeout=600000
      - spring.datasource.hikari.max-lifetime=900000
      - spring.datasource.hikari.pool-name=HikariPool-SyslogConsumer
      - spring.datasource.hikari.auto-commit=false
      - spring.datasource.hikari.schema=public
      # Redis配置
      - spring.redis.host=192.168.4.26
      - spring.redis.port=6379
      - spring.redis.password=123456
      - spring.redis.database=0
      - spring.redis.timeout=2000
      - spring.cache.redis.time-to-live=600000
      # Kafka配置
      - spring.kafka.consumer.bootstrap-servers=192.168.4.26:9092
      - spring.kafka.consumer.group-id=agent-01-syslog-group
      - spring.kafka.consumer.auto-offset-reset=latest
      - spring.kafka.consumer.enable-auto-commit=false
      - spring.kafka.consumer.topic=agenet-01-syslog-topic
      - spring.kafka.consumer.max-poll-records=1000
      - spring.kafka.listener.ack-mode=manual
      - spring.kafka.listener.concurrency=2
      - spring.kafka.listener.type=batch
      # InfluxDB配置
      - influxdb.url=http://192.168.4.26:8087
      - influxdb.token=LFjXZyRxTf1V84oN-wwjhSjS4qIK-ZMoHzQJB67ir3qHNSBVJbMcTkPuNmM0cNxvzFEDWLYNzrz1VJKMitY5hw==
      - influxdb.org=influxdb
      - influxdb.bucket=yelangbucket
      - influxdb.batch.size=1000
      - influxdb.flush.interval=1000
      - influxdb.connection.timeout=30s
      - influxdb.connection.read-timeout=30s
      - influxdb.connection.write-timeout=60s
      # 定时任务配置
      - spring.task.scheduling.pool.size=10
      # 日志配置
      - logging.level.com.common.schedule=INFO
      - logging.level.com.common.service=INFO

      # JVM配置
      - JAVA_OPTS=-Xms1024m -Xmx4096m -XX:+UseG1GC -XX:MaxGCPauseMillis=200
    ports:
      - "8289:8289"
    volumes:
      - /home/syslog/logs:/app/logs
    networks:
      - xdr-network
  #
# ============================================
# 网络配置
# ============================================
networks:
  xdr-network:
    driver: bridge

