Makefile 1.72 KB
Newer Older
1
PY := 3
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
	@ echo "    make apt-install -- Uses apt to install required system tools"
10
11
12
13
14
15
16
17
18
	@ 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
apt-install:
26
27
	sudo apt-get install python python3-pip supervisor
	sudo pip${PYVER} install virtualenv
Nelso Jost's avatar
Nelso Jost committed
28

29
setup: clean-venv
Nelso Jost's avatar
Nelso Jost committed
30
	@ echo "-------------------------------------------------------"
31
32
	virtualenv -v --python='python${PYVER}' ${VENV}
	@ echo "Virtualenv with 'python${PYVER}' interpreter was created at ${VENV}"
33
	@ echo "-------------------------------------------------------"
34
	${VENV}/bin/pip${PYVER} install --upgrade pip
35
	@ echo "-------------------------------------------------------"
36
	${VENV}/bin/pip${PYVER} install -r requirements.pip
37
38
39
40
41
42
43
44
	@ 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
45

46
run:
47
	sudo ${VENV}/bin/python${PYVER} logger.py
Nelso Jost's avatar
Nelso Jost committed
48

49
deploy:
50
	sudo ${VENV}/bin/python${PYVER} deploy.py
51
52

undeploy:
53
	sudo ${VENV}/bin/python${PYVER} deploy.py -u
54
55
56

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