Skip to content
This repository has been archived by the owner on May 2, 2023. It is now read-only.

Minor improvements #6

Merged
merged 4 commits into from
Jul 5, 2016
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
VERSION := 3.0.0

COMPONENTS := base zookeeper kafka kafkacat
COMPONENTS := base zookeeper kafka kafkacat kafka-rest

build-debian:
for component in ${COMPONENTS} ; do \
Expand Down
6 changes: 5 additions & 1 deletion debian/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ RUN echo "===> update debian ....." \
${JAVA_HOME}/*.txt \
&& echo "===> clean up ..." \
&& rm -rf /var/cache/oracle-jdk8-installer \
&& apt-get clean && rm -rf /tmp/* /var/lib/apt/lists/*
&& apt-get clean && rm -rf /tmp/* /var/lib/apt/lists/* \
\
&& echo "===> add confluent repository..." \
&& curl -SL http://packages.confluent.io/deb/${CONFLUENT_MAJOR_VERSION}/archive.key | apt-key add - \
&& echo "deb [arch=amd64] http://packages.confluent.io/deb/${CONFLUENT_MAJOR_VERSION} stable main" >> /etc/apt/sources.list

COPY include/dub /usr/local/bin/dub
COPY include/cub /usr/local/bin/cub
17 changes: 17 additions & 0 deletions debian/kafka-rest/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM confluentinc/base

ENV COMPONENT=kafka-rest

# default listener
EXPOSE 8082

RUN echo "===> installing ${COMPONENT}..." \
&& apt-get update && apt-get install -y confluent-${COMPONENT} \
&& echo "===> clean up ..." \
&& apt-get clean && rm -rf /tmp/* /var/lib/apt/lists/* \
&& echo "===> Setting up ${COMPONENT} dirs" \
&& chmod -R ag+w /etc/${COMPONENT}

COPY include/etc/confluent/docker /etc/confluent/docker

CMD ["/etc/confluent/docker/run"]
14 changes: 14 additions & 0 deletions debian/kafka-rest/include/etc/confluent/docker/configure
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

set -o nounset \
-o errexit \
-o verbose \
-o xtrace

dub ensure ZOOKEEPER_CONNECT
dub ensure SCHEMA_REGISTERY_URL

dub path /etc/${COMPONENT}/ writable

dub template "/etc/confluent/docker/${COMPONENT}.properties.template" "/etc/${COMPONENT}/${COMPONENT}.properties"
dub template "/etc/confluent/docker/log4j.properties.template" "/etc/${COMPONENT}/log4j.properties"
19 changes: 19 additions & 0 deletions debian/kafka-rest/include/etc/confluent/docker/ensure
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

set -o nounset \
-o errexit \
-o verbose \
-o xtrace

echo "===> Check if Zookeeper is healthy ..."
cub zk-ready $ZOOKEEPER_CONNECT 20 10 2

echo "===> Check if Kafka is healthy ..."
cub kafka-ready $ZOOKEEPER_CONNECT 1 20 10 2


: <<'TODO'
echo "==> Check if Schema Registry is healthy ..."
cub schema_registry-ready $SCHEMA_REGISTRY_URL 20 10 2
TODO

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

{# required properties #}
zookeeper.connect={{env['ZOOKEEPER_CONNECT']}}
schema.registry.url={{env['SCHEMA_REGISTRY_URL']}}

{# optional properties #}
{% set other_props = {
'LISTENERS': 'listeners',
'ID_CONFIG': 'id',
'HOST_NAME': 'host.name',
'PRODUCER_THREADS': 'producer.threads',
'CONSUMER_ITERATOR_TIMEOUT_MS': 'consumer.iterator.timeout.ms',
'CONSUMER_ITERATOR_BACKOFF_MS': 'consumer.iterator.backoff.ms',
'CONSUMER_REQUEST_TIMEOUT_MS': 'consumer.request.timeout.ms',
'CONSUMER_REQUEST_MAX_BYTES': 'consumer.request.max.bytes',
'CONSUMER_THREADS': 'consumer.threads',
'CONSUMER_INSTANCE_TIMEOUT_MS': 'consumer.instance.timeout.ms',
'SIMPLE_CONSUMER_MAX_POOL_SIZE': 'simpleconsumer.pool.size.max',
'SIMPLE_CONSUMER_POOL_TIMEOUT_MS': 'simpleconsumer.pool.timeout.ms'
} -%}

{% for k, property in other_props.iteritems() %}
{% if env.get(k) != None %}
{{property}}={{env[k]}}
{% endif %}
{% endfor %}
8 changes: 8 additions & 0 deletions debian/kafka-rest/include/etc/confluent/docker/launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

echo "===> Printing /etc/${COMPONENT}/${COMPONENT}.properties "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rnpridgeon Jeremy suggested that we should not print out the server.properties in the launch script as it might contain the keystore password when SSL is enabled.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nevermind. I'm going to go ahead and merge this PR and then I'll make this change when I add Schema Registry.

cat /etc/${COMPONENT}/${COMPONENT}.properties

echo "===> Launching ${COMPONENT} ... "
# Don't need exec as the command has it.
${COMPONENT}-start /etc/${COMPONENT}/${COMPONENT}.properties
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still do need to add 'exec' here per @theduderog

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nevermind. I'm going to go ahead and merge this PR and then I'll make this change when I add Schema Registry.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
log4j.rootLogger={{ env["LOG4J_ROOT_LOGLEVEL"] | default('INFO') }}, stdout

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%d] %p %m (%c)%n

21 changes: 21 additions & 0 deletions debian/kafka-rest/include/etc/confluent/docker/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

set -o nounset \
-o errexit \
-o verbose \
-o xtrace

echo "===> ENV Variables ..."
env

echo "===> User"
id

echo "===> Configuring ..."
/etc/confluent/docker/configure

echo "===> Running preflight checks ... "
/etc/confluent/docker/ensure

echo "===> Launching ... "
/etc/confluent/docker/launch
20 changes: 7 additions & 13 deletions debian/kafka/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
FROM confluentinc/base
FROM confluentinc/zookeeper

ENV COMPONENT=kafka

# primary, jmx
EXPOSE 9092 7203

RUN echo "===> add confluent repository..." \
&& curl -SL http://packages.confluent.io/deb/${CONFLUENT_MAJOR_VERSION}/archive.key | apt-key add - \
&& echo "deb [arch=amd64] http://packages.confluent.io/deb/${CONFLUENT_MAJOR_VERSION} stable main" >> /etc/apt/sources.list \
&& apt-get update && apt-get install -y confluent-kafka-${SCALA_VERSION} \
\
&& echo "===> clean up ..." \
&& apt-get clean && rm -rf /tmp/* /var/lib/apt/lists/* \
\
&& echo "===> Setting up Kafka dirs" \
&& mkdir -p /opt/kafka/data \
&& chmod -R ag+w /etc/kafka /opt/kafka/data
RUN echo "===> Installing ${COMPONENT}..." \
&& mkdir -p /opt/${COMPONENT}/data \
&& chmod -R ag+w /etc/${COMPONENT} /opt/${COMPONENT}/data

VOLUME ["/opt/kafka/data"]
VOLUME ["/opt/${COMPONENT}/data"]

COPY include/etc/confluent/docker /etc/confluent/docker

Expand Down
10 changes: 5 additions & 5 deletions debian/kafka/include/etc/confluent/docker/configure
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -o nounset \
-o errexit \
Expand All @@ -9,8 +9,8 @@ dub ensure BROKER_ID
dub ensure ZOOKEEPER_CONNECT
dub ensure ADVERTISED_HOST_NAME
dub ensure ADVERTISED_PORT
dub path /etc/kafka/ writable
dub path /etc/${COMPONENT}/ writable

dub template "/etc/confluent/docker/server.properties.template" "/etc/kafka/server.properties"
dub template "/etc/confluent/docker/log4j.properties.template" "/etc/kafka/log4j.properties"
dub template "/etc/confluent/docker/tools-log4j.properties.template" "/etc/kafka/tools-log4j.properties"
dub template "/etc/confluent/docker/${COMPONENT}.properties.template" "/etc/${COMPONENT}/${COMPONENT}.properties"
dub template "/etc/confluent/docker/log4j.properties.template" "/etc/${COMPONENT}/log4j.properties"
dub template "/etc/confluent/docker/tools-log4j.properties.template" "/etc/${COMPONENT}/tools-log4j.properties"
6 changes: 3 additions & 3 deletions debian/kafka/include/etc/confluent/docker/ensure
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/bash
#!/usr/bin/env bash

set -o nounset \
-o errexit \
-o verbose \
-o xtrace


echo "===> Check if /opt/kafka/data is writable ..."
dub path /opt/kafka/data writable
echo "===> Check if /opt/${COMPONENT}/data is writable ..."
dub path /opt/${COMPONENT}/data writable

echo "===> Check if Zookeeper is healthy ..."
cub zk-ready $ZOOKEEPER_CONNECT 20 10 2
10 changes: 5 additions & 5 deletions debian/kafka/include/etc/confluent/docker/launch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash
#!/usr/bin/env bash

echo "===> Printing /etc/kafka/server.properties "
cat /etc/kafka/server.properties
echo "===> Printing /etc/${COMPONENT}/${COMPONENT}.properties "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jeremy suggested removing this line as this has SSL password and it would be a security bug.

cat /etc/${COMPONENT}/${COMPONENT}.properties

echo "===> Launching kafka ... "
echo "===> Launching ${COMPONENT} ... "
# Don't need exec as the command has it.
kafka-server-start /etc/kafka/server.properties
${COMPONENT}-server-start /etc/${COMPONENT}/${COMPONENT}.properties
2 changes: 1 addition & 1 deletion debian/kafka/include/etc/confluent/docker/run
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -o nounset \
-o errexit \
Expand Down
14 changes: 7 additions & 7 deletions debian/zookeeper/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ FROM confluentinc/base

EXPOSE 2181 2888 3888

RUN echo "===> add confluent repository..." \
&& curl -SL http://packages.confluent.io/deb/${CONFLUENT_MAJOR_VERSION}/archive.key | apt-key add - \
&& echo "deb [arch=amd64] http://packages.confluent.io/deb/${CONFLUENT_MAJOR_VERSION} stable main" >> /etc/apt/sources.list \
ENV COMPONENT=zookeeper

RUN echo "===> installing ${COMPONENT}..." \
&& apt-get update && apt-get install -y confluent-kafka-${SCALA_VERSION} \
\
&& echo "===> clean up ..." \
&& apt-get clean && rm -rf /tmp/* /var/lib/apt/lists/* \
\
&& echo "===> Setting up ZK dirs" \
&& mkdir -p /opt/zookeeper/data /opt/zookeeper/log \
&& chmod -R ag+w /etc/kafka /opt/zookeeper/data /opt/zookeeper/log
&& echo "===> Setting up ${COMPONENT} dirs" \
&& mkdir -p /opt/${COMPONENT}/data /opt/${COMPONENT}/log \
&& chmod -R ag+w /etc/kafka /opt/${COMPONENT}/data /opt/${COMPONENT}/log

VOLUME ["/opt/zookeeper/data", "/opt/zookeeper/log"]
VOLUME ["/opt/${COMPONENT}/data", "/opt/${COMPONENT}/log"]

COPY include/etc/confluent/docker /etc/confluent/docker

Expand Down
6 changes: 3 additions & 3 deletions debian/zookeeper/include/etc/confluent/docker/configure
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -o nounset \
-o errexit \
Expand All @@ -8,8 +8,8 @@ set -o nounset \
dub ensure SERVER_ID
dub path /etc/kafka/ writable

dub template "/etc/confluent/docker/zookeeper.properties.template" "/etc/kafka/zookeeper.properties"
dub template "/etc/confluent/docker/${COMPONENT}.properties.template" "/etc/kafka/${COMPONENT}.properties"
dub template "/etc/confluent/docker/log4j.properties.template" "/etc/kafka/log4j.properties"
dub template "/etc/confluent/docker/tools-log4j.properties.template" "/etc/kafka/tools-log4j.properties"

dub template "/etc/confluent/docker/myid.template" "/opt/zookeeper/data/myid"
dub template "/etc/confluent/docker/myid.template" "/opt/${COMPONENT}/data/myid"
14 changes: 7 additions & 7 deletions debian/zookeeper/include/etc/confluent/docker/launch
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash
#!/usr/bin/env bash

echo "===> Printing /etc/kafka/zookeeper.properties "
cat /etc/kafka/zookeeper.properties
echo "===> Printing /etc/kafka/${COMPONENT}.properties "
cat /etc/kafka/${COMPONENT}.properties
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rnpridgeon Does zookeeper config ever include any passwords ? I think it would for 3.5 when SSL is enabled but not sure for 3.4.


echo "===> Printing /opt/zookeeper/data/myid "
cat /opt/zookeeper/data/myid
echo "===> Printing /opt/${COMPONENT}/data/myid "
cat /opt/${COMPONENT}/data/myid

echo "===> Launching zookeeper ... "
echo "===> Launching ${COMPONENT} ... "
# Don't need exec as the command has it.
zookeeper-server-start /etc/kafka/zookeeper.properties
${COMPONENT}-server-start /etc/kafka/${COMPONENT}.properties
2 changes: 1 addition & 1 deletion debian/zookeeper/include/etc/confluent/docker/run
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -o nounset \
-o errexit \
Expand Down