diff --git a/kafka/Dockerfile b/kafka/Dockerfile index f63bd74..a8a9899 100644 --- a/kafka/Dockerfile +++ b/kafka/Dockerfile @@ -1,6 +1,6 @@ FROM amazoncorretto:8u322-al2 ENV KAFKA_VERSION=kafka_2.13-2.8.1 -RUN yum install -y wget tar gzip nc && \ +RUN yum install -y wget tar gzip nc gettext && \ echo https://dlcdn.apache.org/kafka/3.0.0/${KAFKA_VERSION}.tgz && \ (wget -q -O - https://dlcdn.apache.org/kafka/2.8.1/${KAFKA_VERSION}.tgz | tar -xzf - -C /usr/local) && \ yum clean all && \ diff --git a/kafka/config/server.properties b/kafka/config/server.properties index 50da263..d8128d7 100644 --- a/kafka/config/server.properties +++ b/kafka/config/server.properties @@ -35,11 +35,11 @@ broker.id=0 # still cached -listeners=KAFKA_LISTENERS -advertised.listeners=KAFKA_ADVERTISED_LISTENERS -listener.security.protocol.map=KAFKA_LISTENER_SECURITY_PROTOCOL_MAP -inter.broker.listener.name=KAFKA_INTER_BROKER_LISTENER_NAME -offsets.topic.replication.factor=KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR +listeners=${KAFKA_LISTENERS} +advertised.listeners=${KAFKA_ADVERTISED_LISTENERS} +listener.security.protocol.map=${KAFKA_LISTENER_SECURITY_PROTOCOL_MAP} +inter.broker.listener.name=${KAFKA_INTER_BROKER_LISTENER_NAME} +offsets.topic.replication.factor=${KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR} # The number of threads handling network requests @@ -117,7 +117,7 @@ log.retention.check.interval.ms=300000 # server. e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002". # You can also append an optional chroot string to the urls to specify the # root directory for all kafka znodes. -zookeeper.connect=KAFKA_ZOOKEEPER_CONNECT +zookeeper.connect=${KAFKA_ZOOKEEPER_CONNECT} # Timeout in ms for connecting to zookeeper diff --git a/kafka/run-kafka.sh b/kafka/run-kafka.sh index be12482..727793b 100755 --- a/kafka/run-kafka.sh +++ b/kafka/run-kafka.sh @@ -4,16 +4,6 @@ set -e EFFECTIVE_KAFKA_CONFIG_DIR=./config -cp -v /usr/local/kafka-config/* $EFFECTIVE_KAFKA_CONFIG_DIR - -sed -i \ - -e "s?KAFKA_LISTENERS?${KAFKA_LISTENERS?}?" \ - -e "s?KAFKA_ADVERTISED_LISTENERS?${KAFKA_ADVERTISED_LISTENERS?}?" \ - -e "s?KAFKA_INTER_BROKER_LISTENER_NAME?${KAFKA_INTER_BROKER_LISTENER_NAME?}?" \ - -e "s?KAFKA_ZOOKEEPER_CONNECT?${KAFKA_ZOOKEEPER_CONNECT?}?" \ - -e "s?KAFKA_LISTENER_SECURITY_PROTOCOL_MAP?${KAFKA_LISTENER_SECURITY_PROTOCOL_MAP?}?" \ - -e "s?KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR?${KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR?}?" \ - $EFFECTIVE_KAFKA_CONFIG_DIR/server.properties - +envsubst < /usr/local/kafka-config/server.properties > $EFFECTIVE_KAFKA_CONFIG_DIR/server.properties exec bin/kafka-server-start.sh $EFFECTIVE_KAFKA_CONFIG_DIR/server.properties