# SASL_PLAINTEXT 单节点 KRaft Kafka（基于 Apache Kafka 官方示例）
#
# Usage:
#   cd tests
#   podman compose -f docker-compose.sasl.yml up -d
#   podman compose -f docker-compose.sasl.yml ps
#   KAFKA_BOOTSTRAP=127.0.0.1:9094 KAFKA_RUNTIME=external \
#     cargo test --test auth --features integration_tests -- --nocapture
#   podman compose -f docker-compose.sasl.yml down -v

services:
  broker:
    image: ${KAFKA_IMAGE:-apache/kafka:4.3.0}
    hostname: broker
    container_name: kafka-sasl-broker
    ports:
      - '9094:9094'
    volumes:
      - ./fixtures/sasl:/etc/kafka/secrets
    environment:
      KAFKA_NODE_ID: 1
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: 'CONTROLLER:PLAINTEXT,SASL_PLAINTEXT:SASL_PLAINTEXT,SASL_PLAINTEXT_HOST:SASL_PLAINTEXT'
      KAFKA_ADVERTISED_LISTENERS: 'SASL_PLAINTEXT_HOST://localhost:9094,SASL_PLAINTEXT://broker:19094'
      KAFKA_PROCESS_ROLES: 'broker,controller'
      KAFKA_CONTROLLER_QUORUM_VOTERS: '1@broker:29093'
      KAFKA_LISTENERS: 'CONTROLLER://:29093,SASL_PLAINTEXT_HOST://:9094,SASL_PLAINTEXT://:19094'
      KAFKA_INTER_BROKER_LISTENER_NAME: 'SASL_PLAINTEXT'
      KAFKA_CONTROLLER_LISTENER_NAMES: 'CONTROLLER'
      CLUSTER_ID: '4L6g3nShT-eMCtK--X86sw'
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
      KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
      KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
      KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
      KAFKA_SHARE_COORDINATOR_STATE_TOPIC_REPLICATION_FACTOR: 1
      KAFKA_SHARE_COORDINATOR_STATE_TOPIC_MIN_ISR: 1
      KAFKA_LOG_DIRS: '/tmp/kraft-combined-logs'
      KAFKA_SASL_ENABLED_MECHANISMS: 'PLAIN'
      KAFKA_SASL_MECHANISM_INTER_BROKER_PROTOCOL: 'PLAIN'
      KAFKA_OPTS: '-Djava.security.auth.login.config=/etc/kafka/secrets/broker_jaas.conf'