Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

docker kafka auto-create topics

Francis Caob0a36f18b464
diff --git a/docker-compose-kafka-multi.yml b/docker-compose-kafka-multi.yml
index 5f031e0a2..280bc7462 100644
--- a/docker-compose-kafka-multi.yml
+++ b/docker-compose-kafka-multi.yml
@@ -70,4 +70,25 @@ services:
KAFKA_AUTHORIZER_CLASS_NAME: kafka.security.authorizer.AclAuthorizer
KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "true"
depends_on:
- - zoo1
\ No newline at end of file
+ - zoo1
+
+ init-kafka:
+ image: confluentinc/cp-kafka:7.2.0
+ depends_on:
+ - kafka1
+ - kafka2
+ - kafka3
+ entrypoint: [ '/bin/sh', '-c' ]
+ command: |
+ "
+ # blocks until kafka is reachable
+ kafka-topics --bootstrap-server kafka1:19092 --list
+
+ echo -e 'Creating kafka topics'
+ kafka-topics --bootstrap-server kafka1:19092 --create --if-not-exists --topic pageview --replication-factor 3 --partitions 3
+ kafka-topics --bootstrap-server kafka2:19093 --create --if-not-exists --topic event --replication-factor 3 --partitions 3
+ kafka-topics --bootstrap-server kafka3:19094 --create --if-not-exists --topic session --replication-factor 3 --partitions 3
+
+ echo -e 'Successfully created the following topics:'
+ kafka-topics --bootstrap-server kafka1:19092 --list
+ "
\ No newline at end of file