-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmakefile
More file actions
108 lines (84 loc) · 2.59 KB
/
makefile
File metadata and controls
108 lines (84 loc) · 2.59 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
100
101
102
103
104
105
106
107
108
MANAGE_PATH = way_to_home/manage.py
.PHONY: default help
default: help
help:
@echo "- \033[4mInstall commands\033[0m:"
@echo "\trequirements - install project requirements"
@echo "\trabbitMQ - install rabbitMQ"
@echo "\tredis - install redis"
@echo "\tpostgres - install postgres"
@echo "\tlogger - create file for logs"
@echo "\t\033[1minstall - run all install commands mentioned above\033[0m"
@echo "- \033[4mBackend commands\033[0m:"
@echo "\tdjango - run django server"
@echo "\tcelery - run celery beat and worker"
@echo "\tprepare_data - run command to prepare data from EasyWay"
@echo "\tdaemons - run gtfs and notifier daemon in the background"
@echo "\t\033[1mbackend - run all backend commands mentioned above\033[0m"
@echo "- \033[4mAdditional commands\033[0m:"
@echo "\tlints - run projects lints"
@echo "\ttest - run tests"
@echo "\tfrontend - run watcher"
@echo "\t\033[1mstart - run frontend and backend commands\033[0m"
# Install commands
requirements:
pip install -r requirements.txt
npm install
logger:
sudo touch /var/log/way_to_home.log
sudo chown -R $USER:$USER /var/log/way_to_home.log
rabbitMQ:
sudo apt-get install -y erlang
sudo apt-get install rabbitmq-server
sudo service rabbitmq-server restart || sudo rabbitmq-server
postgres:
sudo apt-get install postgresql postgresql-contrib
sudo -u postgres psql -c "CREATE DATABASE postgres"
sudo -u postgres psql -c "ALTER USER postgres CREATEDB"
redis:
sudo apt-get install redis-server
redis-cli ping
install:
make requirements
make rabbitMQ
make logger
make redis
make postgres
# Backend commands
db:
python $(MANAGE_PATH) migrate
django:
python $(MANAGE_PATH) runserver
celery:
(cd way_to_home;\
gnome-terminal -e "bash -c \"celery -A way_to_home worker -l info; exec bash\"";\
gnome-terminal -e "bash -c \"celery -A way_to_home beat -l info; exec bash\"")
prepare_data:
python $(MANAGE_PATH) prepare_data
daemons:
(cd way_to_home/daemons;\
nohup python gtfs_daemon.py 11 > /dev/null 2>&1 & \
nohup python notifier_daemon.py > /dev/null 2>&1 &)
telegram_bot:
(cd way_to_home/telegram_bot;\
nohup python bot_handler.py > /dev/null 2>&1 &)
backend:
make db
make prepare_data
make telegram_bot
make daemons
make celery
make django
# Frontend commands
frontend:
gnome-terminal -e "bash -c \"npm start; exec bash\""
# Additional commands
start:
make frontend
make backend
lints:
(cd way_to_home; pylint --rcfile=.pylintrc *)
test:
(cd way_to_home;\
coverage run manage.py test;\
coverage html)