-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
57 lines (45 loc) · 1.75 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
clean:
black .
isort --profile=black .
elastic:
git submodule update --recursive --remote
docker compose -f compose-recipes/elastic/compose.yml up -d
@echo it will take a bit for elasticsearch to be ready
test-stdout:
LOG_LEVEL=info NED_AMOUNT_RECORDS=1 poetry run ned --type=netflow
test-elastic:
LOG_LEVEL=info NED_AMOUNT_RECORDS=100 NED_AMOUNT_RECORDS_ANOMALOUS=5 poetry run ned --type netflow --to-elastic
build:
docker build -t ned:dev .
test-docker: build
docker run -it -e LOG_LEVEL=critical -e NED_AMOUNT_RECORDS=1 ned:dev --type netflow
test-docker-elastic:
docker run -it -e LOG_LEVEL=info -e ES_HOST=host.docker.internal -e NED_AMOUNT_RECORDS=1 ned:dev --type netflow --to-elastic
test-compose-elastic:
docker compose -f deployment/docker-compose.yml -f deployment/dev.yml up
deployment: config-bootstrap
docker compose -f deployment/docker-compose.yml -f deployment/prod.yml up -d
deployment-linux:
docker compose -f deployment/docker-compose.yml -f deployment/prod.yml -f deployment/linux.yml up -d
config-bootstrap:
@if $(MAKE) -s confirm ; then \
cp deployment/config-defaults.env deployment/config.env ; \
nano deployment/config.env ; \
fi
# The CI environment variable can be set to a non-empty string,
# it'll bypass this command that will "return true", as a "yes" answer.
confirm:
@if [[ -z "$(CI)" ]]; then \
REPLY="" ; \
read -p "⚠ This will erase the content of deployment/config.env. Are you sure? [y/n] > " -r ; \
if [[ ! $$REPLY =~ ^[Yy]$$ ]]; then \
printf $(_ERROR) "KO" "Stopping" ; \
exit 1 ; \
else \
printf $(_TITLE) "OK" "Continuing" ; \
exit 0; \
fi \
fi
.PHONY: confirm
_TITLE := "\033[32m[%s]\033[0m %s\n" # Green text for "printf"
_ERROR := "\033[31m[%s]\033[0m %s\n" # Red text for "printf"