Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions cruise-control/Dockerfile
Original file line number Diff line number Diff line change
@@ -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" ]
5 changes: 5 additions & 0 deletions cruise-control/README.md
Original file line number Diff line number Diff line change
@@ -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.

10 changes: 10 additions & 0 deletions cruise-control/hooks/build
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions cruise-control/hooks/env
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions cruise-control/opt/cruise-control/config/log4j.properties
Original file line number Diff line number Diff line change
@@ -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
13 changes: 13 additions & 0 deletions cruise-control/opt/cruise-control/config/log4j2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO">
<Appenders>
<File name="Console" fileName="/dev/stdout">
<PatternLayout pattern="%d{yyy-MM-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</File>
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="Console" />
</Root>
</Loggers>
</Configuration>
4 changes: 4 additions & 0 deletions cruise-control/opt/cruise-control/start.sh
Original file line number Diff line number Diff line change
@@ -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