-
Notifications
You must be signed in to change notification settings - Fork 0
/
compose.yaml
226 lines (218 loc) · 7.1 KB
/
compose.yaml
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
services:
web-server:
build:
context: .
target: app
args:
APP: ${WEBSERVER_HOST}
image: tyknkd/newsanalyzer-webserver:${PROJECT_VERSION}
container_name: ${WEBSERVER_HOST}
environment:
ANALYZER_EXCHANGE: ${ANALYZER_EXCHANGE}
ANALYZER_HOST: ${ANALYZER_HOST}
ANALYZER_QUEUE: ${ANALYZER_QUEUE}
ANALYZER_ROUTING_KEY: ${ANALYZER_ROUTING_KEY}
COLLECTOR_HOST: ${COLLECTOR_HOST}
POSTGRES_HOST: ${POSTGRES_HOST}
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
POSTGRES_PORT: ${POSTGRES_PORT}
POSTGRES_USER: ${POSTGRES_USER}
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_DEFAULT_PASS}
RABBITMQ_DEFAULT_USER: ${RABBITMQ_DEFAULT_USER}
RABBITMQ_HOST: ${RABBITMQ_HOST}
RABBITMQ_PORT: ${RABBITMQ_PORT}
WEBSERVER_DB: ${WEBSERVER_DB}
WEBSERVER_HOST: ${WEBSERVER_HOST}
secrets:
- postgres_password
ports:
- ${WEBSERVER_PORT}:${WEBSERVER_PORT}
depends_on:
db:
condition: service_healthy
mq:
condition: service_healthy
data-analyzer:
build:
context: .
target: spark-app
args:
APP: ${ANALYZER_HOST}
image: tyknkd/newsanalyzer-dataanalyzer:${PROJECT_VERSION}
container_name: ${ANALYZER_HOST}
environment:
ANALYZER_DB: ${ANALYZER_DB}
ANALYZER_EXCHANGE: ${ANALYZER_EXCHANGE}
ANALYZER_HOST: ${ANALYZER_HOST}
ANALYZER_QUEUE: ${ANALYZER_QUEUE}
ANALYZER_ROUTING_KEY: ${ANALYZER_ROUTING_KEY}
COLLECTOR_EXCHANGE: ${COLLECTOR_EXCHANGE}
COLLECTOR_HOST: ${COLLECTOR_HOST}
COLLECTOR_QUEUE: ${COLLECTOR_QUEUE}
COLLECTOR_ROUTING_KEY: ${COLLECTOR_ROUTING_KEY}
POSTGRES_HOST: ${POSTGRES_HOST}
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
POSTGRES_PORT: ${POSTGRES_PORT}
POSTGRES_USER: ${POSTGRES_USER}
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_DEFAULT_PASS}
RABBITMQ_DEFAULT_USER: ${RABBITMQ_DEFAULT_USER}
RABBITMQ_HOST: ${RABBITMQ_HOST}
RABBITMQ_PORT: ${RABBITMQ_PORT}
WEBSERVER_HOST: ${WEBSERVER_HOST}
secrets:
- postgres_password
ports:
- ${ANALYZER_PORT}:${ANALYZER_PORT}
depends_on:
- db
- web-server
data-collector:
build:
context: .
target: app
args:
APP: ${COLLECTOR_HOST}
image: tyknkd/newsanalyzer-datacollector:${PROJECT_VERSION}
container_name: ${COLLECTOR_HOST}
environment:
ANALYZER_HOST: ${ANALYZER_HOST}
COLLECTOR_DB: ${COLLECTOR_DB}
COLLECTOR_EXCHANGE: ${COLLECTOR_EXCHANGE}
COLLECTOR_HOST: ${COLLECTOR_HOST}
COLLECTOR_QUEUE: ${COLLECTOR_QUEUE}
COLLECTOR_ROUTING_KEY: ${COLLECTOR_ROUTING_KEY}
NEWS_API_KEY_FILE: /run/secrets/news_api_key
POSTGRES_HOST: ${POSTGRES_HOST}
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
POSTGRES_PORT: ${POSTGRES_PORT}
POSTGRES_USER: ${POSTGRES_USER}
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_DEFAULT_PASS}
RABBITMQ_DEFAULT_USER: ${RABBITMQ_DEFAULT_USER}
RABBITMQ_HOST: ${RABBITMQ_HOST}
RABBITMQ_PORT: ${RABBITMQ_PORT}
WEBSERVER_HOST: ${WEBSERVER_HOST}
secrets:
- postgres_password
- news_api_key
ports:
- ${COLLECTOR_PORT}:${COLLECTOR_PORT}
depends_on:
- db
- data-analyzer
db:
image: postgres:16.2-alpine
container_name: ${POSTGRES_HOST}
environment:
ADDITIONAL_POSTGRES_DB: ${ADDITIONAL_POSTGRES_DB}
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_HOST: ""
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
POSTGRES_USER: ${POSTGRES_USER}
secrets:
- postgres_password
ports:
- ${POSTGRES_PORT}:${POSTGRES_PORT}
volumes:
- ./docker-databases/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
- ./.docker-data/.pg-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -d ${POSTGRES_DB} -U ${POSTGRES_USER}"]
interval: 10s
timeout: 5s
retries: 5
mq:
image: rabbitmq:3.13-management
container_name: ${RABBITMQ_HOST}
environment:
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_DEFAULT_PASS}
RABBITMQ_DEFAULT_USER: ${RABBITMQ_DEFAULT_USER}
RABBITMQ_LOGS: "-"
ports:
- ${RABBITMQ_PORT}:${RABBITMQ_PORT}
- ${RABBITMQ_METRICS_PORT}:${RABBITMQ_METRICS_PORT}
volumes:
- ./rabbitmq/enabled-plugins:/etc/rabbitmq/enabled_plugins
- ./.docker-data/.rabbit-data/.rabbit-lib:/var/lib/rabbitmq
healthcheck:
test: rabbitmq-diagnostics check_port_connectivity
interval: 10s
timeout: 5s
retries: 5
prometheus:
image: prom/prometheus:v2.51.2
container_name: prometheus
user: root
restart: unless-stopped
ports:
- ${PROMETHEUS_PORT}:${PROMETHEUS_PORT}
volumes:
- ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml
- ./.docker-data/.prometheus-data:/prometheus
depends_on:
- web-server
grafana:
image: grafana/grafana-oss:10.4.2
container_name: grafana
restart: unless-stopped
environment:
GF_FEATURE_TOGGLES_ENABLE: 'publicDashboards'
GF_SECURITY_ADMIN_PASSWORD__FILE: /run/secrets/grafana_password
secrets:
- grafana_password
user: root
ports:
- ${GRAFANA_PORT}:${GRAFANA_PORT}
volumes:
- ./monitoring/dashboard.json:/var/lib/grafana/dashboards/dashboard.json
- ./monitoring/datasources.yaml:/etc/grafana/provisioning/datasources/datasources.yaml
- ./monitoring/providers.yaml:/etc/grafana/provisioning/dashboards/providers.yaml
- ./.docker-data/.grafana-data:/var/lib/grafana
depends_on:
- prometheus
test:
build:
context: .
target: gradle-test
environment:
ANALYZER_EXCHANGE: ${ANALYZER_EXCHANGE}
ANALYZER_HOST: ${ANALYZER_HOST}
ANALYZER_PORT: ${ANALYZER_PORT}
ANALYZER_QUEUE: ${ANALYZER_QUEUE}
ANALYZER_ROUTING_KEY: ${ANALYZER_ROUTING_KEY}
ANALYZER_TEST_DB: ${ANALYZER_TEST_DB}
COLLECTOR_EXCHANGE: ${COLLECTOR_EXCHANGE}
COLLECTOR_HOST: ${COLLECTOR_HOST}
COLLECTOR_PORT: ${COLLECTOR_PORT}
COLLECTOR_QUEUE: ${COLLECTOR_QUEUE}
COLLECTOR_ROUTING_KEY: ${COLLECTOR_ROUTING_KEY}
COLLECTOR_TEST_DB: ${COLLECTOR_TEST_DB}
DATA_SUPPORT_TEST_DB: ${DATA_SUPPORT_TEST_DB}
NEWS_API_KEY_FILE: /run/secrets/news_api_key
POSTGRES_HOST: ${POSTGRES_HOST}
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
POSTGRES_PORT: ${POSTGRES_PORT}
POSTGRES_USER: ${POSTGRES_USER}
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_DEFAULT_PASS}
RABBITMQ_DEFAULT_USER: ${RABBITMQ_DEFAULT_USER}
RABBITMQ_HOST: ${RABBITMQ_HOST}
RABBITMQ_PORT: ${RABBITMQ_PORT}
WEBSERVER_HOST: ${WEBSERVER_HOST}
WEBSERVER_PORT: ${WEBSERVER_PORT}
WEBSERVER_TEST_DB: ${WEBSERVER_TEST_DB}
secrets:
- postgres_password
- news_api_key
profiles:
- test
depends_on:
db:
condition: service_healthy
mq:
condition: service_healthy
secrets:
postgres_password:
environment: "POSTGRES_PASSWORD"
news_api_key:
environment: "NEWS_API_KEY"
grafana_password:
environment: "GRAFANA_PASSWORD"