Makefile 1.69 KB
Newer Older
Nelso Jost's avatar
Nelso Jost committed
1
PY := python3
2
VENV := .venv
Nelso Jost's avatar
Nelso Jost committed
3

4
5
6
all: help

help:
Nelso Jost's avatar
Nelso Jost committed
7
	@ echo "USAGE:"
8
	@ echo ""
9
10
11
12
13
14
15
16
17
18
	@ echo "    make deb-install -- Uses apt to install required system tools"
	@ echo "                        (for Debian-based systems only)"
	@ echo ""
	@ echo "    make setup       -- Create a local Python virtual environment"
	@ echo "                        that will hold requirements.pip modules"
	@ echo ""
	@ echo "    make run         -- Executes the logger"
	@ echo ""
	@ echo "    make deploy      -- Register meteorologger proccess on the"
	@ echo "                        supervisor daemon tool (requires root)"
19
	@ echo ""
20
21
22
23
	@ echo "    make undeploy    -- Unregister meteorologger proccess on the"
	@ echo "                        supervisor daemon tool (requires root)"
	@ echo ""
	@ echo "    make tail-exec   -- Follow the logger's execution.log"
Nelso Jost's avatar
Nelso Jost committed
24

Nelso Jost's avatar
Nelso Jost committed
25
setup: venv
Nelso Jost's avatar
Nelso Jost committed
26

27
28
deb-install:
	sudo apt-get install python3 python3-pip supervisor
Nelso Jost's avatar
Nelso Jost committed
29
30
	sudo pip3 install virtualenv

31
venv: clean-venv
Nelso Jost's avatar
Nelso Jost committed
32
	@ echo "-------------------------------------------------------"
33
34
35
36
37
38
39
40
41
42
43
44
45
46
	virtualenv -v --python='${PY}' ${VENV}
	@ echo "Virtualenv with interpreter '${PY}' was created at ${VENV}"
	@ echo "-------------------------------------------------------"
	${VENV}/bin/pip3 install --upgrade pip
	@ echo "-------------------------------------------------------"
	${VENV}/bin/pip3 install -r requirements.pip
	@ echo "-------------------------------------------------------"
	@ echo "Virtualenv is ready at ${VENV}!"
	@ echo " "
	@ echo "TOTAL SIZE: "
	@ du -sh ${VENV}

clean-venv:
	rm -rf ${VENV}
Nelso Jost's avatar
Nelso Jost committed
47

48
run:
49
	sudo ${VENV}/bin/python3 logger.py -v
Nelso Jost's avatar
Nelso Jost committed
50

51
deploy:
52
53
54
55
56
57
58
	sudo ${VENV}/bin/python3 deploy.py

undeploy:
	sudo ${VENV}/bin/python3 deploy.py -u

tail-exec:
	tail -F logs/execution.log