Stephane Barbarie | 7ba064f | 2017-06-20 10:57:20 -0400 | [diff] [blame] | 1 | ########################################################################################### |
| 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 | |
| 16 | version: '3' |
| 17 | services: |
| 18 | zk1: |
| 19 | image: zookeeper |
David K. Bainbridge | e45c194 | 2017-10-12 07:49:14 -0700 | [diff] [blame] | 20 | logging: |
| 21 | driver: "json-file" |
| 22 | options: |
| 23 | max-size: "10m" |
| 24 | max-file: 3 |
Stephane Barbarie | 7ba064f | 2017-06-20 10:57:20 -0400 | [diff] [blame] | 25 | 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. Bainbridge | e45c194 | 2017-10-12 07:49:14 -0700 | [diff] [blame] | 33 | logging: |
| 34 | driver: "json-file" |
| 35 | options: |
| 36 | max-size: "10m" |
| 37 | max-file: 3 |
Stephane Barbarie | 7ba064f | 2017-06-20 10:57:20 -0400 | [diff] [blame] | 38 | 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. Bainbridge | e45c194 | 2017-10-12 07:49:14 -0700 | [diff] [blame] | 46 | logging: |
| 47 | driver: "json-file" |
| 48 | options: |
| 49 | max-size: "10m" |
| 50 | max-file: 3 |
Stephane Barbarie | 7ba064f | 2017-06-20 10:57:20 -0400 | [diff] [blame] | 51 | 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. Bainbridge | e45c194 | 2017-10-12 07:49:14 -0700 | [diff] [blame] | 61 | logging: |
| 62 | driver: "json-file" |
| 63 | options: |
| 64 | max-size: "10m" |
| 65 | max-file: 3 |
Stephane Barbarie | 7ba064f | 2017-06-20 10:57:20 -0400 | [diff] [blame] | 66 | 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 | |
| 78 | networks: |
| 79 | net: |
| 80 | driver: overlay |
schowdhury | d908496 | 2017-06-21 14:51:49 -0700 | [diff] [blame] | 81 | driver_opts: |
| 82 | encrypted: "true" |
Stephane Barbarie | 7ba064f | 2017-06-20 10:57:20 -0400 | [diff] [blame] | 83 | |
| 84 | voltha-net: |
| 85 | external: |
| 86 | name: voltha_net |
| 87 | |