-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
50 lines (38 loc) · 1.05 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
etc_dir := /usr/local/etc/haproxy
socat_cmd = echo '$(1)' | socat /tmp/api.sock -;
docker_exec = docker exec -i haproxy bash -c $(1)
while_exec = $(call docker_exec,"while true; do $(2) sleep $(1); done")
maps_cmd = echo \
"$(call socat_cmd,show map)" \
"$(call socat_cmd,show map $(etc_dir)/maps/config.map)" \
"$(call socat_cmd,show map $(etc_dir)/maps/rates-by-url.map)" \
"$(call socat_cmd,show map $(etc_dir)/maps/rates-by-ip.map)"
tables_cmd = echo \
"$(call socat_cmd,show table st_global)" \
"$(call socat_cmd,show table st_paths)"
.PHONY: all
all: up
.PHONY: up
up:
docker-compose up -d
.PHONY: down
down:
docker-compose down -v
.PHONY: logs
logs:
docker-compose logs -f
.PHONY: clean
clean:
docker-compose down -v || true
.PHONY: show-maps
show-maps:
$(maps_cmd) | $(call docker_exec,"$$(cat -)")
.PHONY: show-tables
show-tables:
$(tables_cmd) | $(call docker_exec,"$$(cat -)")
.PHONY: watch-maps
watch-maps:
$(maps_cmd) | $(call while_exec,1,$$(cat -))
.PHONY: watch-tables
watch-tables:
$(tables_cmd) | $(call while_exec,1,$$(cat -))