version: '3'
services:
  zookeeper:
    image: confluentinc/cp-zookeeper:5.0.0
    ports:
      - 2181:2181
    environment:
      ZOOKEEPER_CLIENT_PORT: 2181
  kafka:
    image: confluentinc/cp-kafka
    depends_on:
      - zookeeper
    ports:
      - 29092:29092
    environment:
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT, PLAINTEXT_HOST:PLAINTEXT
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092, PLAINTEXT_HOST://localhost:29092
      KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
  schema-registry:
    image: confluentinc/cp-schema-registry:5.0.0
    depends_on:
    - zookeeper
    - kafka
    ports:
    - 8081:8081
    - 8082:8082
    volumes:
    - ./conf:/conf
    environment:
      SCHEMA_REGISTRY_HOST_NAME: schema-registry
      SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: PLAINTEXT://kafka:9092
      SCHEMA_REGISTRY_LISTENERS: http://0.0.0.0:8081, https://0.0.0.0:8082
      SCHEMA_REGISTRY_INTER_INSTANCE_PROTOCOL: https
      SCHEMA_REGISTRY_SSL_KEYSTORE_LOCATION: /conf/tls/server.keystore.jks
      SCHEMA_REGISTRY_SSL_KEYSTORE_PASSWORD: ${PASS:-abcdefgh}
      SCHEMA_REGISTRY_SSL_KEY_PASSWORD: ${PASS:-abcdefgh}
      SCHEMA_REGISTRY_SSL_TRUSTSTORE_LOCATION: /conf/tls/server.truststore.jks
      SCHEMA_REGISTRY_SSL_TRUSTSTORE_PASSWORD: abcdefgh
      SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL: zookeeper:2181
  schema-registry-basic-auth:
    image: confluentinc/cp-schema-registry:5.0.0
    depends_on:
      - zookeeper
      - kafka
    ports:
      - 8083:8083
      - 8084:8084
    volumes:
      - ./conf:/conf
    environment:
      SCHEMA_REGISTRY_HOST_NAME: schema-registry2
      SCHEMA_REGISTRY_KAFKASTORE_TOPIC: _schemas2
      SCHEMA_REGISTRY_SCHEMA_REGISTRY_ZK_NAMESPACE: schema_registry2
      SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: PLAINTEXT://kafka:9092
      SCHEMA_REGISTRY_LISTENERS: http://0.0.0.0:8083, https://0.0.0.0:8084
      SCHEMA_REGISTRY_INTER_INSTANCE_PROTOCOL: https
      SCHEMA_REGISTRY_SSL_KEYSTORE_LOCATION: /conf/tls/server.keystore.jks
      SCHEMA_REGISTRY_SSL_KEYSTORE_PASSWORD: ${PASS:-abcdefgh}
      SCHEMA_REGISTRY_SSL_KEY_PASSWORD: ${PASS:-abcdefgh}
      SCHEMA_REGISTRY_SSL_TRUSTSTORE_LOCATION: /conf/tls/server.truststore.jks
      SCHEMA_REGISTRY_SSL_TRUSTSTORE_PASSWORD: abcdefgh
      SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL: zookeeper:2181
      SCHEMA_REGISTRY_AUTHENTICATION_METHOD: BASIC
      SCHEMA_REGISTRY_AUTHENTICATION_REALM: SchemaRegistry
      SCHEMA_REGISTRY_AUTHENTICATION_ROLES: Testers
      SCHEMA_REGISTRY_OPTS: -Djava.security.auth.login.config=/conf/schema-registry/schema-registry.jaas
