[hw-6] add notifier service, kafka

This commit is contained in:
Никита Шубин
2025-07-17 19:20:27 +00:00
parent 424d6905da
commit 6e1ad86128
33 changed files with 1412 additions and 92 deletions

View File

@@ -18,12 +18,25 @@ services:
context: .
dockerfile: loms/Dockerfile
depends_on:
- postgres-master
postgres-master:
condition: service_started
init-kafka:
condition: service_completed_successfully
ports:
- "8083:8083"
- "8084:8084"
- "8085:8085"
notifier:
build:
context: .
dockerfile: notifier/Dockerfile
depends_on:
init-kafka:
condition: service_completed_successfully
deploy:
replicas: 3
postgres-master:
image: gitlab-registry.ozon.dev/go/classroom-18/students/base/postgres:16
container_name: postgres-master
@@ -57,3 +70,52 @@ services:
- POSTGRESQL_NUM_SYNCHRONOUS_REPLICAS=1
ports:
- "5434:5432"
kafka-ui:
container_name: kafka-ui
image: provectuslabs/kafka-ui:latest
ports:
- 8095:8080
environment:
KAFKA_CLUSTERS_0_NAME: local
KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: kafka0:29092
DYNAMIC_CONFIG_ENABLED: "true"
kafka0:
container_name: kafka
image: confluentinc/cp-kafka:7.7.1.arm64
ports:
- 9092:9092
expose:
- '29092'
environment:
KAFKA_NODE_ID: 1
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,CONTROLLER:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka0:29092,PLAINTEXT_HOST://localhost:9092
KAFKA_LISTENERS: PLAINTEXT://kafka0:29092,CONTROLLER://kafka0:29093,PLAINTEXT_HOST://:9092
KAFKA_CONTROLLER_LISTENER_NAMES: "CONTROLLER"
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
KAFKA_CONTROLLER_QUORUM_VOTERS: "1@kafka0:29093"
KAFKA_PROCESS_ROLES: "broker,controller"
KAFKA_LOG_DIRS: "/tmp/kraft-combined-logs"
CLUSTER_ID: 'MkU3OEVBNTcwNTJENDM2Qk'
init-kafka:
image: confluentinc/cp-kafka:7.7.1.arm64
depends_on:
- kafka0
entrypoint: [ '/bin/sh', '-c' ]
command: |
"
# blocks until kafka is reachable
kafka-topics --bootstrap-server kafka:29092 --list
echo -e 'Creating kafka topics'
kafka-topics --create --topic loms.order-events --bootstrap-server kafka:29092 --partitions 2 --replication-factor 1
echo -e 'Successfully created the following topics:'
kafka-topics --bootstrap-server kafka:29092 --list
"