From 4605840568c77ef63db8c8aaef2bd28350eb2a12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=EC=A0=95=ED=98=84=5B=EC=BB=A4=EB=A8=B8=EC=8A=A4I?= =?UTF-8?q?D=EA=B0=9C=EB=B0=9C=5D?= Date: Sun, 31 Dec 2023 15:13:15 +0900 Subject: [PATCH] #35 docker compose fix --- sns_service/docker-compose.yaml | 131 ++++++++++++++------------------ 1 file changed, 56 insertions(+), 75 deletions(-) diff --git a/sns_service/docker-compose.yaml b/sns_service/docker-compose.yaml index 3ca852b..95513fc 100644 --- a/sns_service/docker-compose.yaml +++ b/sns_service/docker-compose.yaml @@ -48,7 +48,7 @@ services: - kibana-volume:/usr/share/kibana/data - ./infra/kibana/config/kibana.yaml:/usr/share/kibana/config/kibana.yml - + prometheus: image: "prom/prometheus:v2.47.0" container_name: prometheus @@ -73,110 +73,91 @@ services: - ./grafana/volume:/var/lib/grafana restart: always - zk1: - container_name: zookeeper1 - image: wurstmeister/zookeeper:latest - restart: always - hostname: zk1 + zookeeper-1: + image: confluentinc/cp-zookeeper:latest ports: - "2181:2181" environment: - ZOO_MY_ID: 1 - ZOO_SERVERS: server.1=zk1:2888:3888;2181 server.2=zk2:2888:3888;2181 server.3=zk3:2888:3888;2181 - volumes: - - "~/zk-cluster/zk1/data:/data" + ZOOKEEPER_CLIENT_PORT: 2181 + ZOOKEEPER_SERVER_ID: 1 + ZOOKEEPER_SERVERS: zookeeper-1:2888:3888;zookeeper-2:2888:3888;zookeeper-3:2888:3888 - zk2: - container_name: zookeeper2 - image: wurstmeister/zookeeper:latest - restart: always - hostname: zk2 + zookeeper-2: + image: confluentinc/cp-zookeeper:latest ports: - - "2182:2181" + - "2182:2182" environment: - ZOO_MY_ID: 2 - ZOO_SERVERS: server.1=zk1:2888:3888;2181 server.2=zk2:2888:3888;2181 server.3=zk3:2888:3888;2181 - volumes: - - "~/zk-cluster/zk2/data:/data" + ZOOKEEPER_CLIENT_PORT: 2182 + ZOOKEEPER_SERVER_ID: 2 + ZOOKEEPER_SERVERS: zookeeper-1:2888:3888;zookeeper-2:2888:3888;zookeeper-3:2888:3888 - zk3: - container_name: zookeeper3 - image: wurstmeister/zookeeper:latest - restart: always - hostname: zk3 + zookeeper-3: + image: confluentinc/cp-zookeeper:latest ports: - - "2183:2181" + - "2183:2183" environment: - ZOO_MY_ID: 3 - ZOO_SERVERS: server.1=zk1:2888:3888;2181 server.2=zk2:2888:3888;2181 server.3=zk3:2888:3888;2181 - volumes: - - "~/zk-cluster/zk3/data:/data" + ZOOKEEPER_CLIENT_PORT: 2183 + ZOOKEEPER_SERVER_ID: 3 + ZOOKEEPER_SERVERS: zookeeper-1:2888:3888;zookeeper-2:2888:3888;zookeeper-3:2888:3888 - kafka1: - container_name: kafka1 - image: wurstmeister/kafka:latest - restart: on-failure - depends_on: - - zk1 - - zk2 - - zk3 + kafka-1: + image: confluentinc/cp-kafka:latest ports: - "9092:9092" + - "29092:29092" environment: + KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka-1:19092,EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9092,DOCKER://host.docker.internal:29092 + KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT,DOCKER:PLAINTEXT + KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL + KAFKA_ZOOKEEPER_CONNECT: "zookeeper-1:2181,zookeeper-2:2182,zookeeper-3:2183" KAFKA_BROKER_ID: 1 - KAFKA_ADVERTISED_HOST_NAME: host.docker.internal - BOOTSTRAP_SERVERS: host.docker.internal:9092, host.docker.internal:9093, host.docker.internal:9094 - KAFKA_ZOOKEEPER_CONNECT: "zk1:2181,zk2:2182,zk3:2183" - KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 2 - - kafka2: - container_name: kafka2 - image: wurstmeister/kafka:latest - restart: on-failure depends_on: - - zk1 - - zk2 - - zk3 + - zookeeper-1 + - zookeeper-2 + - zookeeper-3 + + kafka-2: + image: confluentinc/cp-kafka:latest ports: - - "9093:9092" - volumes: - - /var/run/docker.sock:/var/run/docker.sock + - "9093:9093" + - "29093:29093" environment: + KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka-2:19093,EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9093,DOCKER://host.docker.internal:29093 + KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT,DOCKER:PLAINTEXT + KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL + KAFKA_ZOOKEEPER_CONNECT: "zookeeper-1:2181,zookeeper-2:2182,zookeeper-3:2183" KAFKA_BROKER_ID: 2 - KAFKA_ADVERTISED_HOST_NAME: host.docker.internal - BOOTSTRAP_SERVERS: host.docker.internal:9092, host.docker.internal:9093, host.docker.internal:9094 - KAFKA_ZOOKEEPER_CONNECT: "zk1:2181,zk2:2182,zk3:2183" - KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 2 - - kafka3: - container_name: kafka3 - image: wurstmeister/kafka:latest - restart: on-failure depends_on: - - zk1 - - zk2 - - zk3 + - zookeeper-1 + - zookeeper-2 + - zookeeper-3 + + kafka-3: + image: confluentinc/cp-kafka:latest ports: - - "9094:9092" - volumes: - - /var/run/docker.sock:/var/run/docker.sock + - "9094:9094" + - "29094:29094" environment: + KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka-3:19094,EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9094,DOCKER://host.docker.internal:29094 + KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT,DOCKER:PLAINTEXT + KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL + KAFKA_ZOOKEEPER_CONNECT: "zookeeper-1:2181,zookeeper-2:2182,zookeeper-3:2183" KAFKA_BROKER_ID: 3 - KAFKA_ADVERTISED_HOST_NAME: host.docker.internal - BOOTSTRAP_SERVERS: host.docker.internal:9092, host.docker.internal:9093, host.docker.internal:9094 - KAFKA_ZOOKEEPER_CONNECT: "zk1:2181,zk2:2182,zk3:2183" - KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 2 + depends_on: + - zookeeper-1 + - zookeeper-2 + - zookeeper-3 kafka-ui: image: provectuslabs/kafka-ui container_name: kafka-ui ports: - - "10000:8080" + - "8989:8080" restart: always environment: - KAFKA_CLUSTERS_0_NAME=local - - KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS=host.docker.internal:9092,host.docker.internal:9093,host.docker.internal:9094 - - KAFKA_CLUSTERS_0_ZOOKEEPER=zk1:2181,zk2:2182,zk1:2183 + - KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS=kafka-1:29092,kafka-2:29093,kafka-3:29094 + - KAFKA_CLUSTERS_0_ZOOKEEPER=zookeeper-1:2181,zookeeper-2:2182,zookeeper-3:2183 volumes: elasticsearch-volume: