-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
226 lines (207 loc) · 5.28 KB
/
docker-compose.yml
File metadata and controls
226 lines (207 loc) · 5.28 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
x-backend-healthcheck: &backend-healthcheck
test: [ "CMD-SHELL", "curl -f http://localhost:8080/actuator/health || exit 1" ]
interval: 10s
timeout: 5s
retries: 5
x-mongodb-healthcheck: &mongodb-healthcheck
test: [ "CMD-SHELL", "mongosh --quiet --eval 'db.adminCommand({ping:1})' || exit 1" ]
interval: 10s
timeout: 5s
retries: 5
x-redis-healthcheck: &redis-healthcheck
test: [ "CMD", "redis-cli", "ping" ]
interval: 10s
timeout: 5s
retries: 5
x-restart-policy: &restart-policy
restart: unless-stopped
x-mongo-image: &mongo-image
image: mongo:8.2.3
x-redis-image: &redis-image
image: redis:8.2.3
x-backend-build: &backend-build
build:
context: .
x-backend-load-test-envs: &backend-load-test-envs
environment:
JAVA_OPTS: "\
-XX:ActiveProcessorCount=6 \
-XX:+UseContainerSupport \
-XX:+UseG1GC \
-XX:InitiatingHeapOccupancyPercent=50 \
-XX:MaxGCPauseMillis=150 \
-XX:ConcGCThreads=2 \
-XX:ParallelGCThreads=4 \
-Xms4g \
-Xmx4g \
-XX:+AlwaysPreTouch \
-XX:+PerfDisableSharedMem \
-XX:+ExitOnOutOfMemoryError \
-XX:StartFlightRecording=filename=/snapshots/profile.jfr"
services:
backend:
<<: [ *backend-build, *restart-policy ]
container_name: remote_config_backend
ports:
- "8080:8080"
env_file:
- .env
profiles: [ "production" ]
healthcheck: *backend-healthcheck
depends_on:
mongodb:
condition: service_healthy
redis:
condition: service_healthy
backend-test:
<<: [ *backend-build, *restart-policy ]
container_name: remote_config_backend_test
ports:
- "8080:8080"
env_file:
- .env.testing
profiles: [ "test" ]
healthcheck: *backend-healthcheck
depends_on:
mongodb-test:
condition: service_healthy
redis-test:
condition: service_healthy
networks:
- k6-net
backend-load-test:
<<: [ *backend-build, *restart-policy, *backend-load-test-envs ]
container_name: remote_config_backend_load_test
ports:
- "8080:8080"
env_file:
- .env.testing
profiles: [ "load-test" ]
healthcheck: *backend-healthcheck
mem_limit: 4g
cpus: 6.0
volumes:
- ./snapshots:/snapshots
depends_on:
mongodb-test:
condition: service_healthy
redis-test:
condition: service_healthy
networks:
- k6-net
mongodb:
<<: [ *mongo-image, *restart-policy ]
container_name: remote_config_mongodb
expose:
- "27018"
ports:
- "27018:27017"
env_file:
- .env.mongo
profiles: [ "production" ]
healthcheck: *mongodb-healthcheck
volumes:
- mongodb-data:/data/db
mongodb-test:
<<: [ *mongo-image, *restart-policy ]
container_name: remote_config_mongodb_test
expose:
- "27018"
ports:
- "27018:27017"
env_file:
- .env.mongo
profiles: [ "load-test", "test" ]
healthcheck: *mongodb-healthcheck
mem_limit: 1g
cpus: 1.0
networks:
- k6-net
redis:
<<: [ *redis-image, *restart-policy ]
container_name: remote_config_redis
expose:
- "6379"
ports:
- "6379:6379"
profiles: [ "production" ]
healthcheck: *redis-healthcheck
volumes:
- redis-data:/data
redis-test:
<<: [ *redis-image, *restart-policy ]
container_name: remote_config_redis_test
expose:
- "6379"
ports:
- "6379:6379"
profiles: [ "load-test", "test" ]
healthcheck: *redis-healthcheck
mem_limit: 512m
cpus: 0.5
networks:
- k6-net
prometheus:
image: prom/prometheus:v3.7.2
<<: *restart-policy
container_name: remote_config_prometheus
profiles: [ "load-test" ]
ports:
- "9090:9090"
volumes:
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/etc/prometheus/console_libraries'
- '--web.console.templates=/etc/prometheus/consoles'
- '--web.enable-lifecycle'
- '--web.enable-remote-write-receiver'
networks:
- k6-net
grafana:
image: grafana/grafana:11.4.0
<<: *restart-policy
container_name: remote_config_grafana
profiles: [ "load-test" ]
ports:
- "3001:3000"
env_file:
- .env.grafana
volumes:
- grafana-storage:/var/lib/grafana
- ./grafana/dashboards:/etc/grafana/provisioning/dashboards
networks:
- k6-net
depends_on:
- prometheus
k6:
build:
context: ./k6
container_name: remote_config_k6
profiles: [ "load-test" ]
environment:
- K6_PROMETHEUS_RW_SERVER_URL=http://prometheus:9090/api/v1/write
- K6_PROMETHEUS_RW_TREND_STATS=p(95),p(99),min,max
- BASE_URL=http://backend-load-test:8080
# remove for grafana dashboard
- K6_WEB_DASHBOARD=true
- K6_WEB_DASHBOARD_EXPORT=/reports/load_test_report.html
volumes:
- ./docs:/reports
ports:
- "5665:5665"
networks:
- k6-net
depends_on:
backend-load-test:
condition: service_healthy
prometheus:
condition: service_started
volumes:
mongodb-data:
redis-data:
grafana-storage:
networks:
k6-net:
driver: bridge