Cruise Control wird in einem Docker-Image gebaut
authorKai Moritz <kai@juplo.de>
Sun, 5 Nov 2023 14:19:28 +0000 (15:19 +0100)
committerKai Moritz <kai@juplo.de>
Fri, 10 Nov 2023 12:39:26 +0000 (13:39 +0100)
- Der Build ist so wesentlich einfacher reproduzierbar, so dass er auch
  von den Teilnehmern ausgeführt werden kann.
- Da noch nicht gelöst wrude, wie das für das Sammeln der Laufzeitdaten
  benötigte JAR `cruise-control-metrics-reporter.jar` in die Broker
  hereingereicht werden kann, wurde die entsprechende Konfiguration in
  den Brokern vorübergehend entfernt.

.dockerignore [deleted file]
.gitignore [deleted file]
.gitmodules [deleted file]
Dockerfile
README.sh
cruise-control [deleted submodule]
docker/docker-compose.yml

diff --git a/.dockerignore b/.dockerignore
deleted file mode 100644 (file)
index 92dc507..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-*
-!cruise-control/*.sh
-!cruise-control/*/build/*libs
-!cruise-control/config
diff --git a/.gitignore b/.gitignore
deleted file mode 100644 (file)
index 799b81f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-docker/cruise-control-metrics-reporter.jar
diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644 (file)
index 9807436..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-[submodule "cruise-control"]
-       path = cruise-control
-       url = https://github.com/linkedin/cruise-control.git
index aedfbab..fe9d7bd 100644 (file)
@@ -1,7 +1,19 @@
 ARG VERSION=7.5.1
+
+FROM eclipse-temurin:17-jdk-focal
+
+RUN apt update
+RUN apt install -y git
+WORKDIR /tmp
+RUN git clone -b migrate_to_kafka_2_5 https://github.com/linkedin/cruise-control.git
+WORKDIR cruise-control
+RUN ./gradlew jar
+  
 FROM confluentinc/cp-kafka-connect:${VERSION}
 USER root
-COPY cruise-control /opt/cruise-control/
+COPY --from=0 /tmp/cruise-control/config /opt/cruise-control/config/
+COPY --from=0 /tmp/cruise-control/cruise-control/build /opt/cruise-control/cruise-control/build/
+COPY --from=0 /tmp/cruise-control/kafka-cruise-control-start.sh /opt/cruise-control/
 WORKDIR /opt/cruise-control
 RUN wget -O - https://github.com/linkedin/cruise-control-ui/releases/download/v0.4.0/cruise-control-ui-0.4.0.tar.gz | tar -xzv
 ENV BOOTSTRAP_SERVERS=localhost:9092
index f844991..d228c29 100755 (executable)
--- a/README.sh
+++ b/README.sh
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+IMAGE=juplo/cruise-control
+
 if [ "$1" = "cleanup" ]
 then
   docker-compose -f docker/docker-compose.yml down -t0 -v --remove-orphans
@@ -7,13 +9,18 @@ then
   exit
 fi
 
-git submodule update --init cruise-control || exit 1
-(cd cruise-control; ./gradlew jar) || exit 1
-(cd docker; ln -sf ../cruise-control/cruise-control-metrics-reporter/build/libs/cruise-control-metrics-reporter-*.jar cruise-control-metrics-reporter.jar)
-docker build -t juplo/cruise-control .
+docker-compose -f docker/docker-compose.yml up -d --remove-orphans kafka-1 kafka-2 kafka-3
 
-docker-compose -f docker/docker-compose.yml up --remove-orphans setup || exit 1
-docker-compose -f docker/docker-compose.yml ps
+if [[
+  $(docker image ls -q $IMAGE) == "" ||
+  "$1" = "build"
+]]
+then
+  DOCKER_BUILDKIT=0 docker build -t juplo/cruise-control . || exit 1
+else
+  echo "Using image existing images:"
+  docker image ls $IMAGE
+fi
 
 docker-compose -f docker/docker-compose.yml up --remove-orphans setup || exit 1
 docker-compose -f docker/docker-compose.yml up -d producer consumer-1 consumer-2
diff --git a/cruise-control b/cruise-control
deleted file mode 160000 (submodule)
index 1f30e83..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 1f30e8353a06dd76f664334a175254f9090dcded
index c616dd0..f126ce3 100644 (file)
@@ -21,10 +21,7 @@ services:
       KAFKA_INTER_BROKER_LISTENER_NAME: BROKER
       KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 3
       KAFKA_AUTO_CREATE_TOPICS_ENABLE: "false"
-      KAFKA_METRIC_REPORTERS: com.linkedin.kafka.cruisecontrol.metricsreporter.CruiseControlMetricsReporter
-      KAFKA_CRUISE_CONTROL_METRICS_REPORTER_BOOTSTRAP_SERVERS: localhost:9092
     volumes:
-      - ./cruise-control-metrics-reporter.jar:/usr/share/java/kafka/cruise-control-metrics-reporter.jar:ro
       - kafka-1-data:/var/lib/kafka/data
     ports:
       - 9081:9081
@@ -43,10 +40,7 @@ services:
       KAFKA_INTER_BROKER_LISTENER_NAME: BROKER
       KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 3
       KAFKA_AUTO_CREATE_TOPICS_ENABLE: "false"
-      KAFKA_METRIC_REPORTERS: com.linkedin.kafka.cruisecontrol.metricsreporter.CruiseControlMetricsReporter
-      KAFKA_CRUISE_CONTROL_METRICS_REPORTER_BOOTSTRAP_SERVERS: localhost:9092
     volumes:
-      - ./cruise-control-metrics-reporter.jar:/usr/share/java/kafka/cruise-control-metrics-reporter.jar:ro
       - kafka-2-data:/var/lib/kafka/data
     ports:
       - 9092:9082
@@ -70,10 +64,7 @@ services:
       KAFKA_INTER_BROKER_LISTENER_NAME: BROKER
       KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 3
       KAFKA_AUTO_CREATE_TOPICS_ENABLE: "false"
-      KAFKA_METRIC_REPORTERS: com.linkedin.kafka.cruisecontrol.metricsreporter.CruiseControlMetricsReporter
-      KAFKA_CRUISE_CONTROL_METRICS_REPORTER_BOOTSTRAP_SERVERS: localhost:9092
     volumes:
-      - ./cruise-control-metrics-reporter.jar:/usr/share/java/kafka/cruise-control-metrics-reporter.jar:ro
       - kafka-3-data:/var/lib/kafka/data
     ports:
       - 9083:9083
@@ -92,10 +83,7 @@ services:
       KAFKA_INTER_BROKER_LISTENER_NAME: BROKER
       KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 3
       KAFKA_AUTO_CREATE_TOPICS_ENABLE: "false"
-      KAFKA_METRIC_REPORTERS: com.linkedin.kafka.cruisecontrol.metricsreporter.CruiseControlMetricsReporter
-      KAFKA_CRUISE_CONTROL_METRICS_REPORTER_BOOTSTRAP_SERVERS: localhost:9092
     volumes:
-      - ./cruise-control-metrics-reporter.jar:/usr/share/java/kafka/cruise-control-metrics-reporter.jar:ro
       - kafka-4-data:/var/lib/kafka/data
     ports:
       - 9084:9084