-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
229 lines (219 loc) · 5.88 KB
/
docker-compose.yml
File metadata and controls
229 lines (219 loc) · 5.88 KB
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
services:
# --- Databases ---
user-db:
image: postgres:15
container_name: user-db
environment:
POSTGRES_DB: bookstore_user_service_db
POSTGRES_USER: postgres
POSTGRES_PASSWORD: admin123
ports:
- "5433:5432"
volumes:
- user-db-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d bookstore_user_service_db"]
interval: 5s
timeout: 5s
retries: 5
catalog-db:
image: postgres:15
container_name: catalog-db
environment:
POSTGRES_DB: bookstore_catalog_service_db
POSTGRES_USER: postgres
POSTGRES_PASSWORD: admin123
ports:
- "5434:5432"
volumes:
- catalog-db-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d bookstore_catalog_service_db"]
interval: 5s
timeout: 5s
retries: 5
checkout-db:
image: postgres:15
container_name: checkout-db
environment:
POSTGRES_DB: bookstore_checkout_service_db
POSTGRES_USER: postgres
POSTGRES_PASSWORD: admin123
ports:
- "5435:5432"
volumes:
- checkout-db-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d bookstore_checkout_service_db"]
interval: 5s
timeout: 5s
retries: 5
# --- Microservices ---
discovery-service:
build:
context: .
dockerfile: discovery-service/Dockerfile
container_name: discovery-service
ports:
- "8761:8761"
healthcheck:
test: ["CMD-SHELL", "wget -T 5 -qO- http://localhost:8761/actuator/health | grep UP || exit 1"]
interval: 10s
timeout: 5s
retries: 5
start_period: 15s
config-server:
build:
context: .
dockerfile: config-server/Dockerfile
container_name: config-server
ports:
- "8888:8888"
depends_on:
discovery-service:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget -T 5 -qO- http://localhost:8888/actuator/health || exit 1"]
interval: 5s
timeout: 3s
retries: 10
start_period: 15s
api-gateway:
build:
context: .
dockerfile: api-gateway/Dockerfile
container_name: api-gateway
ports:
- "8080:8080"
depends_on:
discovery-service:
condition: service_healthy
config-server:
condition: service_healthy
auth-server:
condition: service_healthy
user-service:
condition: service_healthy
auth-server:
build:
context: .
dockerfile: auth-server/Dockerfile
container_name: auth-server
ports:
- "9001:9001"
depends_on:
discovery-service:
condition: service_healthy
user-db:
condition: service_healthy
config-server:
condition: service_healthy
environment:
- SPRING_DATASOURCE_URL=jdbc:postgresql://user-db:5432/bookstore_user_service_db
- SPRING_DATASOURCE_USERNAME=postgres
- SPRING_DATASOURCE_PASSWORD=admin123
healthcheck:
test: ["CMD-SHELL", "wget -T 5 -qO- http://localhost:9001/actuator/health || exit 1"]
interval: 5s
timeout: 3s
retries: 10
start_period: 15s
catalog-service:
build:
context: .
dockerfile: catalog-service/Dockerfile
container_name: catalog-service
ports:
- "8082:8082"
depends_on:
discovery-service:
condition: service_healthy
catalog-db:
condition: service_healthy
config-server:
condition: service_healthy
environment:
- SPRING_DATASOURCE_URL=jdbc:postgresql://catalog-db:5432/bookstore_catalog_service_db
- SPRING_DATASOURCE_USERNAME=postgres
- SPRING_DATASOURCE_PASSWORD=admin123
user-service:
build:
context: .
dockerfile: user-service/Dockerfile
container_name: user-service
ports:
- "8081:8081"
depends_on:
discovery-service:
condition: service_healthy
user-db:
condition: service_healthy
config-server:
condition: service_healthy
healthcheck:
test: [ "CMD-SHELL", "wget -T 5 -qO- http://localhost:8081/actuator/health || exit 1" ]
interval: 5s
timeout: 3s
retries: 10
start_period: 15s
environment:
- SPRING_DATASOURCE_URL=jdbc:postgresql://user-db:5432/bookstore_user_service_db
- SPRING_DATASOURCE_USERNAME=postgres
- SPRING_DATASOURCE_PASSWORD=admin123
checkout-service:
build:
context: .
dockerfile: checkout-service/Dockerfile
container_name: checkout-service
ports:
- "8083:8083"
depends_on:
discovery-service:
condition: service_healthy
checkout-db:
condition: service_healthy
config-server:
condition: service_healthy
environment:
- SPRING_DATASOURCE_URL=jdbc:postgresql://checkout-db:5432/bookstore_checkout_service_db
- SPRING_DATASOURCE_USERNAME=postgres
- SPRING_DATASOURCE_PASSWORD=admin123
# --- Monitoring ---
zipkin:
image: openzipkin/zipkin
container_name: zipkin
ports:
- "9411:9411"
depends_on:
discovery-service:
condition: service_healthy
prometheus:
image: prom/prometheus
container_name: prometheus
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
- ./alert.rules.yml:/etc/prometheus/alert.rules.yml
ports:
- "9090:9090"
grafana:
image: grafana/grafana
container_name: grafana
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=admin
ports:
- "3000:3000"
depends_on:
prometheus:
condition: service_started
alertmanager:
image: prom/alertmanager
container_name: alertmanager
ports:
- "9093:9093"
volumes:
- ./alertmanager/alertmanager.yml:/etc/alertmanager/alertmanager.yml
volumes:
user-db-data:
catalog-db-data:
checkout-db-data: