From 19d110f945355f1d5a6a3952a53fa14e7070425e Mon Sep 17 00:00:00 2001 From: Sotirios Mantziaris Date: Wed, 3 Jan 2024 21:41:05 +0200 Subject: [PATCH] Update Kafka configuration and version --- client/kafka/integration_test.go | 2 +- component/kafka/integration_test.go | 2 +- docker-compose.yml | 42 ++++++++++++++++++----------- 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/client/kafka/integration_test.go b/client/kafka/integration_test.go index 8e8e33b3c..ca8dcd29b 100644 --- a/client/kafka/integration_test.go +++ b/client/kafka/integration_test.go @@ -19,7 +19,7 @@ const ( clientTopic = "clientTopic" ) -var brokers = []string{"127.0.0.1:9093"} +var brokers = []string{"127.0.0.1:9092"} func TestNewAsyncProducer_Success(t *testing.T) { saramaCfg, err := DefaultProducerSaramaConfig("test-producer", true) diff --git a/component/kafka/integration_test.go b/component/kafka/integration_test.go index fefc66467..b4efdb0de 100644 --- a/component/kafka/integration_test.go +++ b/component/kafka/integration_test.go @@ -29,7 +29,7 @@ const ( successTopic2 = "successTopic2" failAllRetriesTopic2 = "failAllRetriesTopic2" failAndRetryTopic2 = "failAndRetryTopic2" - broker = "127.0.0.1:9093" + broker = "127.0.0.1:9092" groupSuffix = "-group" ) diff --git a/docker-compose.yml b/docker-compose.yml index f70af952d..445273237 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,27 +1,30 @@ version: "3.8" services: - zookeeper: - image: bitnami/zookeeper:latest - ports: - - "2181:2181" - environment: - - ALLOW_ANONYMOUS_LOGIN=yes kafka: - image: bitnami/kafka:2 + image: bitnami/kafka:3.4 + hostname: kafka ports: - "9092:9092" - - "9093:9093" + - "9094:9094" + volumes: + - "kafka_data:/bitnami" environment: - - KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181 + - KAFKA_ENABLE_KRAFT=yes + - KAFKA_CFG_PROCESS_ROLES=broker,controller + - KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER + - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093,EXTERNAL://:9094 + - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,EXTERNAL:PLAINTEXT + - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://127.0.0.1:9092,EXTERNAL://kafka:9094 + - KAFKA_BROKER_ID=1 + - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=1@127.0.0.1:9093 - ALLOW_PLAINTEXT_LISTENER=yes - - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CLIENT:PLAINTEXT,EXTERNAL:PLAINTEXT - - KAFKA_CFG_LISTENERS=CLIENT://:9092,EXTERNAL://:9093 - - KAFKA_CFG_ADVERTISED_LISTENERS=CLIENT://kafka:9092,EXTERNAL://localhost:9093 - - KAFKA_CFG_INTER_BROKER_LISTENER_NAME=CLIENT - depends_on: - - zookeeper + - KAFKA_CFG_NODE_ID=1 + # - KAFKA_AUTO_CREATE_TOPICS_ENABLE=true + - BITNAMI_DEBUG=yes + # - KAFKA_CFG_NUM_PARTITIONS=2 rabbitmq: image: docker.io/bitnami/rabbitmq:latest + hostname: rabbitmq ports: - '4369:4369' - '5551:5551' @@ -38,6 +41,7 @@ services: - 'rabbitmq_data:/bitnami/rabbitmq/mnesia' mysql: image: mysql:8 + hostname: mysql restart: always environment: MYSQL_DATABASE: "patrondb" @@ -53,6 +57,7 @@ services: - mysql_data:/var/lib/mysql redis: image: docker.io/bitnami/redis:6.2 + hostname: redis environment: - ALLOW_EMPTY_PASSWORD=yes ports: @@ -61,6 +66,7 @@ services: - "redis_data:/bitnami/redis/data" localstack: image: localstack/localstack:latest + hostname: localstack ports: - "127.0.0.1:4566:4566" # LocalStack Gateway - "127.0.0.1:4510-4559:4510-4559" # external services port range @@ -72,6 +78,7 @@ services: - "/var/run/docker.sock:/var/run/docker.sock" hivemq: image: hivemq/hivemq4:latest + hostname: hivemq restart: always ports: - target: 1883 @@ -88,6 +95,7 @@ services: HIVEMQ_CLUSTER_TRANSPORT_TYPE: "TCP" mongo: image: mongo:5 + hostname: mongo restart: always ports: - "27017:27017" @@ -100,4 +108,6 @@ volumes: mysql_data: driver: local redis_data: - driver: local + driver: local + kafka_data: + driver: local