-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
202 lines (197 loc) · 5.54 KB
/
docker-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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
version: "3.8"
services:
db:
container_name: db
image: mysql:latest
environment:
MYSQL_ROOT_PASSWORD: 1234
MYSQL_DATABASE: member
ports:
- "3306:3306"
volumes:
- ./init:/docker-entrypoint-initdb.d
networks:
- monitoring
member-context:
container_name: member-context
build:
context: ./member-context
dockerfile: Dockerfile
ports:
- "8080:8080"
restart: on-failure
depends_on:
db:
condition: service_started
kafkaA:
condition: service_started
kafkaB:
condition: service_started
kafkaC:
condition: service_started
init-kafka:
condition: service_healthy
healthcheck:
test: [ "CMD", "nc", "-z", "localhost", "8080" ]
interval: 10s
timeout: 5s
retries: 5
networks:
- monitoring
check-in-request-ms:
container_name: check-in-request-ms
build:
context: ./check-in-request-MS
dockerfile: Dockerfile
ports:
- "8081:8081"
restart: on-failure
depends_on:
- db
networks:
- monitoring
prometheus:
container_name: prometheus
image: prom/prometheus
restart: on-failure
ports:
- "9090:9090"
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
command:
- '--config.file=/etc/prometheus/prometheus.yml'
networks:
- monitoring
grafana:
container_name: grafana
image: grafana/grafana
restart: on-failure
ports:
- "3000:3000"
networks:
- monitoring
node_exporter:
image: prom/node-exporter:latest
container_name: node_exporter
restart: on-failure
ports:
- "9100:9100"
networks:
- monitoring
zoo2:
image: confluentinc/cp-zookeeper:7.3.2
platform: linux/arm64
hostname: zoo2
container_name: zoo2
ports:
- "2181:2181"
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_SERVER_ID: 1
ZOOKEEPER_SERVERS: zoo2:2888:3888
networks:
- monitoring
kafkaA:
image: confluentinc/cp-kafka:7.3.2
platform: linux/arm64
hostname: kafkaA
container_name: kafkaA
ports:
- "9092:9092"
- "29092:29092"
environment:
KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafkaA: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: "zoo2:2181"
KAFKA_BROKER_ID: 1
KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO"
depends_on:
- zoo2
networks:
- monitoring
kafkaB:
image: confluentinc/cp-kafka:7.3.2
platform: linux/arm64
hostname: kafkaB
container_name: kafkaB
ports:
- "9093:9093"
- "29093:29093"
environment:
KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafkaB: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: "zoo2:2181"
KAFKA_BROKER_ID: 2
KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO"
depends_on:
- zoo2
networks:
- monitoring
kafkaC:
image: confluentinc/cp-kafka:7.3.2
platform: linux/arm64
hostname: kafkaC
container_name: kafkaC
ports:
- "9094:9094"
- "29094:29094"
environment:
KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafkaC: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: "zoo2:2181"
KAFKA_BROKER_ID: 3
KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO"
depends_on:
- zoo2
networks:
- monitoring
init-kafka:
image: confluentinc/cp-kafka:7.3.2
platform: linux/arm64
hostname: init-kafka
container_name: init-kafka
depends_on:
- kafkaA
- kafkaB
- kafkaC
entrypoint: [ '/bin/sh', '-c' ]
command: |
"
# blocks until kafka is reachable
kafka-topics --bootstrap-server kafkaA:29092 --list
echo -e 'Creating kafka topics'
kafka-topics --bootstrap-server kafkaA:29092 --create --if-not-exists --topic alarm-events --replication-factor 1 --partitions 1
echo -e 'Successfully created the following topics:'
kafka-topics --bootstrap-server kafkaA:29092 --list
# member-ms가 실행될 때까지 대기
echo 'Waiting for member-ms to start...'
until nc -z member-context 8080; do
sleep 5
done
echo 'member-ms is up, exiting init-kafka'
"
healthcheck:
test: [ "CMD-SHELL", "kafka-topics --bootstrap-server kafkaA:29092 --list | grep alarm-events" ]
interval: 10s
timeout: 5s
retries: 5
networks:
- monitoring
# mysql_exporter:
# image: prom/mysqld-exporter:latest
# container_name: mysql_exporter
# restart: on-failure
# environment:
# - DATA_SOURCE_NAME=root:1234@tcp(db:3306)/
# ports:
# - "9104:9104"
# networks:
# - monitoring
# depends_on:
# - db
networks:
monitoring:
driver: bridge