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


services:
  # ============================================
  # Syslog Consumer - 数据消费服务 (平台端)
  # ============================================
  syslog-consumer:
    build:
      context: ./syslog-consumer
      dockerfile: Dockerfile
    image: syslog-consumer:1.2.0
    container_name: syslog-consumer
    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
