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


services:
  # ============================================
  # Syslog Consumer-rule - 数据消费规则服务(平台端)
  # ============================================
  syslog-consumer-rule:
    build:
      context: ./consumer-rule-dm
      dockerfile: Dockerfile
    image: syslog-consumer-rule-dm:v1.2.2
    container_name: syslog-consumer-rule-dm
    restart: unless-stopped
    environment:
      # 环境配置
      - SPRING_PROFILES_ACTIVE=prod
      - TZ=Asia/Shanghai
      # 数据库配置
      - SPRING_DATASOURCE_URL=jdbc:dm://192.168.4.99:5237
      - SPRING_DATASOURCE_USERNAME=SYSDBA
      - SPRING_DATASOURCE_PASSWORD=caZ2TcmXNSW8L2Ap
      - SPRING_DATASOURCE_DRIVER-CLASS-NAME=dm.jdbc.driver.DmDriver
      - SPRING_DATASOURCE_HIKARI_SCHEMA=\"PUBLIC\"
      # 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-rule
      - SPRING_DATASOURCE_HIKARI_AUTO-COMMIT=false

      # Redis配置
      - SPRING_REDIS_HOST=192.168.4.99
      - SPRING_REDIS_PORT=6379
      - SPRING_REDIS_PASSWORD=redis_GdGWte
      - SPRING_REDIS_DATABASE=0
      - SPRING_REDIS_TIMEOUT=2000
      - SPRING_CACHE_REDIS_TIME-TO-LIVE=600000
      # Kafka配置
      - SPRING_KAFKA_CONSUMER_BOOTSTRAP-SERVERS=192.168.4.99:9092
      - SPRING_KAFKA_CONSUMER_GROUP-ID=agent-01-syslog-group-dm
      - SPRING_KAFKA_CONSUMER_AUTO-OFFSET-RESET=latest
      - SPRING_KAFKA_CONSUMER_ENABLE-AUTO-COMMIT=false
      - SPRING_KAFKA_CONSUMER_TOPIC=agent-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.99:8087
      - INFLUXDB_TOKEN=JsUyvU8vhQEFlMM_el4Drm87fyh707IhwJNsPBucPghSdbVmdQ-UvmPcyP5NTzWxsRfEz0T51Rw4ebZUuUrmZg==
      - 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

    volumes:
      - /home/syslog/logs:/app/logs
    networks:
      - xdr-network
    privileged: true
# ============================================
# 网络配置
# ============================================
networks:
  xdr-network:
    driver: bridge

