Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
99 lines (82 loc) · 3.57 KB
/
Copy pathMakefile
File metadata and controls
99 lines (82 loc) · 3.57 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
.PHONY: clean-test clean-pyc restart test test-verbose restart-service_name* setup docs
.DEFAULT_GOAL := help
define PRINT_HELP_PYSCRIPT
import re, sys
for line in sys.stdin:
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
print("%-20s %s" % (target, help))
endef
export PRINT_HELP_PYSCRIPT
UNAME_S := $(shell uname -m)
DOCKER_ENV :=
ifeq ($(UNAME_S),arm64)
DOCKER_ENV = DOCKER_DEFAULT_PLATFORM=linux/amd64
endif
help:
@python3 -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
clean-pyc: ## clean python cache files
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +
find . -name '.pytest_cache' -exec rm -fr {} +
clean-test: ## cleanup pytests leftovers
rm -f .coverage
rm -fr htmlcov/
rm -fr test_results/
rm -f *report.html
rm -f log.html
rm -f test-results.html
rm -f output.xml
uv-cache:
docker volume inspect uv_cache >/dev/null 2>&1 || docker volume create uv_cache
docker-dev-restart: ## restart containers
$(DOCKER_ENV) docker compose -f 'docker-compose-dev.yml' down
$(DOCKER_ENV) docker compose -f 'docker-compose-dev.yml' up -d --build
docker-restart: uv-cache## restart containers
$(DOCKER_ENV) docker compose -f 'docker-compose.yml' down
$(DOCKER_ENV) docker compose -f 'docker-compose.yml' up -d --build
test: restart ## restart containers & test
uv run pytest
test-verbose: restart ## restart containers & test
uv run pytest -s
restart-%: ## Restart a docker service by name, eg make restart-api_public
uv sync --project projects/$*
$(DOCKER_ENV) docker compose stop $*
$(DOCKER_ENV) docker compose build $*
$(DOCKER_ENV) docker compose up -d $*
smoke-firehose: ## run the firehose container smoke test (real kafka + real websockets)
$(DOCKER_ENV) docker compose -f docker-compose.yml -f docker-compose-smoke.yml \
--profile smoke up -d --build kafka kafka_setup mysql mysql_setup firehose
$(DOCKER_ENV) docker compose -f docker-compose.yml -f docker-compose-smoke.yml \
--profile smoke run --build --rm firehose_smoke; \
status=$$?; \
$(DOCKER_ENV) docker compose -f docker-compose.yml -f docker-compose-smoke.yml \
--profile smoke down --volumes; \
exit $$status
smoke-firehose-hunt: ## run the F2 starvation hunt against the real stack
$(DOCKER_ENV) docker compose -f docker-compose.yml -f docker-compose-smoke.yml \
--profile smoke up -d --build kafka kafka_setup mysql mysql_setup firehose
$(DOCKER_ENV) docker compose -f docker-compose.yml -f docker-compose-smoke.yml \
--profile smoke run --build --rm -e SMOKE_MODE=hunt firehose_smoke; \
status=$$?; \
$(DOCKER_ENV) docker compose -f docker-compose.yml -f docker-compose-smoke.yml \
--profile smoke down --volumes; \
exit $$status
smoke-firehose-resilience: ## bounce kafka + restart firehose mid-stream (real aiokafka reconnect)
$(DOCKER_ENV) docker compose -f docker-compose.yml -f docker-compose-smoke.yml \
--profile smoke up -d --build kafka kafka_setup mysql mysql_setup firehose
$(DOCKER_ENV) docker compose -f docker-compose.yml -f docker-compose-smoke.yml \
--profile smoke run --build --rm -e SMOKE_MODE=resilience firehose_smoke; \
status=$$?; \
$(DOCKER_ENV) docker compose -f docker-compose.yml -f docker-compose-smoke.yml \
--profile smoke down --volumes; \
exit $$status
setup:
uv sync
docs: ## opens your browser to the webapps testing docs
open http://localhost:5000/docs
xdg-open http://localhost:5000/docs
. http://localhost:5000/docs