forked from elastic/spring-petclinic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
301 lines (291 loc) · 9.22 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
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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
version: '3.7'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:${ES_VERSION:-7.4.0}
container_name: spring-petclinic-elasticsearch
environment:
- "ES_JAVA_OPTS=-Xms2048m -Xmx2048m"
- node.name=petclinic-elasticsearch
- discovery.type=single-node
- ELASTIC_PASSWORD=${ELASTIC_PASSWORD:-changeme}
- cluster.name=sa-demo-spring-petclinic
- bootstrap.memory_lock=true
- xpack.monitoring.enabled=true
- xpack.ml.node_concurrent_job_allocations=8
- xpack.security.enabled=true
- http.host=0.0.0.0
networks:
spring-petclinic-net:
aliases:
- es
- elasticsearch
volumes:
- esdata01:/usr/share/elasticsearch/data
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
deploy:
resources:
limits:
memory: 4g
healthcheck:
test: ["CMD-SHELL", "curl -s http://localhost:9200/_cluster/health | grep -vq '\"status\":\"red\"'"]
retries: 10
interval: 20s
ports:
- "127.0.0.1:${ELASTICSEARCH_PORT:-9200}:9200"
cap_add:
- IPC_LOCK
kibana:
image: docker.elastic.co/kibana/kibana:${ES_VERSION:-7.4.0}
container_name: spring-petclinic-kibana
environment:
SERVER_HOST: "0.0.0.0"
ELASTICSEARCH_HOSTS: http://elasticsearch:9200
ELASTICSEARCH_USERNAME: elastic
ELASTICSEARCH_PASSWORD: ${ELASTIC_PASSWORD:-changeme}
XPACK_SECURITY_SECURECOOKIES: "false"
XPACK_MONITORING_KIBANA_COLLECTION_ENABLED: "false"
XPACK_MONITORING_ENABLED: "true"
networks:
spring-petclinic-net:
aliases:
- kibana
ports:
- "127.0.0.1:${KIBANA_PORT:-5601}:5601"
logging:
driver: 'json-file'
options:
max-size: '2m'
max-file: '5'
healthcheck:
test: ["CMD", "curl", "--write-out", "'HTTP %{http_code}'", "--silent", "--output", "/dev/null", "http://kibana:5601/"]
retries: 10
interval: 10s
depends_on:
- elasticsearch
apm-server:
image: docker.elastic.co/apm/apm-server:${ES_VERSION:-7.4.0}
container_name: spring-petclinic-apm-server
ports:
- "127.0.0.1:${APM_SERVER_PORT:-8200}:8200"
- "127.0.0.1:${APM_SERVER_MONITOR_PORT:-6060}:6060"
networks:
spring-petclinic-net:
aliases:
- apm-server
command: >
apm-server -e
-E apm-server.frontend.enabled=true
-E apm-server.frontend.rate_limit=100000
-E apm-server.host=0.0.0.0:8200
-E apm-server.read_timeout=1m
-E apm-server.shutdown_timeout=2m
-E apm-server.write_timeout=1m
-E apm-server.rum.enabled=true
-E apm-server.kibana.host=kibana:5601
-E apm-server.kibana.protocol=http
-E apm-server.kibana.username=elastic
-E apm-server.kibana.password=${ELASTIC_PASSWORD:-changeme}
-E monitoring.enabled=true
-E output.elasticsearch.hosts=elasticsearch:9200
-E output.elasticsearch.username=elastic
-E output.elasticsearch.password=${ELASTIC_PASSWORD:-changeme}
-E setup.template.enabled=true
-E setup.template.overwrite=true
-E apm-server.frontend.enable=true
-E apm-server.frontend.rate_limit=10000
-E apm-server.read_timeout=1m
-E apm-server.shutdown_timeout=2m
-E apm-server.write_timeout=1m
-E logging.metrics.enabled=true
-E logging.metrics.enabled=true
-E ilm.enabled=true
cap_drop:
- ALL
cap_add:
- CHOWN
- DAC_OVERRIDE
- SETGID
- SETUID
logging:
driver: 'json-file'
options:
max-size: '2m'
max-file: '5'
depends_on:
- elasticsearch
healthcheck:
test: ["CMD", "curl", "--write-out", "'HTTP %{http_code}'", "--silent", "--output", "/dev/null", "http://apm-server:8200/"]
retries: 10
interval: 10s
mysql:
image: spring-petclinic-mysql:${ES_VERSION:-7.4.0}
build:
context: ./docker/mysql
container_name: spring-petclinic-mysql
networks:
spring-petclinic-net:
aliases:
- mysql
ports:
- "3306:3306"
environment:
- MYSQL_ROOT_PASSWORD=petclinic
- MYSQL_DATABASE=petclinic
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
- AWS_DEFAULT_REGION=us-east-2
spring-petclinic-server:
image: spring-petclinic-server:${ES_VERSION:-7.4.0}
build:
context: ./docker/server
container_name: spring-petclinic-server
networks:
spring-petclinic-net:
aliases:
- spring-petclinic-server
ports:
- "127.0.0.1:${SERVER_PORT:-8000}:8000"
logging:
driver: 'json-file'
options:
max-size: '2m'
max-file: '5'
environment:
ELASTIC_APM_SERVER_URL: http://apm-server:${APM_SERVER_PORT:-8200}
ELASTIC_APM_SPAN_FRAMES_MIN_DURATION: -1
ELASTIC_APM_CAPTURE_BODY: all
SERVER_PORT: ${SERVER_PORT:-8000}
JAVA_PROFILE: mysql,spring-data-jpa
DATABASE_URL: jdbc:mysql://mysql:3306/petclinic?useUnicode=true
DATABASE_USERNAME: root
DATABASE_PASSWORD: petclinic
DATABASE_DRIVER: com.mysql.jdbc.Driver
DATABASE_DIALECT: MYSQL
DATABASE_PLATFORM: org.hibernate.dialect.MySQLDialect
DATASOURCE_SCHEMA: classpath*:db/mysql/initDB.sql
DATASOURCE_DATA: classpath*:db/mysql/populateDB.sql
INITIALIZE_DB: "true"
ELASTIC_APM_SERVICE_NAME: petclinic-spring
depends_on:
- elasticsearch
- apm-server
- mysql
healthcheck:
test: ["CMD", "curl", "--write-out", "'HTTP %{http_code}'", "--silent", "--output", "/dev/null", "http://spring-petclinic-server:${SERVER_PORT:-8000}/"]
interval: 10s
retries: 10
spring-petclinic-client:
build:
context: ./docker/client
image: spring-petclinic-client:${ES_VERSION:-7.4.0}
container_name: spring-petclinic-client
networks:
spring-petclinic-net:
aliases:
- spring-petclinic-client
ports:
- "127.0.0.1:${CLIENT_SERVER_PORT:-3000}:3000"
logging:
driver: 'json-file'
options:
max-size: '2m'
max-file: '5'
environment:
ELASTIC_APM_SERVER_URL: http://apm-server:${APM_SERVER_PORT:-8200}
ELASTIC_APM_SERVER_JS_URL: http://localhost:8200
ELASTIC_APM_SERVICE_VERSION: 1.0.0
ELASTIC_APM_SERVICE_NAME: petclinic-client
ELASTIC_APM_CLIENT_SERVICE_NAME: petclinic-react
API_SERVER: 'http://spring-petclinic-server:${SERVER_PORT:-8000}'
SERVER_PORT: ${CLIENT_SERVER_PORT:-3000}
NODE_ENV: production
ELASTICSEARCH_USERNAME: elastic
ELASTICSEARCH_URL: http://elasticsearch:9200
ELASTICSEARCH_PASSWORD: ${ELASTIC_PASSWORD:-changeme}
PETCLINIC_INTERNAL_URL: "http://spring-petclinic-client:${CLIENT_SERVER_PORT:-3000}"
PETCLINIC_EXTERNAL_URL: "http://localhost:${CLIENT_SERVER_PORT:-3000}"
ADDRESS_SERVER: "http://spring-address-finder:5000"
depends_on:
- spring-petclinic-server
- spring-address-finder
healthcheck:
test: ["CMD", "curl", "--write-out", "'HTTP %{http_code}'", "--silent", "--output", "/dev/null", "http://spring-petclinic-client:${CLIENT_SERVER_PORT:-3000}/"]
interval: 10s
retries: 10
spring-address-finder:
build:
context: ./docker/address-finder
image: spring-address-finder:${ES_VERSION:-7.4.0}
container_name: spring-address-finder
networks:
spring-petclinic-net:
aliases:
- spring-address-finder
ports:
- "127.0.0.1:${ADDRESS_FINDER_PORT:-5000}:5000"
logging:
driver: 'json-file'
options:
max-size: '2m'
max-file: '5'
environment:
ELASTIC_APM_SERVER_URL: http://apm-server:${APM_SERVER_PORT:-8200}
ELASTIC_APM_SERVICE_VERSION: 1.0.0
ELASTIC_APM_SERVICE_NAME: petclinic-address-finder
ELASTIC_APM_CLIENT_SERVICE_NAME: petclinic-react
ELASTICSEARCH_USER: elastic
ELASTICSEARCH_URL: http://elasticsearch:9200
ELASTICSEARCH_PASSWORD: ${ELASTIC_PASSWORD:-changeme}
depends_on:
- elasticsearch
spring-client-loadgen:
build:
context: ./docker/client-loadgen
image: spring-client-loadgen:${ES_VERSION:-7.4.0}
container_name: spring-client-loadgen
networks:
spring-petclinic-net:
aliases:
- spring-client-loadgen
logging:
driver: 'json-file'
options:
max-size: '2m'
max-file: '5'
environment:
PETCLINIC_BASE_URL: http://spring-petclinic-client:${CLIENT_SERVER_PORT:-3000}
depends_on:
- spring-petclinic-client
spring-server-loadgen:
build:
context: ./docker/server-loadgen
image: spring-server-loadgen:${ES_VERSION:-7.4.0}
container_name: spring-server-loadgen
networks:
spring-petclinic-net:
aliases:
- spring-server-loadgen
logging:
driver: 'json-file'
options:
max-size: '2m'
max-file: '5'
environment:
ENDPOINT_PORT: 3000
ENDPOINT_BASE: spring-petclinic-client
ENDPOINT_PROTOCOL: http
DATA_FILES: "/opt/data_files"
depends_on:
- spring-petclinic-client
networks:
spring-petclinic-net:
driver: bridge
volumes:
esdata01:
driver: local