if [ "$1" = "cleanup" ]
then
- docker-compose down -v
+ docker-compose -f docker/docker-compose.yml down -v
mvn clean
exit
fi
trap 'kill $(jobs -p) 2>/dev/null' EXIT
-docker-compose up -d
+docker-compose -f docker/docker-compose.yml up -d
echo "Waiting for the Kafka-Cluster to become ready..."
-docker-compose exec cli cub kafka-ready -b kafka:9092 1 60 > /dev/null 2>&1 || exit 1
+docker-compose -f docker/docker-compose.yml exec cli cub kafka-ready -b kafka:9092 1 60 > /dev/null 2>&1 || exit 1
echo "Producing messages"
mvn exec:java@producer
+++ /dev/null
-version: '3.2'
-services:
- zookeeper:
- image: confluentinc/cp-zookeeper:7.1.3
- environment:
- ZOOKEEPER_CLIENT_PORT: 2181
- ports:
- - 2181:2181
-
- kafka:
- image: confluentinc/cp-kafka:7.1.3
- environment:
- KAFKA_BROKER_ID: 1
- KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
- KAFKA_LISTENERS: DOCKER://:9092, LOCALHOST://:9082
- KAFKA_ADVERTISED_LISTENERS: DOCKER://kafka:9092, LOCALHOST://localhost:9082
- KAFKA_INTER_BROKER_LISTENER_NAME: DOCKER
- KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: DOCKER:PLAINTEXT, LOCALHOST:PLAINTEXT
- KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
- KAFKA_AUTO_CREATE_TOPICS_ENABLE: "false"
- ports:
- - 9092:9082
- - 9082:9082
- depends_on:
- - zookeeper
-
- 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
- "
-
- cli:
- image: juplo/toolbox
- command: sleep infinity
--- /dev/null
+version: '3.2'
+services:
+ zookeeper:
+ image: confluentinc/cp-zookeeper:7.1.3
+ environment:
+ ZOOKEEPER_CLIENT_PORT: 2181
+ ports:
+ - 2181:2181
+
+ kafka:
+ image: confluentinc/cp-kafka:7.1.3
+ environment:
+ KAFKA_BROKER_ID: 1
+ KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
+ KAFKA_LISTENERS: DOCKER://:9092, LOCALHOST://:9082
+ KAFKA_ADVERTISED_LISTENERS: DOCKER://kafka:9092, LOCALHOST://localhost:9082
+ KAFKA_INTER_BROKER_LISTENER_NAME: DOCKER
+ KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: DOCKER:PLAINTEXT, LOCALHOST:PLAINTEXT
+ KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
+ KAFKA_AUTO_CREATE_TOPICS_ENABLE: "false"
+ ports:
+ - 9092:9082
+ - 9082:9082
+ depends_on:
+ - zookeeper
+
+ 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
+ "
+
+ cli:
+ image: juplo/toolbox
+ command: sleep infinity