X-Git-Url: https://juplo.de/gitweb/?a=blobdiff_plain;f=docker%2Fdocker-compose.yml;h=6b6456699b1307f4bad336a19e37740da399dc65;hb=dc9f461c67105c5f8da8722941d15970b1d2e95c;hp=007f9237e4f7897cd12933294bcfb0bea98c319a;hpb=ae395a9edcd0551a9a0cf0b690d477f9be28aa3d;p=demos%2Fkafka%2Ftraining diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 007f923..6b64566 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -69,16 +69,68 @@ services: depends_on: - zookeeper + schema-registry: + image: confluentinc/cp-schema-registry:7.5.1 + environment: + SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: 'PLAINTEXT://kafka:9092' + SCHEMA_REGISTRY_HOST_NAME: 'schema-registry' + SCHEMA_REGISTRY_LISTENERS: 'http://0.0.0.0:8085' + SCHEMA_REGISTRY_LOG4J_ROOT_LOGLEVEL: 'INFO' + depends_on: + - kafka-1 + - kafka-2 + - kafka-3 + + connect: + image: confluentinc/cp-kafka-connect:7.5.1 + environment: + CONNECT_BOOTSTRAP_SERVERS: 'kafka:9092' + CONNECT_REST_PORT: '8083' + CONNECT_REST_LISTENERS: 'http://0.0.0.0:8083' + CONNECT_REST_ADVERTISED_HOST_NAME: 'connect' + CONNECT_CONFIG_STORAGE_TOPIC: '__connect-config' + CONNECT_OFFSET_STORAGE_TOPIC: '__connect-offsets' + CONNECT_STATUS_STORAGE_TOPIC: '__connect-status' + CONNECT_GROUP_ID: 'kafka-connect' + CONNECT_KEY_CONVERTER_SCHEMAS_ENABLE: 'true' + CONNECT_KEY_CONVERTER: 'io.confluent.connect.avro.AvroConverter' + CONNECT_KEY_CONVERTER_SCHEMA_REGISTRY_URL: 'http://schema-registry:8085' + CONNECT_VALUE_CONVERTER_SCHEMAS_ENABLE: 'true' + CONNECT_VALUE_CONVERTER: 'io.confluent.connect.avro.AvroConverter' + CONNECT_VALUE_CONVERTER_SCHEMA_REGISTRY_URL: 'http://schema-registry:8085' + CONNECT_INTERNAL_KEY_CONVERTER: 'org.apache.kafka.connect.json.JsonConverter' + CONNECT_INTERNAL_VALUE_CONVERTER: 'org.apache.kafka.connect.json.JsonConverter' + CONNECT_OFFSET_STORAGE_REPLICATION_FACTOR: '1' + CONNECT_CONFIG_STORAGE_REPLICATION_FACTOR: '1' + CONNECT_STATUS_STORAGE_REPLICATION_FACTOR: '1' + CONNECT_PLUGIN_PATH: ' /usr/share/java/' + depends_on: + - schema-registry + setup: image: juplo/toolbox command: > bash -c " - kafka-topics --bootstrap-server kafka:9092 --delete --if-exists --topic test - kafka-topics --bootstrap-server kafka:9092 --create --topic test --partitions 2 --replication-factor 3 --config min.insync.replicas=2 - echo Das Topic \'test\' wurde erfolgreich angelegt: - kafka-topics --bootstrap-server kafka:9092 --describe --topic test - echo \'docker-compose restart -t0 setup\' löscht das Topic und legt es neu an - sleep infinity + if [ -e INITIALIZED ] + then + echo -n Bereits konfiguriert: + cat INITIALIZED + kafka-topics --bootstrap-server kafka:9092 --describe --topic test + else + kafka-topics --bootstrap-server kafka:9092 \ + --delete \ + --if-exists \ + --topic test + kafka-topics --bootstrap-server kafka:9092 \ + --create \ + --topic test \ + --partitions 2 \ + --replication-factor 3 \ + --config min.insync.replicas=2 \ + && echo Das Topic \'test\' wurde erfolgreich angelegt: \ + && kafka-topics --bootstrap-server kafka:9092 --describe --topic test \ + && date > INITIALIZED + fi " depends_on: - kafka-1 @@ -96,6 +148,11 @@ services: docker-kafka-server: properties: bootstrap.servers: "kafka:9092" + schema-registry: + url: "http://schema-registry:8085" + connect: + - name: "connect" + url: "http://connect:8083" depends_on: - kafka-1 - kafka-2