-
Notifications
You must be signed in to change notification settings - Fork 0
/
compose.yml
80 lines (74 loc) · 2.49 KB
/
compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
version: '3'
services:
order_db:
# profiles:
# - "local"
platform: linux/x86_64
container_name: order_database
image: mysql:8.0.23
environment:
MYSQL_DATABASE: order
MYSQL_USER: user
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: root_password
ports:
- "${ORDER_DB_PORT:-3312}:3306"
volumes:
- ./order/src/main/resources/db/init-schema.sql:/docker-entrypoint-initdb.d/init_db.sql
restaurant_db:
# profiles:
# - "local"
platform: linux/x86_64
container_name: restaurant_database
image: mysql:8.0.23
environment:
MYSQL_DATABASE: restaurant
MYSQL_USER: user
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: root_password
ports:
- "${RESTAURANT_DB_PORT:-3313}:3306"
volumes:
- ./restaurant/src/main/resources/db/init-schema.sql:/docker-entrypoint-initdb.d/init_db.sql
zookeeper:
image: confluentinc/cp-zookeeper:7.5.0
container_name: food_delivery_zookeeper
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
ports:
- "22181:2181"
kafka:
image: confluentinc/cp-kafka:7.5.0
container_name: food_delivery_kafka
depends_on:
- zookeeper
ports:
- "29092:29092"
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,PLAINTEXT_HOST://localhost:29092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
# KAFKA_CREATE_TOPICS: >
# order-details:1:1
# restaurant-status:1:1
# to read = kafka-console-consumer --bootstrap-server localhost:29092 --topic order-details --from-beginning
kafka_setup:
image: confluentinc/cp-kafka:7.5.0
container_name: food_delivery_kafka_setup
depends_on:
- kafka
entrypoint: ['/bin/sh', '-c']
command: |
"
# blocks until kafka is reachable
kafka-topics --bootstrap-server kafka:9092 --list
echo -e 'creating kafka topics'
kafka-topics --bootstrap-server kafka:9092 --create --if-not-exists --topic order-details --replication-factor 1 --partitions 1
kafka-topics --bootstrap-server kafka:9092 --create --if-not-exists --topic restaurant-status --replication-factor 1 --partitions 1
echo -e 'available topics'
kafka-topics --bootstrap-server kafka:9092 --list
"