blob: 0dc837edae004fd5bdb90b7704fbbb5fbfb6f11b [file] [log] [blame]
Stephane Barbarie7ba064f2017-06-20 10:57:20 -04001###########################################################################################
2#
3# Deploy a Zookeeper/Kafka messaging cluster
4#
5# It is meant to be deployed within a swarm cluster using the docker stack functionality.
6# This file will deploy 3 zookeeper containers and 1 kafka container per swarm node.
7#
8# This file will also create an overlay network which can be referred by other services.
9#
10# Example:
11#
12# docker stack deploy -c docker-compose-kafka-ha-cluster.yml kafka
13#
14###########################################################################################
15
16version: '3'
17services:
18 zk1:
David K. Bainbridgebba65ff2018-01-19 09:26:09 -080019 image: "${REGISTRY}wurstmeister/zookeeper:${ZK_TAG:-latest}"
David K. Bainbridge4e920b72017-10-12 07:49:14 -070020 logging:
21 driver: "json-file"
22 options:
23 max-size: "10m"
24 max-file: 3
Stephane Barbarie7ba064f2017-06-20 10:57:20 -040025 networks:
David K. Bainbridge737b74f2018-01-22 12:57:52 -080026 - kafka-net
Stephane Barbarie7ba064f2017-06-20 10:57:20 -040027 environment:
28 ZOO_MY_ID: 1
29 ZOO_SERVERS: server.1=0.0.0.0:2888:3888 server.2=zk2:2888:3888 server.3=zk3:2888:3888
30
31 zk2:
David K. Bainbridgebba65ff2018-01-19 09:26:09 -080032 image: "${REGISTRY}wurstmeister/zookeeper:${ZK_TAG:-latest}"
David K. Bainbridge4e920b72017-10-12 07:49:14 -070033 logging:
34 driver: "json-file"
35 options:
36 max-size: "10m"
37 max-file: 3
Stephane Barbarie7ba064f2017-06-20 10:57:20 -040038 networks:
David K. Bainbridge737b74f2018-01-22 12:57:52 -080039 - kafka-net
Stephane Barbarie7ba064f2017-06-20 10:57:20 -040040 environment:
41 ZOO_MY_ID: 2
42 ZOO_SERVERS: server.1=zk1:2888:3888 server.2=0.0.0.0:2888:3888 server.3=zk3:2888:3888
43
44 zk3:
David K. Bainbridgebba65ff2018-01-19 09:26:09 -080045 image: "${REGISTRY}wurstmeister/zookeeper:${ZK_TAG:-latest}"
David K. Bainbridge4e920b72017-10-12 07:49:14 -070046 logging:
47 driver: "json-file"
48 options:
49 max-size: "10m"
50 max-file: 3
Stephane Barbarie7ba064f2017-06-20 10:57:20 -040051 networks:
David K. Bainbridge737b74f2018-01-22 12:57:52 -080052 - kafka-net
Stephane Barbarie7ba064f2017-06-20 10:57:20 -040053 environment:
54 ZOO_MY_ID: 3
55 ZOO_SERVERS: server.1=zk1:2888:3888 server.2=zk2:2888:3888 server.3=0.0.0.0:2888:3888
56
57 kafka:
58 deploy:
59 mode: global
David K. Bainbridgebba65ff2018-01-19 09:26:09 -080060 image: "${REGISTRY}wurstmeister/kafka:${KAFKA_TAG:-latest}"
David K. Bainbridge4e920b72017-10-12 07:49:14 -070061 logging:
62 driver: "json-file"
63 options:
64 max-size: "10m"
65 max-file: 3
Stephane Barbarie7ba064f2017-06-20 10:57:20 -040066 environment:
67 KAFKA_ADVERTISED_PORT: 9092
68 KAFKA_ZOOKEEPER_CONNECT: zk1:2181,zk2:2181,zk3:2181
69 KAFKA_HEAP_OPTS: -Xmx256M -Xms128M
70 volumes:
71 - /var/run/docker.sock:/var/run/docker.sock
72 networks:
David K. Bainbridge737b74f2018-01-22 12:57:52 -080073 - kafka-net
Stephane Barbarie7ba064f2017-06-20 10:57:20 -040074 - voltha-net
75 ports:
76 - 9092:9092
77
78networks:
David K. Bainbridge737b74f2018-01-22 12:57:52 -080079 kafka-net:
80 external:
81 name: kafka_net
Stephane Barbarie7ba064f2017-06-20 10:57:20 -040082
83 voltha-net:
84 external:
85 name: voltha_net
86