-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathMakefile
126 lines (85 loc) · 3.64 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
SHELL = /bin/bash
.DEFAULT_GOAL := help
# Use `config.yaml` by default, unless overridden by user
# through setting FLAGS environment variable
FLAGS:=$(if $(FLAGS),$(FLAGS),)
PYTHON=PYTHONPATH=. python
SUPERVISORD_CFG=conf/supervisord.conf
SUPERVISORD_API_CFG=conf/supervisord_api.conf
SUPERVISORD_INGESTER_CFG=conf/supervisord_ingester.conf
SUPERVISORD=$(PYTHON) -m supervisor.supervisord -n -c $(SUPERVISORD_CFG)
SUPERVISORD_API=$(PYTHON) -m supervisor.supervisord -n -c $(SUPERVISORD_API_CFG)
SUPERVISORD_INGESTER=$(PYTHON) -m supervisor.supervisord -n -c $(SUPERVISORD_INGESTER_CFG)
SUPERVISORCTL=$(PYTHON) -m supervisor.supervisorctl -c $(SUPERVISORD_CFG)
SUPERVISORCTL_API=$(PYTHON) -m supervisor.supervisorctl -c $(SUPERVISORD_API_CFG)
SUPERVISORCTL_INGESTER=$(PYTHON) -m supervisor.supervisorctl -c $(SUPERVISORD_INGESTER_CFG)
# SYSTEM DEPENDENCIES
system_dependencies:
$(PYTHON) kowalski/tools/check_app_environment.py
# check if pkg_resources is installed and if not then install it
check_python_packaging:
uv pip freeze | grep -q 'packaging' || uv pip install packaging setuptools
# DEPENDENCIES
python_dependencies: check_python_packaging
$(PYTHON) kowalski/tools/install_python_requirements.py requirements/requirements.txt
python_dependencies_api: check_python_packaging
$(PYTHON) kowalski/tools/install_python_requirements.py requirements/requirements_api.txt
python_dependencies_ingester: check_python_packaging
$(PYTHON) kowalski/tools/install_python_requirements.py requirements/requirements_ingester.txt
python_dependencies_test: check_python_packaging
$(PYTHON) kowalski/tools/install_python_requirements.py requirements/requirements_test.txt
# SUPERVISORD
generate_supervisord_conf:
$(PYTHON) kowalski/tools/generate_supervisord_conf.py all
generate_supervisord_api_conf:
$(PYTHON) kowalski/tools/generate_supervisord_conf.py api
generate_supervisord_ingester_conf:
$(PYTHON) kowalski/tools/generate_supervisord_conf.py ingester
# SETUP
setup: system_dependencies python_dependencies
setup_api: system_dependencies python_dependencies_api generate_supervisord_api_conf
setup_ingester: system_dependencies python_dependencies_ingester generate_supervisord_ingester_conf
setup_all: setup python_dependencies_api python_dependencies_ingester generate_supervisord_conf
init_models:
$(PYTHON) kowalski/tools/init_models.py
init_kafka:
$(PYTHON) kowalski/tools/init_kafka.py
run: setup_all init_models init_kafka
$(SUPERVISORD)
run_api: setup_api
$(SUPERVISORD_API)
run_ingester: setup_ingester init_models init_kafka
$(SUPERVISORD_INGESTER)
monitor:
$(SUPERVISORCTL) -i
monitor_api:
$(SUPERVISORCTL_API) -i
monitor_ingester:
$(SUPERVISORCTL_INGESTER) -i
test: setup_all python_dependencies_test init_models init_kafka
$(PYTHON) kowalski/tools/tests.py
docker_setup: setup
$(PYTHON) kowalski/tools/docker.py setup $(FLAGS)
docker_up: docker_setup
$(PYTHON) kowalski/tools/docker.py up $(FLAGS)
docker_down: docker_setup
$(PYTHON) kowalski/tools/docker.py down $(FLAGS)
docker_build: docker_setup
$(PYTHON) kowalski/tools/docker.py build $(FLAGS)
docker_test: docker_setup
$(PYTHON) kowalski/tools/tests.py --use_docker
docker_seed : docker_setup
$(PYTHON) kowalski/tools/docker.py seed $(FLAGS)
log: ## Monitor log files for all services.
log: setup
$(PYTHON) kowalski/tools/watch_logs.py
stop: ## Stop all services in supervisord.
stop: setup
$(SUPERVISORCTL) stop all
stop_ingester: ## Stop all services in supervisord.
stop_ingester: setup
$(SUPERVISORCTL_INGESTER) stop all
stop_api: ## Stop all services in supervisord.
stop_api: setup
$(SUPERVISORCTL_API) stop all
dev_container: setup_all python_dependencies_test init_models init_kafka