-
Notifications
You must be signed in to change notification settings - Fork 627
/
Copy pathMakefile
49 lines (39 loc) · 1.51 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
SHELL := /bin/bash
test:
go build -o /dev/null kafka.go
setup: stack status wait_for_kibana load_kibana_dashboard
clean:
@docker-compose down --volumes
run:
go run kafka.go
stack:
@docker-compose up --detach
status:
@{ \
cols=`tput cols`; max=98; i=1; \
while [[ "$$i" -lt "$$cols" && "$$i" -lt "$$max" ]]; do printf '-'; let i=$$i+1; done; printf "\n"; \
docker-compose ps; \
i=1; while [[ "$$i" -lt "$$cols" && "$$i" -lt "$$max" ]]; do printf '-'; let i=$$i+1; done; printf "\n"; \
}
wait_for_kibana:
@{ \
printf "Waiting for Kibana..."; \
until docker inspect kibana > /dev/null 2>&1 && [[ `docker inspect -f '{{ .State.Health.Status }}' kibana` == "healthy" ]]; do printf '.'; sleep 5; done; \
printf "\nOpen dashboard at <http://localhost:5601/app/kibana#/dashboard/140b5490-5fce-11ea-a238-bf5970186390>\n"; \
}
load_kibana_dashboard:
@{ \
curl -s -S -X POST -H 'kbn-xsrf: true' 'http://localhost:5601/api/saved_objects/_import?overwrite=true' --form file=@etc/kibana-objects.ndjson > /dev/null; \
}
save_kibana_dashboard:
@{ \
curl -s -S -X POST -H 'Content-Type: application/json' -H 'kbn-xsrf: true' -o './etc/kibana-objects.ndjson' 'http://localhost:5601/api/saved_objects/_export' -d ' \
{ \
"objects": [ \
{ "type": "index-pattern", "id": "stocks-index-pattern" }, \
{ "type": "dashboard", "id": "140b5490-5fce-11ea-a238-bf5970186390" } \
], \
"includeReferencesDeep": true \
}'; \
}
.PHONY: test setup run clean stack status wait_for_kibana load_kibana_dashboard save_kibana_dashboard