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