From 6f380ff4fb895ff66fc635d8dcb15de596306d9e 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 14:09:58 +0900 Subject: [PATCH 1/3] #35 kafka setting --- sns_service/build.gradle.kts | 4 +- sns_service/docker-compose.yaml | 105 ++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+), 1 deletion(-) diff --git a/sns_service/build.gradle.kts b/sns_service/build.gradle.kts index a47a8a4..bdeaff5 100644 --- a/sns_service/build.gradle.kts +++ b/sns_service/build.gradle.kts @@ -33,7 +33,9 @@ dependencies { implementation("io.micrometer:micrometer-registry-prometheus") implementation ("net.logstash.logback:logstash-logback-encoder:7.3") implementation ("io.github.microutils:kotlin-logging:3.0.5") - + implementation("org.springframework.kafka:spring-kafka") + + compileOnly("org.projectlombok:lombok") annotationProcessor("org.projectlombok:lombok") testImplementation("org.springframework.boot:spring-boot-starter-test") diff --git a/sns_service/docker-compose.yaml b/sns_service/docker-compose.yaml index f68d9ca..3ca852b 100644 --- a/sns_service/docker-compose.yaml +++ b/sns_service/docker-compose.yaml @@ -73,6 +73,111 @@ services: - ./grafana/volume:/var/lib/grafana restart: always + zk1: + container_name: zookeeper1 + image: wurstmeister/zookeeper:latest + restart: always + hostname: zk1 + 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" + + zk2: + container_name: zookeeper2 + image: wurstmeister/zookeeper:latest + restart: always + hostname: zk2 + ports: + - "2182:2181" + 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" + + zk3: + container_name: zookeeper3 + image: wurstmeister/zookeeper:latest + restart: always + hostname: zk3 + ports: + - "2183:2181" + 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" + + kafka1: + container_name: kafka1 + image: wurstmeister/kafka:latest + restart: on-failure + depends_on: + - zk1 + - zk2 + - zk3 + ports: + - "9092:9092" + environment: + 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 + ports: + - "9093:9092" + volumes: + - /var/run/docker.sock:/var/run/docker.sock + environment: + 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 + ports: + - "9094:9092" + volumes: + - /var/run/docker.sock:/var/run/docker.sock + environment: + 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 + + kafka-ui: + image: provectuslabs/kafka-ui + container_name: kafka-ui + ports: + - "10000: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 + volumes: elasticsearch-volume: external: false 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 2/3] #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: From 4fc48a8c61d5db23d768e2758e0de04ddfd12e08 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 18:09:56 +0900 Subject: [PATCH 3/3] update readme.md --- README.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9fd48c8..0483ea1 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,17 @@ K twitter, K Instagram 목표 경제적 자유 기술 향상 -# 사용 (예정) 기술 -k8s, docker, argoCD, Github Actions, terraform, spring, kotlin, kafka, redis, mysql, mongo, nginx, ElasticSearch, Kibana, Logstash, Grafana, Prometheus, Istio, React, HTML, CSS, JavaScript, TypeScript, Storybook ... +# 사용 기술 +docker, Github Actions, spring, kotlin, kafka, redis, mysql, ElasticSearch, Kibana, Logstash, Grafana, Prometheus + +# 사용 예정 기술 +k8s, argoCD, terraform, mongo, nginx, Istio, React, HTML, CSS, JavaScript, TypeScript, Storybook ... # 멤버 코더들의 반란 (프론트 급구..) -| | | | | -|:-----------------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| -| [조현우](https://github.com/hyun98) | [조정현](https://github.com/jojaeng2) | [정현모](https://github.com/gusah009) | 같이 하실분 | -| [NCSOFT](https://kr.ncsoft.com/kr/index.do) | [NAVER](https://www.naver.com/) | [KAKAO](https://www.kakaocorp.com/page/) | 구합니다 | + +| | | | | | +|:-----------------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------:| :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| +| [조현우](https://github.com/hyun98) | [조정현](https://github.com/jojaeng2) | [정현모](https://github.com/gusah009) | [최우창](https://github.com/woo-chang) | 같이 하실분 | +| [NCSOFT](https://kr.ncsoft.com/kr/index.do) | [NAVER](https://www.naver.com/) | [KAKAO](https://www.kakaocorp.com/page/) | [WOOWABROS](https://www.woowahan.com/en) | 구합니다 | +| BE | BE,FE | BE | BE,MARKUP | 구합니다 | \ No newline at end of file