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


services:
  # ============================================
  # Syslog Consumer - 数据消费服务 (平台端)
  # ============================================
  syslog-consumer:
    build:
      context: ./syslog-consumer-rule
      dockerfile: Dockerfile
    image: syslog-consumer-rule:1.2.0
    container_name: syslog-consumer-rule
    restart: unless-stopped
    environment:
      # 环境配置
      - SPRING_PROFILES_ACTIVE=dev
      - TZ=Asia/Shanghai
      # 数据库配置
      - SPRING_DATASOURCE_URL=jdbc:postgresql://117.72.68.72:54329/ecosys
      - SPRING_DATASOURCE_USERNAME=postgres
      - SPRING_DATASOURCE_PASSWORD=TnLanWaidYSwTSG5
      - 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.222.131
      - SPRING_REDIS_PORT=6379
      - SPRING_REDIS_PASSWORD=
      - SPRING_REDIS_DATABASE=0
      - SPRING_REDIS_TIMEOUT=2000
      - SPRING_CACHE_REDIS_TIME_TO_LIVE=600000
      # Kafka配置
      - SPRING_KAFKA_CONSUMER_BOOTSTRAP_SERVERS=192.168.222.130:9092
      - SPRING_KAFKA_CONSUMER_GROUP_ID=test-group-app
      - SPRING_KAFKA_CONSUMER_AUTO_OFFSET_RESET=latest
      - SPRING_KAFKA_CONSUMER_ENABLE_AUTO_COMMIT=false
      - SPRING_KAFKA_CONSUMER_TOPIC=test-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.222.131:8086
      - INFLUXDB_TOKEN=3Tvu-IZWtaY03UDkbUDlufD0kxn85keo9LhYQcv2Cxk0LJmXqqHkNVrO664DbaJAYwoGI7UIg904KqZC7Q_ZFA==
      - INFLUXDB_ORG=yelang
      - 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
      # Elasticsearch配置
      - SPRING_ELASTICSEARCH_URIS=http://192.168.1.174:9200
      - SPRING_ELASTICSEARCH_USERNAME=CONTAINER_NAME
      - SPRING_ELASTICSEARCH_PASSWORD=t2NZCiajmdazxBrF
      - SPRING_ELASTICSEARCH_CONNECTION_TIMEOUT=10s
      - SPRING_ELASTICSEARCH_SOCKET_TIMEOUT=30s
      # API配置
      - INTERLOCKING_API_KEY=a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6
      - INTERLOCKING_API_BASE_URL=http://192.168.222.131:8089/xdrservice/interlocking
      # 探针心跳配置
      - PROBE_HEARTBEAT_ENABLED=true
      - PROBE_HEARTBEAT_OFFLINE_THRESHOLD_MINUTES=10
      - PROBE_STATUS_CHECK_CRON=0 */10 * * * ?
      - PROBE_HEARTBEAT_TENANT_ID=000000
      - PROBE_HEARTBEAT_HISTORY_KEEP_DAYS=10
      - PROBE_HEARTBEAT_HISTORY_CLEANUP_ENABLED=true
      - PROBE_HISTORY_CLEANUP_CRON=0 0 1 * * ?
      # 告警健康检查配置
      - ALARM_HEALTH_CHECK_ALARM_HOURS=4
      - ALARM_HEALTH_CHECK_ALARM_VISIT_HOURS=2
      - ALARM_HEALTH_CHECK_ENABLED=true
      # 关联分析规则配置
      - ANALYSIS_REALTIME_ENABLED=true
      - ANALYSIS_REALTIME_CHECK_INTERVAL_SECONDS=10
      # 分区表检查配置
      - PARTITION_CHECK_TOMORROW_ENABLED=true
      - PARTITION_CHECK_FUTURE_DAYS=7
      - PARTITION_AUTO_CREATE=true
      # 定时任务配置
      - SPRING_TASK_SCHEDULING_POOL_SIZE=10
      # 日志配置
      - LOGGING_LEVEL_COM_COMMON_SCHEDULE=INFO
      - LOGGING_LEVEL_COM_COMMON_SERVICE=INFO
      # ETL配置
      - ETL_BATCH_PAGE_SIZE=1000
      - ETL_BATCH_INSERT_BATCH_SIZE=500
      - ETL_SCHEDULE_CRON=0 0 2 * * ?
      # JVM配置
      - JAVA_OPTS=-Xms512m -Xmx1024m -XX:+UseG1GC -XX:MaxGCPauseMillis=200
    ports:
      - "8089:8089"
    volumes:
      - /home/syslog/logs:/app/logs
    networks:
      - xdr-network


# ============================================
# 网络配置
# ============================================
networks:
  xdr-network:
    driver: bridge
