-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
84 lines (67 loc) · 2.63 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
.PHONY: max_map_count
max_map_count:
sudo sysctl -w vm.max_map_count=262144
ELASTIC_MMC :=
ifneq ($(shell cat /proc/sys/vm/max_map_count),262144)
ELASTIC_MMC := max_map_count
endif
PROTO_DIRS :=
ifeq ($(wildcard elasticsearch_data),)
PROTO_DIRS = proto_dirs
endif
PROTO_DIRS_TEST := proto_dirs-test
.PHONY: check_bin
check_bin:
ifeq (,$(shell which podman))
$(error "podman seems to not be installed")
endif
ifeq (,$(shell which podman-compose))
$(error "podman-compose seems to not be installed")
endif
ifneq (4,$(shell podman --version | awk '{print $$3}' | head -c 1))
$(error "podman version is not 4 or more")
endif
.PHONY: proto_dirs
proto_dirs:
sudo mkdir -pv elasticsearch_data elasticsearch_logs kafka_logs postgres_data setup_data
sudo chown -R 1000:0 elasticsearch_data elasticsearch_logs postgres_data setup_data
.PHONY: proto_dirs-test
proto_dirs-test:
sudo mkdir -pv nginx_data
sudo chown -R 1000:0 nginx_data
.PHONY: ps
ps: check_bin
sudo podman ps -a
.PHONY: up
up: check_bin $(ELASTIC_MMC) $(PROTO_DIRS)
(sudo podman-compose -p proto -f docker-compose.yml up 2>&1 1>>logs &)
.PHONY: down
down: check_bin
sudo podman-compose -p proto -f docker-compose.yml down
.PHONY: clean_podman
clean_podman: check_bin down
sudo podman rmi localhost/proto_es01 localhost/proto_logstash localhost/proto_kafka1 localhost/proto_zoo1 localhost/proto_kafdrop localhost/proto_gui localhost/proto_postgres
.PHONY: clean
clean: clean_podman check_bin down
sudo rm -rvf logs
sudo rm -rvf elasticsearch_data elasticsearch_logs kafka_logs postgres_data setup_data
.PHONY: up-test
up-test: check_bin $(ELASTIC_MMC) $(PROTO_DIRS_TEST)
(sudo podman-compose -p proto -f docker-compose-test.yml up 2>&1 1>>logs &)
.PHONY: down-test
down-test: check_bin
sudo podman-compose -p proto -f docker-compose-test.yml down
.PHONY: clean_podman-test
clean_podman-test: check_bin down-test
sudo podman rmi localhost/proto_nginx
.PHONY: clean-test
clean-test: clean_podman-test check_bin down-test
sudo rm -rvf nginx_data
.PHONY: tests_logs
tests_logs: check_bin
sudo podman build -t proto_tests -f tests/Dockerfile tests/
sudo podman run --rm --name=proto_tests_logs -v $(shell pwd)/tests/example_logs:/logs:Z,ro -v $(shell pwd)/tests/entrypoint_tests_logs.sh:/entrypoint.sh:Z,ro --net proto_proto --network-alias tests-logs proto_tests
.PHONY: tests_idmefv2
tests_idmefv2: check_bin
sudo podman build -t proto_tests -f tests/Dockerfile tests/
sudo podman run --rm --name=proto_tests_idmefv2 -v $(shell pwd)/tests/example_idmefv2:/idmefv2:Z,ro -v $(shell pwd)/tests/entrypoint_tests_idmefv2.py:/entrypoint.sh:Z,ro --net proto_proto --network-alias tests-idmefv2 proto_tests