Skip to content
This repository has been archived by the owner on Oct 23, 2019. It is now read-only.

Commit

Permalink
Adds KAFKA_ADVERTISED_HOST_NAME and example kafka file
Browse files Browse the repository at this point in the history
Tested with brave-resteasy-example with Docker Toolbox on OS/X

Fixes #85
  • Loading branch information
Adrian Cole committed Jul 18, 2016
1 parent 06e73f8 commit 925e271
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 3 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,20 @@ To start the MySQL-backed configuration, run:

$ docker-compose -f docker-compose.yml -f docker-compose-mysql.yml up

### Kafka

The docker-compose configuration can be extended to host a test Kafka broker
using the `docker-compose-kafka.yml` file. That file employs
[docker-compose overrides](https://docs.docker.com/compose/extends/#multiple-compose-files)
to add a Kafka+ZooKeeper container and relevant settings.

To start the Cassandra+Kafka configuration, run:

$ docker-compose -f docker-compose.yml -f docker-compose-kafka.yml up

By default, this assumes your Docker host IP is 192.168.99.100, which is what
you would use for the broker IP when configuring application instrumentation.

### Legacy

The Cassandra and MySQL docker-compose files described above use version 2 of
Expand Down
25 changes: 25 additions & 0 deletions docker-compose-kafka.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This file uses the version 2 docker-compose file format, described here:
# https://docs.docker.com/compose/compose-file/#version-2
#
# It extends the default configuration from docker-compose.yml to run the
# zipkin-mysql container instead of the zipkin-cassandra container.

version: '2'

services:
kafka-zookeeper:
build: kafka
image: openzipkin/zipkin-kafka:1.4.3
container_name: kafka-zookeeper
environment:
# corresponds to your docker machine and your producer's broker list
- KAFKA_ADVERTISED_HOST_NAME=192.168.99.100
ports:
- 2181:2181
- 9092:9092

zipkin:
environment:
- KAFKA_ZOOKEEPER=kafka-zookeeper
depends_on:
- kafka-zookeeper
2 changes: 1 addition & 1 deletion kafka/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM openzipkin/jre-full:1.8.0_72
MAINTAINER OpenZipkin "http://zipkin.io/"

ENV SCALA_VERSION 2.11
ENV KAFKA_VERSION 0.9.0.0
ENV KAFKA_VERSION 0.9.0.1
ENV ZOOKEEPER_VERSION 3.4.6

WORKDIR /kafka
Expand Down
8 changes: 6 additions & 2 deletions kafka/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,14 @@ EOF

# create runit config, dependent on zookeeper, that advertises the container ip
mkdir -p /etc/service/kafka
cat > /etc/service/kafka/run <<-EOF
cat > /etc/service/kafka/run <<-"EOF"
#!/bin/sh
sv start zookeeper || exit 1
echo advertised.host.name=$(route -n | awk '/UG[ \t]/{print $2}') >> /kafka/config/server.properties
if [[ -z "$KAFKA_ADVERTISED_HOST_NAME" ]]; then
echo advertised.host.name=$(route -n | awk '/UG[ \t]/{print $2}') >> /kafka/config/server.properties
else
echo advertised.host.name=$KAFKA_ADVERTISED_HOST_NAME >> /kafka/config/server.properties
fi
exec sh /kafka/bin/kafka-run-class.sh -name kafkaServer -loggc kafka.Kafka /kafka/config/server.properties
EOF
chmod +x /etc/service/kafka/run
Expand Down

0 comments on commit 925e271

Please sign in to comment.