-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
341 lines (244 loc) · 10.1 KB
/
Makefile
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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
NAP = 15
SLEEP = 60
THREADS = 2
DOCKER_COMPOSE_DEV_FILE = docker-compose-dev.yml
DOCKER_COMPOSE_DEV = docker compose -f $(DOCKER_COMPOSE_DEV_FILE)
DOCKER_TEST = docker exec -i anodot-agent pytest -x -vv --disable-pytest-warnings
DOCKER_TEST_PARALLEL = $(DOCKER_TEST) -n $(THREADS) --dist=loadfile
##---------
## RELEASE
##---------
all: build-all test-general test-pipelines-1 test-pipelines-2
build-all: get-streamsets-libs build-docker
test-all: test-general test-pipelines-1 test-pipelines-2
test-general: run-base-services run-unit-tests test-sdc-client test-flask-app test-streamsets run-general-test-services test-raw-input test-raw-pipelines test-destination test-run-test-pipeline test-apply test-api test-api-scripts test-export-sources test-streamsets-2 test-send-to-bc test-monitoring-metrics
test-pipelines-1: bootstrap-test-pipelines run-services-for-test-1
$(DOCKER_TEST_PARALLEL) tests/test_input/test_1
$(DOCKER_TEST_PARALLEL) tests/test_pipelines/test_1
test-pipelines-2: bootstrap-test-pipelines run-services-for-test-2
$(DOCKER_TEST_PARALLEL) tests/test_input/test_2
$(DOCKER_TEST_PARALLEL) tests/test_pipelines/test_2
bootstrap-test-pipelines: run-base-services test-streamsets test-destination
docker exec -i dc bash -c '$$SDC_DIST/bin/streamsets stagelib-cli jks-credentialstore add -i jks -n testmongopass -c root'
docker exec -i dc2 bash -c '$$SDC_DIST/bin/streamsets stagelib-cli jks-credentialstore add -i jks -n testmongopass -c root'
run-services-for-test-1: _run-services-for-test-1 half-sleep setup-victoria setup-kafka
_run-services-for-test-1:
docker compose up -d mongo zookeeper kafka influx influx-2 postgres victoriametrics
run-services-for-test-2: _run-services-for-test-2 sleep setup-elastic setup-zabbix
_run-services-for-test-2:
docker compose up -d mysql es zabbix-server zabbix-web zabbix-agent clickhouse snmpsim sage
run-base-services:
docker compose up -d agent dc dc2 squid dummy_destination
sleep 60
run-general-test-services: _run-general-test-services sleep setup-elastic setup-kafka
_run-general-test-services:
docker compose up -d es influx mongo sage mysql snmpsim kafka
##-------------
## DEVELOPMENT
##-------------
all-dev: clean-docker-volumes build-all-dev sleep test-all
build-all-dev: build-dev sleep setup-all
run-all-dev: clean-docker-volumes run-dev sleep setup-all
rerun: bootstrap
rerun-agent:
$(DOCKER_COMPOSE_DEV) restart agent
stop: clean-docker-volumes
##-----------------------
## TEST SEPARATE SOURCES
##-----------------------
test-directory: bootstrap
$(DOCKER_TEST) tests/test_input/test_1/test_directory_http.py
$(DOCKER_TEST) tests/test_pipelines/test_1/test_directory_http.py
test-prtg: bootstrap
$(DOCKER_TEST) tests/test_input/test_1/test_prtg.py
$(DOCKER_TEST) tests/test_pipelines/test_1/test_prtg.py
test-elastic: bootstrap run-elastic setup-elastic
$(DOCKER_TEST) tests/test_input/test_2/test_elastic_http.py
$(DOCKER_TEST) tests/test_pipelines/test_2/test_elastic_http.py
test-promql: bootstrap run-victoria
$(DOCKER_TEST) tests/test_input/test_1/test_promql_http.py
$(DOCKER_TEST) tests/test_pipelines/test_1/test_promql_http.py
test-influx: bootstrap run-influx run-influx-2 nap
$(DOCKER_TEST) tests/test_input/test_1/test_influx_http.py
$(DOCKER_TEST) tests/test_pipelines/test_1/test_influx_http.py
test-kafka: bootstrap run-kafka
$(DOCKER_TEST) tests/test_input/test_1/test_kafka_http.py
$(DOCKER_TEST) tests/test_pipelines/test_1/test_kafka_http.py
test-mongo: bootstrap run-mongo
docker exec -i dc bash -c '$$SDC_DIST/bin/streamsets stagelib-cli jks-credentialstore add -i jks -n testmongopass -c root'
$(DOCKER_TEST) tests/test_input/test_1/test_mongo_http.py
$(DOCKER_TEST) tests/test_pipelines/test_1/test_mongo_http.py
test-mysql: bootstrap run-mysql sleep
$(DOCKER_TEST) tests/test_input/test_2/test_mysql_http.py
$(DOCKER_TEST) tests/test_pipelines/test_2/test_mysql_http.py
test-postgres: bootstrap run-postgres sleep
$(DOCKER_TEST) tests/test_input/test_1/test_postgres_http.py
$(DOCKER_TEST) tests/test_pipelines/test_1/test_postgres_http.py
test-postgres-py: bootstrap run-postgres sleep
$(DOCKER_TEST) tests/test_input/test_1/test_postgres_py.py
$(DOCKER_TEST) tests/test_pipelines/test_1/test_postgres_py.py
test-clickhouse: bootstrap run-clickhouse sleep
$(DOCKER_TEST) tests/test_input/test_2/test_clickhouse.py
$(DOCKER_TEST) tests/test_pipelines/test_2/test_clickhouse.py
test-tcp: bootstrap
$(DOCKER_TEST) tests/test_input/test_1/test_tcp_http.py
$(DOCKER_TEST) tests/test_pipelines/test_1/test_tcp_http.py
test-sage: bootstrap run-sage
$(DOCKER_TEST) tests/test_input/test_2/test_sage_http.py
$(DOCKER_TEST) tests/test_pipelines/test_2/test_sage_http.py
test-zabbix: bootstrap run-zabbix
$(DOCKER_TEST) tests/test_input/test_2/test_zabbix_http.py
$(DOCKER_TEST) tests/test_pipelines/test_2/test_zabbix_http.py
test-cacti: bootstrap run-mysql half-sleep
$(DOCKER_TEST) tests/test_input/test_2/test_cacti.py
$(DOCKER_TEST) tests/test_pipelines/test_2/test_cacti.py
test-oracle: bootstrap
$(DOCKER_TEST) tests/test_input/test_2/test_oracle.py
test-observium: bootstrap run-mysql half-sleep
$(DOCKER_TEST) tests/test_input/test_2/test_observium.py
$(DOCKER_TEST) tests/test_pipelines/test_2/test_observium.py
test-mssql: bootstrap
docker exec -i dc bash -c '$$SDC_DIST/bin/streamsets stagelib-cli jks-credentialstore add -i jks -n testmssql -c UserTest123$$'
$(DOCKER_TEST) tests/test_input/test_1/test_mssql.py
test-databricks: bootstrap
$(DOCKER_TEST) tests/test_input/test_1/test_databricks.py
test-actian: bootstrap
$(DOCKER_TEST) tests/test_input/test_2/test_actian.py
test-snmp: bootstrap run-snmpsim
$(DOCKER_TEST) tests/test_input/test_2/test_snmp.py
$(DOCKER_TEST) tests/test_pipelines/test_2/test_snmp.py
##---------------------------
## RELEASE DEPENDENCY TARGETS
##---------------------------
build-docker:
docker compose down -v
docker compose build --build-arg GIT_SHA1="$(git describe --tags --dirty --always)"
run-all:
docker compose up -d
test-apply:
$(DOCKER_TEST) tests/test_apply.py
test-send-to-bc:
$(DOCKER_TEST) tests/test_send_to_bc.py
test-destination:
$(DOCKER_TEST) tests/test_destination.py
test-streamsets:
$(DOCKER_TEST) tests/test_streamsets.py
test-raw-input:
$(DOCKER_TEST_PARALLEL) tests/test_raw/test_input
test-raw-pipelines:
$(DOCKER_TEST_PARALLEL) tests/test_raw/test_pipelines
test-streamsets-2:
$(DOCKER_TEST) tests/test_streamsets_with_preferred_type.py
$(DOCKER_TEST) tests/test_streamsets_2.py
test-input:
$(DOCKER_TEST_PARALLEL) tests/test_input/
test-export-sources:
$(DOCKER_TEST_PARALLEL) tests/test_export_sources.py
test-run-test-pipeline:
$(DOCKER_TEST) tests/test_run_test_pipeline.py
test-monitoring-metrics:
$(DOCKER_TEST) tests/test_monitoring.py
test-api:
$(DOCKER_TEST) tests/api/test_destination.py
$(DOCKER_TEST) tests/api/test_streamsets.py
$(DOCKER_TEST) tests/api/source
$(DOCKER_TEST) tests/api/pipeline
test-api-scripts:
$(DOCKER_TEST) tests/api/test_scripts.py
test-flask-app:
$(DOCKER_TEST) tests/api/test_flask_app.py
test-sdc-client:
$(DOCKER_TEST) tests/test_sdc_client
run-unit-tests:
$(DOCKER_TEST_PARALLEL) tests/unit/
get-streamsets-libs: install-streamsets-requirements
rm -rf containers/streamsets/lib/anodot
curl -L https://github.com/anodot/anodot-sdc-stage/releases/download/v2.0.7/anodot-2.0.7.tar.gz -o /tmp/sdc.tar.gz && tar xvfz /tmp/sdc.tar.gz -C containers/streamsets/lib
install-streamsets-requirements:
rm -rf containers/streamsets/python-libs/*
pip install --upgrade pip && pip install --target containers/streamsets/python-libs -r containers/streamsets/python_requirements.txt
setup-all: setup-victoria setup-kafka setup-elastic setup-zabbix
##-----------------------
## DEV DEPENDENCY TARGETS
##-----------------------
build-dev:
$(DOCKER_COMPOSE_DEV) up -d --build
run-dev:
$(DOCKER_COMPOSE_DEV) up -d
bootstrap: clean-docker-volumes run-base-services-dev test-streamsets test-destination
clean-docker-volumes:
rm -rf sdc-data/*
rm -rf sdc-data2/*
rm -rf agent/output/*
$(DOCKER_COMPOSE_DEV) down -v --remove-orphans
run-base-services-dev: _run-base-services-dev sleep
_run-base-services-dev:
$(DOCKER_COMPOSE_DEV) up -d agent dc squid dummy_destination
#docker exec -i anodot-agent python setup.py develop
build-base-services: clean-docker-volumes _build-base-services nap
_build-base-services:
$(DOCKER_COMPOSE_DEV) up -d --build agent dc squid dummy_destination
docker exec -i anodot-agent python setup.py develop
run-dc2:
$(DOCKER_COMPOSE_DEV) up -d dc2
run-elastic: _run-elastic sleep setup-elastic
_run-elastic:
$(DOCKER_COMPOSE_DEV) up -d es
run-influx:
$(DOCKER_COMPOSE_DEV) up -d influx
run-influx-2:
$(DOCKER_COMPOSE_DEV) up -d influx-2
run-snmpsim:
$(DOCKER_COMPOSE_DEV) up -d snmpsim
run-victoria: _run-victoria nap setup-victoria
_run-victoria:
$(DOCKER_COMPOSE_DEV) up -d victoriametrics
run-kafka: run-zookeeper _run-kafka setup-kafka
_run-kafka:
$(DOCKER_COMPOSE_DEV) up -d kafka
sleep 15
run-zookeeper:
$(DOCKER_COMPOSE_DEV) up -d zookeeper
run-mongo:
$(DOCKER_COMPOSE_DEV) up -d mongo
run-cacti: run-mysql
run-mysql:
$(DOCKER_COMPOSE_DEV) up -d mysql
run-observium: run-mysql
run-postgres:
$(DOCKER_COMPOSE_DEV) up -d postgres
run-clickhouse:
$(DOCKER_COMPOSE_DEV) up -d clickhouse
run-sage:
$(DOCKER_COMPOSE_DEV) up -d --build sage
run-zabbix: _run-zabbix sleep setup-zabbix
_run-zabbix:
$(DOCKER_COMPOSE_DEV) up -d mysql zabbix-server zabbix-web zabbix-agent
##--------------------------
## COMMON DEPENDENCY TARGETS
##--------------------------
setup-kafka:
./scripts/upload-test-data-to-kafka.sh
setup-elastic:
sleep 30
./scripts/upload-test-data-to-elastic.sh
setup-victoria:
./scripts/upload-test-data-to-victoria.sh
setup-zabbix:
docker cp ./scripts/upload-test-data-to-zabbix.py anodot-agent:/tmp/
docker exec anodot-agent python /tmp/upload-test-data-to-zabbix.py
setup-pre-commit:
pip install pre-commit
pre-commit install
sleep:
sleep $(SLEEP)
half-sleep:
sleep 30
nap:
sleep $(NAP)
show-all-logs:
docker logs anodot-agent;
echo "DC logs "; docker logs dc;
echo "DC 2 logs"; docker logs dc2;
echo "Dummy logs"; docker logs dummy_destination;
echo "Agent logs"; docker exec -i anodot-agent cat /var/log/agent/agent.log;