Zack Williams | 41513bf | 2018-07-07 20:08:35 -0700 | [diff] [blame] | 1 | # Copyright 2017-present Open Networking Foundation |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
Stephane Barbarie | 7ba064f | 2017-06-20 10:57:20 -0400 | [diff] [blame] | 14 | ########################################################################################### |
| 15 | # |
| 16 | # Deploy a Zookeeper/Kafka messaging cluster |
| 17 | # |
| 18 | # It is meant to be deployed within a swarm cluster using the docker stack functionality. |
| 19 | # This file will deploy 3 zookeeper containers and 1 kafka container per swarm node. |
| 20 | # |
| 21 | # This file will also create an overlay network which can be referred by other services. |
| 22 | # |
| 23 | # Example: |
| 24 | # |
| 25 | # docker stack deploy -c docker-compose-kafka-ha-cluster.yml kafka |
| 26 | # |
| 27 | ########################################################################################### |
| 28 | |
| 29 | version: '3' |
| 30 | services: |
| 31 | zk1: |
David K. Bainbridge | bba65ff | 2018-01-19 09:26:09 -0800 | [diff] [blame] | 32 | image: "${REGISTRY}wurstmeister/zookeeper:${ZK_TAG:-latest}" |
David K. Bainbridge | 4e920b7 | 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: |
David K. Bainbridge | 737b74f | 2018-01-22 12:57:52 -0800 | [diff] [blame] | 39 | - kafka-net |
Stephane Barbarie | 7ba064f | 2017-06-20 10:57:20 -0400 | [diff] [blame] | 40 | environment: |
| 41 | ZOO_MY_ID: 1 |
| 42 | ZOO_SERVERS: server.1=0.0.0.0:2888:3888 server.2=zk2:2888:3888 server.3=zk3:2888:3888 |
| 43 | |
| 44 | zk2: |
David K. Bainbridge | bba65ff | 2018-01-19 09:26:09 -0800 | [diff] [blame] | 45 | image: "${REGISTRY}wurstmeister/zookeeper:${ZK_TAG:-latest}" |
David K. Bainbridge | 4e920b7 | 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: |
David K. Bainbridge | 737b74f | 2018-01-22 12:57:52 -0800 | [diff] [blame] | 52 | - kafka-net |
Stephane Barbarie | 7ba064f | 2017-06-20 10:57:20 -0400 | [diff] [blame] | 53 | environment: |
| 54 | ZOO_MY_ID: 2 |
| 55 | ZOO_SERVERS: server.1=zk1:2888:3888 server.2=0.0.0.0:2888:3888 server.3=zk3:2888:3888 |
| 56 | |
| 57 | zk3: |
David K. Bainbridge | bba65ff | 2018-01-19 09:26:09 -0800 | [diff] [blame] | 58 | image: "${REGISTRY}wurstmeister/zookeeper:${ZK_TAG:-latest}" |
David K. Bainbridge | 4e920b7 | 2017-10-12 07:49:14 -0700 | [diff] [blame] | 59 | logging: |
| 60 | driver: "json-file" |
| 61 | options: |
| 62 | max-size: "10m" |
| 63 | max-file: 3 |
Stephane Barbarie | 7ba064f | 2017-06-20 10:57:20 -0400 | [diff] [blame] | 64 | networks: |
David K. Bainbridge | 737b74f | 2018-01-22 12:57:52 -0800 | [diff] [blame] | 65 | - kafka-net |
Stephane Barbarie | 7ba064f | 2017-06-20 10:57:20 -0400 | [diff] [blame] | 66 | environment: |
| 67 | ZOO_MY_ID: 3 |
| 68 | ZOO_SERVERS: server.1=zk1:2888:3888 server.2=zk2:2888:3888 server.3=0.0.0.0:2888:3888 |
| 69 | |
| 70 | kafka: |
| 71 | deploy: |
| 72 | mode: global |
David K. Bainbridge | bba65ff | 2018-01-19 09:26:09 -0800 | [diff] [blame] | 73 | image: "${REGISTRY}wurstmeister/kafka:${KAFKA_TAG:-latest}" |
David K. Bainbridge | 4e920b7 | 2017-10-12 07:49:14 -0700 | [diff] [blame] | 74 | logging: |
| 75 | driver: "json-file" |
| 76 | options: |
| 77 | max-size: "10m" |
| 78 | max-file: 3 |
Stephane Barbarie | 7ba064f | 2017-06-20 10:57:20 -0400 | [diff] [blame] | 79 | environment: |
Jonathan Hart | 0584a1e | 2018-04-17 08:36:21 -0700 | [diff] [blame] | 80 | KAFKA_LISTENERS: PLAINTEXT://:9092 |
Stephane Barbarie | 7ba064f | 2017-06-20 10:57:20 -0400 | [diff] [blame] | 81 | KAFKA_ZOOKEEPER_CONNECT: zk1:2181,zk2:2181,zk3:2181 |
| 82 | KAFKA_HEAP_OPTS: -Xmx256M -Xms128M |
| 83 | volumes: |
| 84 | - /var/run/docker.sock:/var/run/docker.sock |
| 85 | networks: |
David K. Bainbridge | 737b74f | 2018-01-22 12:57:52 -0800 | [diff] [blame] | 86 | - kafka-net |
Stephane Barbarie | 7ba064f | 2017-06-20 10:57:20 -0400 | [diff] [blame] | 87 | - voltha-net |
| 88 | ports: |
| 89 | - 9092:9092 |
| 90 | |
| 91 | networks: |
David K. Bainbridge | 737b74f | 2018-01-22 12:57:52 -0800 | [diff] [blame] | 92 | kafka-net: |
| 93 | external: |
| 94 | name: kafka_net |
Stephane Barbarie | 7ba064f | 2017-06-20 10:57:20 -0400 | [diff] [blame] | 95 | |
| 96 | voltha-net: |
| 97 | external: |
| 98 | name: voltha_net |