This repository was archived by the owner on Feb 7, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
80 lines (65 loc) · 2.36 KB
/
Makefile
File metadata and controls
80 lines (65 loc) · 2.36 KB
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
SHELL = /bin/bash
COMPOSE_DEMO= vmc-demo/compose
DEV_COMPOSE = compose
VENV_PATH = venv
define compose-file-demo
-f $(COMPOSE_DEMO)/docker-compose.$(1).yml
endef
define compose-file
-f $(DEV_COMPOSE)/docker-compose.$(1).yml
endef
VMC_BASE = $(call compose-file-demo,postgresql) $(call compose-file-demo,elk) $(call compose-file-demo,vmc) $(call compose-file,vmc-dev) $(call compose-file-demo,ralph)
VMC = $(VMC_BASE) $(call compose-file-demo,hive) $(call compose-file-demo,elastalert) $(call compose-file-demo,ralph)
all:
@cat README.md
build:
@echo "Starting to build vmc"
docker build -t vmc_dev -f Dockerfile.vmc-dev .
test:
ifdef tox
cd vmc && tox
endif
ifdef module
source $(VENV_PATH)/bin/activate && export ELASTICSEARCH_URL='127.0.0.1:9200' && cd vmc/src/ && python3 -m vmc test $(module) --settings vmc.config.test_settings -v 2 |grep -v "python3.9/site-packages/elasticsearch_dsl*"
else ifdef all
source $(VENV_PATH)/bin/activate && export ELASTICSEARCH_URL='127.0.0.1:9200' && cd vmc/src/ && python3 -m vmc test --settings vmc.config.test_settings -v 2
else
source $(VENV_PATH)/bin/activate && cd vmc/src/ && python3 -m vmc test --settings vmc.config.test_settings -v 2
endif
up:
#sudo sysctl -w vm.max_map_count=262144
docker compose --env-file vmc-demo/.env $(VMC) config
ifdef elastic
docker compose --env-file vmc-demo/.env $(call compose-file-demo,elk) up
endif
ifdef all
sudo sysctl -w vm.max_map_count=262144
docker compose --env-file vmc-demo/.env $(VMC) up
else
docker compose --env-file vmc-demo/.env $(VMC_BASE) up
endif
prepare-dev:
rm -rf env
virtualenv $(VENV_PATH)
source $(VENV_PATH)/bin/activate && pip3 install -r vmc/requirements.txt -r vmc/test_requirements.txt
migrations:
source $(VENV_PATH)/bin/activate && cd vmc/src/ && python3 -m vmc makemigrations --settings vmc.config.test_settings
demodata:
@chmod +x vmc-demo/config/demo_data.sh
@vmc-demo/config/demo_data.sh
down:
docker compose --env-file vmc-demo/.env $(VMC) down
clean-images:
@echo "Deleting all containers"
docker rm -f `docker ps -a -q` 2>/dev/null; true
@echo "Deleting all images"
docker rmi -f `docker images -q` 2>/dev/null; true
clean-volumes:
@echo "Deleting all volumes"
echo "y" | docker volume prune
clean: clean-images clean-volumes
@echo "Deleting all networks"
echo "y" | docker network prune
@echo "Cleaning the rest"
echo "y" | docker system prune
.PHONY: all