docker-compose.yml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. version: '3.9'
  2. services:
  3. zookeeper-1:
  4. hostname: 'zookeeper-1'
  5. image: 'docker.io/library/zookeeper:3.6.3'
  6. init: true
  7. restart: always
  8. environment:
  9. ZOO_MY_ID: '1'
  10. ZOO_SERVERS: 'server.1=zookeeper-1:2888:3888 server.2=zookeeper-2:2888:3888 server.3=zookeeper-3:2888:3888'
  11. ZOO_CFG_EXTRA: 'clientPort=2181 peerPort=2888 leaderPort=3888'
  12. ZOO_INIT_LIMIT: '10'
  13. ZOO_SYNC_LIMIT: '5'
  14. ZOO_MAX_CLIENT_CNXNS: '0'
  15. ZOO_4LW_COMMANDS_WHITELIST: 'mntr,conf,ruok'
  16. zookeeper-2:
  17. hostname: 'zookeeper-2'
  18. image: 'docker.io/library/zookeeper:3.6.3'
  19. init: true
  20. restart: always
  21. environment:
  22. ZOO_MY_ID: '2'
  23. ZOO_SERVERS: 'server.1=zookeeper-1:2888:3888 server.2=zookeeper-2:2888:3888 server.3=zookeeper-3:2888:3888'
  24. ZOO_CFG_EXTRA: 'clientPort=2181 peerPort=2888 leaderPort=3888'
  25. ZOO_INIT_LIMIT: '10'
  26. ZOO_SYNC_LIMIT: '5'
  27. ZOO_MAX_CLIENT_CNXNS: '0'
  28. ZOO_4LW_COMMANDS_WHITELIST: 'mntr,conf,ruok'
  29. zookeeper-3:
  30. hostname: 'zookeeper-3'
  31. image: 'docker.io/library/zookeeper:3.6.3'
  32. init: true
  33. restart: always
  34. environment:
  35. ZOO_MY_ID: '3'
  36. ZOO_SERVERS: 'server.1=zookeeper-1:2888:3888 server.2=zookeeper-2:2888:3888 server.3=zookeeper-3:2888:3888'
  37. ZOO_CFG_EXTRA: 'clientPort=2181 peerPort=2888 leaderPort=3888'
  38. ZOO_INIT_LIMIT: '10'
  39. ZOO_SYNC_LIMIT: '5'
  40. ZOO_MAX_CLIENT_CNXNS: '0'
  41. ZOO_4LW_COMMANDS_WHITELIST: 'mntr,conf,ruok'
  42. kafka-1:
  43. hostname: 'kafka-1'
  44. image: 'sarama/fv-kafka-${KAFKA_VERSION:-3.6.0}'
  45. init: true
  46. build:
  47. context: .
  48. dockerfile: Dockerfile.kafka
  49. args:
  50. KAFKA_VERSION: ${KAFKA_VERSION:-3.6.0}
  51. SCALA_VERSION: ${SCALA_VERSION:-2.13}
  52. healthcheck:
  53. test:
  54. [
  55. 'CMD',
  56. '/opt/kafka-${KAFKA_VERSION:-3.6.0}/bin/kafka-broker-api-versions.sh',
  57. '--bootstrap-server',
  58. 'kafka-1:9091',
  59. ]
  60. interval: 15s
  61. timeout: 15s
  62. retries: 10
  63. start_period: 360s
  64. depends_on:
  65. - zookeeper-1
  66. - zookeeper-2
  67. - zookeeper-3
  68. - toxiproxy
  69. restart: always
  70. environment:
  71. KAFKA_VERSION: ${KAFKA_VERSION:-3.6.0}
  72. KAFKA_CFG_ZOOKEEPER_CONNECT: 'zookeeper-1:2181,zookeeper-2:2181,zookeeper-3:2181'
  73. KAFKA_CFG_LISTENERS: 'LISTENER_INTERNAL://:9091,LISTENER_LOCAL://:29091'
  74. KAFKA_CFG_ADVERTISED_LISTENERS: 'LISTENER_INTERNAL://kafka-1:9091,LISTENER_LOCAL://localhost:29091'
  75. KAFKA_CFG_INTER_BROKER_LISTENER_NAME: 'LISTENER_INTERNAL'
  76. KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: 'LISTENER_INTERNAL:PLAINTEXT,LISTENER_LOCAL:PLAINTEXT'
  77. KAFKA_CFG_DEFAULT_REPLICATION_FACTOR: '2'
  78. KAFKA_CFG_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: '2'
  79. KAFKA_CFG_BROKER_ID: '1'
  80. KAFKA_CFG_BROKER_RACK: '1'
  81. KAFKA_CFG_ZOOKEEPER_SESSION_TIMEOUT_MS: '6000'
  82. KAFKA_CFG_ZOOKEEPER_CONNECTION_TIMEOUT_MS: '6000'
  83. KAFKA_CFG_REPLICA_SELECTOR_CLASS: 'org.apache.kafka.common.replica.RackAwareReplicaSelector'
  84. KAFKA_CFG_DELETE_TOPIC_ENABLE: 'true'
  85. KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: 'false'
  86. KAFKA_CFG_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
  87. KAFKA_JVM_PERFORMANCE_OPTS: "-XX:+IgnoreUnrecognizedVMOptions"
  88. kafka-2:
  89. hostname: 'kafka-2'
  90. image: 'sarama/fv-kafka-${KAFKA_VERSION:-3.6.0}'
  91. init: true
  92. build:
  93. context: .
  94. dockerfile: Dockerfile.kafka
  95. args:
  96. KAFKA_VERSION: ${KAFKA_VERSION:-3.6.0}
  97. SCALA_VERSION: ${SCALA_VERSION:-2.13}
  98. healthcheck:
  99. test:
  100. [
  101. 'CMD',
  102. '/opt/kafka-${KAFKA_VERSION:-3.6.0}/bin/kafka-broker-api-versions.sh',
  103. '--bootstrap-server',
  104. 'kafka-2:9091',
  105. ]
  106. interval: 15s
  107. timeout: 15s
  108. retries: 10
  109. start_period: 360s
  110. depends_on:
  111. - zookeeper-1
  112. - zookeeper-2
  113. - zookeeper-3
  114. - toxiproxy
  115. restart: always
  116. environment:
  117. KAFKA_VERSION: ${KAFKA_VERSION:-3.6.0}
  118. KAFKA_CFG_ZOOKEEPER_CONNECT: 'zookeeper-1:2181,zookeeper-2:2181,zookeeper-3:2181'
  119. KAFKA_CFG_LISTENERS: 'LISTENER_INTERNAL://:9091,LISTENER_LOCAL://:29092'
  120. KAFKA_CFG_ADVERTISED_LISTENERS: 'LISTENER_INTERNAL://kafka-2:9091,LISTENER_LOCAL://localhost:29092'
  121. KAFKA_CFG_INTER_BROKER_LISTENER_NAME: 'LISTENER_INTERNAL'
  122. KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: 'LISTENER_INTERNAL:PLAINTEXT,LISTENER_LOCAL:PLAINTEXT'
  123. KAFKA_CFG_DEFAULT_REPLICATION_FACTOR: '2'
  124. KAFKA_CFG_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: '2'
  125. KAFKA_CFG_BROKER_ID: '2'
  126. KAFKA_CFG_BROKER_RACK: '2'
  127. KAFKA_CFG_ZOOKEEPER_SESSION_TIMEOUT_MS: '6000'
  128. KAFKA_CFG_ZOOKEEPER_CONNECTION_TIMEOUT_MS: '6000'
  129. KAFKA_CFG_REPLICA_SELECTOR_CLASS: 'org.apache.kafka.common.replica.RackAwareReplicaSelector'
  130. KAFKA_CFG_DELETE_TOPIC_ENABLE: 'true'
  131. KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: 'false'
  132. KAFKA_CFG_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
  133. KAFKA_JVM_PERFORMANCE_OPTS: "-XX:+IgnoreUnrecognizedVMOptions"
  134. kafka-3:
  135. hostname: 'kafka-3'
  136. image: 'sarama/fv-kafka-${KAFKA_VERSION:-3.6.0}'
  137. init: true
  138. build:
  139. context: .
  140. dockerfile: Dockerfile.kafka
  141. args:
  142. KAFKA_VERSION: ${KAFKA_VERSION:-3.6.0}
  143. SCALA_VERSION: ${SCALA_VERSION:-2.13}
  144. healthcheck:
  145. test:
  146. [
  147. 'CMD',
  148. '/opt/kafka-${KAFKA_VERSION:-3.6.0}/bin/kafka-broker-api-versions.sh',
  149. '--bootstrap-server',
  150. 'kafka-3:9091',
  151. ]
  152. interval: 15s
  153. timeout: 15s
  154. retries: 10
  155. start_period: 360s
  156. depends_on:
  157. - zookeeper-1
  158. - zookeeper-2
  159. - zookeeper-3
  160. - toxiproxy
  161. restart: always
  162. environment:
  163. KAFKA_VERSION: ${KAFKA_VERSION:-3.6.0}
  164. KAFKA_CFG_ZOOKEEPER_CONNECT: 'zookeeper-1:2181,zookeeper-2:2181,zookeeper-3:2181'
  165. KAFKA_CFG_LISTENERS: 'LISTENER_INTERNAL://:9091,LISTENER_LOCAL://:29093'
  166. KAFKA_CFG_ADVERTISED_LISTENERS: 'LISTENER_INTERNAL://kafka-3:9091,LISTENER_LOCAL://localhost:29093'
  167. KAFKA_CFG_INTER_BROKER_LISTENER_NAME: 'LISTENER_INTERNAL'
  168. KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: 'LISTENER_INTERNAL:PLAINTEXT,LISTENER_LOCAL:PLAINTEXT'
  169. KAFKA_CFG_DEFAULT_REPLICATION_FACTOR: '2'
  170. KAFKA_CFG_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: '2'
  171. KAFKA_CFG_BROKER_ID: '3'
  172. KAFKA_CFG_BROKER_RACK: '3'
  173. KAFKA_CFG_ZOOKEEPER_SESSION_TIMEOUT_MS: '6000'
  174. KAFKA_CFG_ZOOKEEPER_CONNECTION_TIMEOUT_MS: '6000'
  175. KAFKA_CFG_REPLICA_SELECTOR_CLASS: 'org.apache.kafka.common.replica.RackAwareReplicaSelector'
  176. KAFKA_CFG_DELETE_TOPIC_ENABLE: 'true'
  177. KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: 'false'
  178. KAFKA_CFG_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
  179. KAFKA_JVM_PERFORMANCE_OPTS: "-XX:+IgnoreUnrecognizedVMOptions"
  180. kafka-4:
  181. hostname: 'kafka-4'
  182. image: 'sarama/fv-kafka-${KAFKA_VERSION:-3.6.0}'
  183. init: true
  184. build:
  185. context: .
  186. dockerfile: Dockerfile.kafka
  187. args:
  188. KAFKA_VERSION: ${KAFKA_VERSION:-3.6.0}
  189. SCALA_VERSION: ${SCALA_VERSION:-2.13}
  190. healthcheck:
  191. test:
  192. [
  193. 'CMD',
  194. '/opt/kafka-${KAFKA_VERSION:-3.6.0}/bin/kafka-broker-api-versions.sh',
  195. '--bootstrap-server',
  196. 'kafka-4:9091',
  197. ]
  198. interval: 15s
  199. timeout: 15s
  200. retries: 10
  201. start_period: 360s
  202. depends_on:
  203. - zookeeper-1
  204. - zookeeper-2
  205. - zookeeper-3
  206. - toxiproxy
  207. restart: always
  208. environment:
  209. KAFKA_VERSION: ${KAFKA_VERSION:-3.6.0}
  210. KAFKA_CFG_ZOOKEEPER_CONNECT: 'zookeeper-1:2181,zookeeper-2:2181,zookeeper-3:2181'
  211. KAFKA_CFG_LISTENERS: 'LISTENER_INTERNAL://:9091,LISTENER_LOCAL://:29094'
  212. KAFKA_CFG_ADVERTISED_LISTENERS: 'LISTENER_INTERNAL://kafka-4:9091,LISTENER_LOCAL://localhost:29094'
  213. KAFKA_CFG_INTER_BROKER_LISTENER_NAME: 'LISTENER_INTERNAL'
  214. KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: 'LISTENER_INTERNAL:PLAINTEXT,LISTENER_LOCAL:PLAINTEXT'
  215. KAFKA_CFG_DEFAULT_REPLICATION_FACTOR: '2'
  216. KAFKA_CFG_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: '2'
  217. KAFKA_CFG_BROKER_ID: '4'
  218. KAFKA_CFG_BROKER_RACK: '4'
  219. KAFKA_CFG_ZOOKEEPER_SESSION_TIMEOUT_MS: '6000'
  220. KAFKA_CFG_ZOOKEEPER_CONNECTION_TIMEOUT_MS: '6000'
  221. KAFKA_CFG_REPLICA_SELECTOR_CLASS: 'org.apache.kafka.common.replica.RackAwareReplicaSelector'
  222. KAFKA_CFG_DELETE_TOPIC_ENABLE: 'true'
  223. KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: 'false'
  224. KAFKA_CFG_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
  225. KAFKA_JVM_PERFORMANCE_OPTS: "-XX:+IgnoreUnrecognizedVMOptions"
  226. kafka-5:
  227. hostname: 'kafka-5'
  228. image: 'sarama/fv-kafka-${KAFKA_VERSION:-3.6.0}'
  229. init: true
  230. build:
  231. context: .
  232. dockerfile: Dockerfile.kafka
  233. args:
  234. KAFKA_VERSION: ${KAFKA_VERSION:-3.6.0}
  235. SCALA_VERSION: ${SCALA_VERSION:-2.13}
  236. healthcheck:
  237. test:
  238. [
  239. 'CMD',
  240. '/opt/kafka-${KAFKA_VERSION:-3.6.0}/bin/kafka-broker-api-versions.sh',
  241. '--bootstrap-server',
  242. 'kafka-5:9091',
  243. ]
  244. interval: 15s
  245. timeout: 15s
  246. retries: 10
  247. start_period: 360s
  248. depends_on:
  249. - zookeeper-1
  250. - zookeeper-2
  251. - zookeeper-3
  252. - toxiproxy
  253. restart: always
  254. environment:
  255. KAFKA_VERSION: ${KAFKA_VERSION:-3.6.0}
  256. KAFKA_CFG_ZOOKEEPER_CONNECT: 'zookeeper-1:2181,zookeeper-2:2181,zookeeper-3:2181'
  257. KAFKA_CFG_LISTENERS: 'LISTENER_INTERNAL://:9091,LISTENER_LOCAL://:29095'
  258. KAFKA_CFG_ADVERTISED_LISTENERS: 'LISTENER_INTERNAL://kafka-5:9091,LISTENER_LOCAL://localhost:29095'
  259. KAFKA_CFG_INTER_BROKER_LISTENER_NAME: 'LISTENER_INTERNAL'
  260. KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: 'LISTENER_INTERNAL:PLAINTEXT,LISTENER_LOCAL:PLAINTEXT'
  261. KAFKA_CFG_DEFAULT_REPLICATION_FACTOR: '2'
  262. KAFKA_CFG_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: '2'
  263. KAFKA_CFG_BROKER_ID: '5'
  264. KAFKA_CFG_BROKER_RACK: '5'
  265. KAFKA_CFG_ZOOKEEPER_SESSION_TIMEOUT_MS: '6000'
  266. KAFKA_CFG_ZOOKEEPER_CONNECTION_TIMEOUT_MS: '6000'
  267. KAFKA_CFG_REPLICA_SELECTOR_CLASS: 'org.apache.kafka.common.replica.RackAwareReplicaSelector'
  268. KAFKA_CFG_DELETE_TOPIC_ENABLE: 'true'
  269. KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: 'false'
  270. KAFKA_CFG_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
  271. KAFKA_JVM_PERFORMANCE_OPTS: "-XX:+IgnoreUnrecognizedVMOptions"
  272. toxiproxy:
  273. hostname: 'toxiproxy'
  274. image: 'ghcr.io/shopify/toxiproxy:2.4.0'
  275. init: true
  276. healthcheck:
  277. test: ['CMD', '/toxiproxy-cli', 'l']
  278. interval: 15s
  279. timeout: 15s
  280. retries: 3
  281. start_period: 30s
  282. ports:
  283. # The tests themselves actually start the proxies on these ports
  284. - '29091:29091'
  285. - '29092:29092'
  286. - '29093:29093'
  287. - '29094:29094'
  288. - '29095:29095'
  289. # This is the toxiproxy API port
  290. - '8474:8474'