blob: 1c2dbb28338cd4e666f8a1dc3e43de9caf8beaf2 [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:
19 image: zookeeper
David K. Bainbridgee45c1942017-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:
26 - net
27 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:
32 image: zookeeper
David K. Bainbridgee45c1942017-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:
39 - net
40 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:
45 image: zookeeper
David K. Bainbridgee45c1942017-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:
52 - net
53 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
60 image: wurstmeister/kafka
David K. Bainbridgee45c1942017-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:
73 - net
74 - voltha-net
75 ports:
76 - 9092:9092
77
78networks:
79 net:
80 driver: overlay
schowdhuryd9084962017-06-21 14:51:49 -070081 driver_opts:
82 encrypted: "true"
Stephane Barbarie7ba064f2017-06-20 10:57:20 -040083
84 voltha-net:
85 external:
86 name: voltha_net
87