VOL-212, VOL-213: Added support for a kafka cluster within swarm
Amendment:
- Added reference to voltha-net network
Change-Id: Ia6beaa564325f531d09b93c46a8867139e78e63a
diff --git a/Makefile b/Makefile
index c308592..8129ff7 100644
--- a/Makefile
+++ b/Makefile
@@ -177,6 +177,7 @@
docker pull ubuntu:xenial
docker pull wurstmeister/kafka:latest
docker pull wurstmeister/zookeeper:latest
+ docker pull zookeeper:latest
docker pull nginx:latest
docker pull portainer/portainer:latest
diff --git a/compose/docker-compose-kafka-cluster.yml b/compose/docker-compose-kafka-cluster.yml
new file mode 100644
index 0000000..e1d555c
--- /dev/null
+++ b/compose/docker-compose-kafka-cluster.yml
@@ -0,0 +1,65 @@
+###########################################################################################
+#
+# Deploy a Zookeeper/Kafka messaging cluster
+#
+# It is meant to be deployed within a swarm cluster using the docker stack functionality.
+# This file will deploy 3 zookeeper containers and 1 kafka container per swarm node.
+#
+# This file will also create an overlay network which can be referred by other services.
+#
+# Example:
+#
+# docker stack deploy -c docker-compose-kafka-ha-cluster.yml kafka
+#
+###########################################################################################
+
+version: '3'
+services:
+ zk1:
+ image: zookeeper
+ networks:
+ - net
+ environment:
+ ZOO_MY_ID: 1
+ ZOO_SERVERS: server.1=0.0.0.0:2888:3888 server.2=zk2:2888:3888 server.3=zk3:2888:3888
+
+ zk2:
+ image: zookeeper
+ networks:
+ - net
+ environment:
+ ZOO_MY_ID: 2
+ ZOO_SERVERS: server.1=zk1:2888:3888 server.2=0.0.0.0:2888:3888 server.3=zk3:2888:3888
+
+ zk3:
+ image: zookeeper
+ networks:
+ - net
+ environment:
+ ZOO_MY_ID: 3
+ ZOO_SERVERS: server.1=zk1:2888:3888 server.2=zk2:2888:3888 server.3=0.0.0.0:2888:3888
+
+ kafka:
+ deploy:
+ mode: global
+ image: wurstmeister/kafka
+ environment:
+ KAFKA_ADVERTISED_PORT: 9092
+ KAFKA_ZOOKEEPER_CONNECT: zk1:2181,zk2:2181,zk3:2181
+ KAFKA_HEAP_OPTS: -Xmx256M -Xms128M
+ volumes:
+ - /var/run/docker.sock:/var/run/docker.sock
+ networks:
+ - net
+ - voltha-net
+ ports:
+ - 9092:9092
+
+networks:
+ net:
+ driver: overlay
+
+ voltha-net:
+ external:
+ name: voltha_net
+