-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·80 lines (56 loc) · 2.47 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
DC_EXEC := docker-compose
DC_DIR := deployments
DC_APP := docker-compose.yaml
DC_APP_DEV := docker-compose-dev.yaml
DC_APP_TEST := docker-compose-test.yaml
export DOCKER_BUILDKIT := false
export COMPOSE_DOCKER_CLI_BUILD := false
dev-up:
$(DC_EXEC) -f $(DC_DIR)/$(DC_APP_DEV) up -d --remove-orphans --build backend db-fapi-blog jaeger-all-in-one zipkin-all-in-one
$(DC_EXEC) -f $(DC_DIR)/$(DC_APP_DEV) up -d --remove-orphans --build frontend otel-collector
$(DC_EXEC) -f $(DC_DIR)/$(DC_APP_DEV) logs -f
dev-down:
$(DC_EXEC) -f $(DC_DIR)/$(DC_APP_DEV) down
dev-db-kill:
$(DC_EXEC) -f $(DC_DIR)/$(DC_APP_DEV) kill db-fapi-blog
dev-backend-kill:
$(DC_EXEC) -f $(DC_DIR)/$(DC_APP_DEV) kill backend
dev-db-start:
$(DC_EXEC) -f $(DC_DIR)/$(DC_APP_DEV) up --remove-orphans -d db-fapi-blog
dev-logs:
$(DC_EXEC) -f $(DC_DIR)/$(DC_APP) logs -f
backend-up: clean db-up
$(DC_EXEC) -f $(DC_DIR)/$(DC_APP_DEV) up --remove-orphans -d backend jaeger-all-in-one zipkin-all-in-one otel-collector
$(DC_EXEC) -f $(DC_DIR)/$(DC_APP_DEV) logs -f
clean:
docker system prune -f
docker volume prune -f
db-up:
$(DC_EXEC) -f $(DC_DIR)/$(DC_APP) up --remove-orphans -d db-fapi-blog
down:
$(DC_EXEC) -f $(DC_DIR)/$(DC_APP) down --remove-orphans
migrate: test-commons test-db-up
sleep 3
cd backend && PYTHONPATH=$${PWD} alembic upgrade head
cd backend && PYTHONPATH=$${PWD} alembic revision --autogenerate
pre-commit:
cd backend && \
poetry run pre-commit run -a --show-diff-on-failure
test-populate:
opentelemetry-instrument backend/tests/populate_posts.py
test-db-up:
$(DC_EXEC) -f $(DC_DIR)/$(DC_APP_TEST) up --remove-orphans -d db-test
test-down:
$(DC_EXEC) -f $(DC_DIR)/$(DC_APP_TEST) down --remove-orphans -v
test-app: test-down test-db-up
$(DC_EXEC) -f $(DC_DIR)/$(DC_APP_TEST) run -w /opt/blog/backend --entrypoint "poetry run coverage run -m pytest -vv" backend
$(DC_EXEC) -f $(DC_DIR)/$(DC_APP_TEST) run -w /opt/blog/backend --entrypoint "poetry run coverage report" backend
$(DC_EXEC) -f $(DC_DIR)/$(DC_APP_TEST) run -w /opt/blog/backend --entrypoint "poetry run coverage xml" backend
$(DC_EXEC) -f $(DC_DIR)/$(DC_APP_TEST) run -w /opt/blog/backend --entrypoint "poetry run coverage html" backend
test-local: test-down clean test-db-up
sleep 3
cd backend && poetry run coverage run -m pytest -vv
cd backend && poetry run coverage report
cd backend && poetry run coverage xml
cd backend && poetry run coverage html
# $(DC_EXEC) -f $(DC_DIR)/$(DC_APP_TEST) down --remove-orphans -v --rmi local