-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrates zipkin-kafka docker image (#2852)
- Loading branch information
1 parent
07b4243
commit 7d81636
Showing
13 changed files
with
198 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# | ||
# Copyright 2015-2019 The OpenZipkin Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
# in compliance with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software distributed under the License | ||
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
# or implied. See the License for the specific language governing permissions and limitations under | ||
# the License. | ||
# | ||
|
||
FROM alpine | ||
|
||
ENV SCALA_VERSION 2.12 | ||
ENV KAFKA_VERSION 2.3.0 | ||
ENV ZOOKEEPER_VERSION 3.4.14 | ||
|
||
WORKDIR /kafka | ||
ADD /docker/kafka/install.sh /kafka/install | ||
RUN /kafka/install | ||
|
||
ADD /docker/kafka/wait-for-zookeeper.sh /kafka/bin | ||
ADD /docker/kafka/start.sh /kafka/bin | ||
|
||
# Share the same base image to reduce layers used in testing | ||
FROM openzipkin/jre-full:11.0.4-11.33 | ||
LABEL MAINTAINER Zipkin "https://zipkin.io/" | ||
|
||
WORKDIR /kafka | ||
|
||
RUN ["/busybox/sh", "-c", "adduser -g '' -h /kafka -D kafka"] | ||
|
||
COPY --from=0 --chown=kafka /kafka /kafka | ||
|
||
USER kafka | ||
|
||
# Port 19092 is for connections from the Docker host | ||
EXPOSE 2181 9092 19092 | ||
|
||
ENTRYPOINT ["/busybox/sh", "/kafka/bin/start.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
## zipkin-kafka Docker image | ||
|
||
The `zipkin-kafka` testing image runs both Kafka+ZooKeeper for the [Kafka collector](https://github.com/openzipkin/zipkin/tree/master/zipkin-collector/kafka) | ||
and the upcoming [Kafka storage](https://github.com/openzipkin-contrib/zipkin-storage-kafka). | ||
|
||
To build `openzipkin/zipkin-kafka`, from the top level of the repository, run: | ||
```bash | ||
$ docker build -t openzipkin/zipkin-kafka:test -f docker/kafka/Dockerfile . | ||
``` | ||
|
||
Then configure the [Kafka sender](https://github.com/openzipkin/zipkin-reporter-java/blob/master/kafka/src/main/java/zipkin2/reporter/kafka/KafkaSender.java) using a `bootstrapServers` value of `host.docker.internal:9092` if your application is inside the same docker network or `localhost:19092` if not, but running on the same host. | ||
|
||
In other words, if you are running a sample application on your laptop, you would use `localhost:19092` bootstrap server to send spans to the Kafka broker running in Docker. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/sh | ||
# | ||
# Copyright 2015-2019 The OpenZipkin Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
# in compliance with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software distributed under the License | ||
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
# or implied. See the License for the specific language governing permissions and limitations under | ||
# the License. | ||
# | ||
|
||
set -eux | ||
|
||
echo "*** Installing Kafka and dependencies" | ||
apk add --update --no-cache jq curl | ||
|
||
APACHE_MIRROR=$(curl --stderr /dev/null https://www.apache.org/dyn/closer.cgi\?as_json\=1 | jq -r '.preferred') | ||
|
||
curl -sSL $APACHE_MIRROR/zookeeper/zookeeper-$ZOOKEEPER_VERSION/zookeeper-$ZOOKEEPER_VERSION.tar.gz | tar xz | ||
mkdir zookeeper | ||
mv zookeeper-$ZOOKEEPER_VERSION/conf zookeeper/ | ||
|
||
# download kafka binaries | ||
curl -sSL $APACHE_MIRROR/kafka/$KAFKA_VERSION/kafka_$SCALA_VERSION-$KAFKA_VERSION.tgz | tar xz | ||
mv kafka_$SCALA_VERSION-$KAFKA_VERSION/* . | ||
|
||
# Set explicit, basic configuration | ||
cat > config/server.properties <<-EOF | ||
broker.id=0 | ||
zookeeper.connect=127.0.0.1:2181 | ||
replica.socket.timeout.ms=1500 | ||
log.dirs=/kafka/logs | ||
auto.create.topics.enable=true | ||
offsets.topic.replication.factor=1 | ||
listeners=PLAINTEXT://0.0.0.0:9092,PLAINTEXT_HOST://0.0.0.0:19092 | ||
listener.security.protocol.map=PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT | ||
EOF | ||
|
||
mkdir /kafka/logs | ||
|
||
echo "*** Cleaning Up" | ||
rm -rf zookeeper-$ZOOKEEPER_VERSION | ||
|
||
echo "*** Image build complete" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/busybox/sh | ||
# | ||
# Copyright 2015-2019 The OpenZipkin Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
# in compliance with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software distributed under the License | ||
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
# or implied. See the License for the specific language governing permissions and limitations under | ||
# the License. | ||
# | ||
|
||
|
||
echo Starting Zookeeper | ||
/busybox/sh /kafka/bin/kafka-run-class.sh -Dlog4j.configuration=file:/kafka/config/log4j.properties org.apache.zookeeper.server.quorum.QuorumPeerMain /kafka/zookeeper/conf/zoo_sample.cfg & | ||
/busybox/sh /kafka/bin/wait-for-zookeeper.sh | ||
|
||
if [[ -z "$KAFKA_ADVERTISED_HOST_NAME" ]]; then | ||
listeners=PLAINTEXT://:9092 | ||
# Have internal docker producers and consumers use the normal hostname:9092, and outside docker localhost:19092 | ||
echo advertised.listeners=PLAINTEXT://${HOSTNAME}:9092,PLAINTEXT_HOST://localhost:19092 >> /kafka/config/server.properties | ||
else | ||
# Have internal docker producers and consumers use the normal hostname:9092, and outside docker the advertised host on port 19092 | ||
echo "advertised.listeners=PLAINTEXT://${HOSTNAME}:9092,PLAINTEXT_HOST://${KAFKA_ADVERTISED_HOST_NAME}:19092" >> /kafka/config/server.properties | ||
fi | ||
|
||
echo Starting Kafka | ||
/busybox/sh /kafka/bin/kafka-run-class.sh -name kafkaServer -Dlog4j.configuration=file:/kafka/config/log4j.properties kafka.Kafka /kafka/config/server.properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/busybox/sh | ||
# | ||
# Copyright 2015-2019 The OpenZipkin Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
# in compliance with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software distributed under the License | ||
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
# or implied. See the License for the specific language governing permissions and limitations under | ||
# the License. | ||
# | ||
|
||
|
||
until echo stat | nc 127.0.0.1 2181 | ||
do | ||
sleep 1 | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
## zipkin-ui Docker image | ||
|
||
The `zipkin-ui` testing image contains the static parts of the Zipkin UI served directly with NGINX. | ||
|
||
To build `openzipkin/zipkin-ui`, from the top level of the repository, run: | ||
|
||
```bash | ||
$ docker build -t openzipkin/zipkin-ui:test -f docker/Dockerfile --target zipkin-ui . | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.