diff --git a/cruise-control/Dockerfile b/cruise-control/Dockerfile new file mode 100644 index 0000000..310964f --- /dev/null +++ b/cruise-control/Dockerfile @@ -0,0 +1,23 @@ +FROM gradle:4.8-jdk8-slim +ARG VERSION=2.0.18 +USER root +RUN apt-get update && apt-get install -y git +RUN git clone -b ${VERSION} https://github.com/linkedin/cruise-control.git +RUN cd cruise-control && gradle jar copyDependantLibs + +# The container is made to work with github.com/Yolean/kubernetes-kafka, so we try to use a common base +FROM solsson/jdk-opensource:11.0.1@sha256:740feb6c1ecbdf2beac1dc41405c3215511b90d83a7211f805e88f92946dd2a9 +ARG SOURCE_REF +ARG SOURCE_TYPE +ARG DOCKERFILE_PATH +ARG VERSION=2.0.6 + +RUN mkdir -p /opt/cruise-control +COPY --from=0 /home/gradle/cruise-control/cruise-control/build/libs/cruise-control-${VERSION}.jar /opt/cruise-control/cruise-control/build/libs/cruise-control.jar +COPY --from=0 /home/gradle/cruise-control/config /opt/cruise-control/config +COPY --from=0 /home/gradle/cruise-control/kafka-cruise-control-start.sh /opt/cruise-control/ +COPY --from=0 /home/gradle/cruise-control/cruise-control/build/dependant-libs /opt/cruise-control/cruise-control/build/dependant-libs +COPY opt/cruise-control /opt/cruise-control/ + +EXPOSE 8090 +CMD [ "/opt/cruise-control/start.sh" ] diff --git a/cruise-control/README.md b/cruise-control/README.md new file mode 100644 index 0000000..954c7f2 --- /dev/null +++ b/cruise-control/README.md @@ -0,0 +1,5 @@ +kafka-cruise-control +==================== + +LinkedIn Cruise Control manager for Kafka. This image includes the Cruise Control application. It does not include Kafka or the metrics reporter. + diff --git a/cruise-control/hooks/build b/cruise-control/hooks/build new file mode 100755 index 0000000..04579b0 --- /dev/null +++ b/cruise-control/hooks/build @@ -0,0 +1,10 @@ +#!/bin/bash -xe + +. ./hooks/env + +docker build \ + --build-arg "SOURCE_REF=$GIT_SHA1" \ + --build-arg "DOCKERFILE_PATH=$DOCKERFILE_PATH" \ + --build-arg "SOURCE_TYPE=$SOURCE_TYPE" \ + ${VERSION:+--build-arg "VERSION=$VERSION"} \ + -t $IMAGE_NAME $DOCKERFILE_PATH diff --git a/cruise-control/hooks/env b/cruise-control/hooks/env new file mode 100755 index 0000000..030a136 --- /dev/null +++ b/cruise-control/hooks/env @@ -0,0 +1,14 @@ +# These values are passed by the hub, but if they aren't we can get them from git. +[ -n "$SOURCE_BRANCH" ] || SOURCE_BRANCH=${CIRCLE_TAG} +[ -n "$SOURCE_BRANCH" ] || SOURCE_BRANCH=$(git symbolic-ref -q --short HEAD | tr '/' '-') +[ -n "$SOURCE_BRANCH" ] || SOURCE_BRANCH=latest +[ -n "$GIT_SHA1" ] || GIT_SHA1=$(git rev-parse -q HEAD) + +[[ "${SOURCE_BRANCH:0:1}" =~ [0-9] ]] && VERSION=${SOURCE_BRANCH/-*/} + +[ "$SOURCE_BRANCH" = "master" ] && SOURCE_BRANCH="latest" + +# Set defaults for build arguments +[ -n "$SOURCE_TYPE" ] || SOURCE_TYPE=git +[ -n "$DOCKERFILE_PATH" ] || DOCKERFILE_PATH=. +[ -n "$IMAGE_NAME" ] || IMAGE_NAME=pdouble16/kafka-cruise-control:$SOURCE_BRANCH diff --git a/cruise-control/opt/cruise-control/config/log4j.properties b/cruise-control/opt/cruise-control/config/log4j.properties new file mode 100644 index 0000000..5e0d896 --- /dev/null +++ b/cruise-control/opt/cruise-control/config/log4j.properties @@ -0,0 +1,7 @@ +log4j.rootLogger = INFO, FILE + +log4j.appender.FILE=org.apache.log4j.FileAppender +log4j.appender.FILE.File=/dev/stdout + +log4j.appender.FILE.layout=org.apache.log4j.PatternLayout +log4j.appender.FILE.layout.conversionPattern=%-6r [%15.15t] %-5p %30.30c %x - %m%n diff --git a/cruise-control/opt/cruise-control/config/log4j2.xml b/cruise-control/opt/cruise-control/config/log4j2.xml new file mode 100644 index 0000000..d3f1304 --- /dev/null +++ b/cruise-control/opt/cruise-control/config/log4j2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/cruise-control/opt/cruise-control/start.sh b/cruise-control/opt/cruise-control/start.sh new file mode 100755 index 0000000..49934ed --- /dev/null +++ b/cruise-control/opt/cruise-control/start.sh @@ -0,0 +1,4 @@ +#!/bin/bash +set -e +cd /opt/cruise-control +/bin/bash ${DEBUG:+-x} /opt/cruise-control/kafka-cruise-control-start.sh /opt/cruise-control/config/cruisecontrol.properties 8090