-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
55 lines (44 loc) · 1.04 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
# grasping environment
conda?=miniconda
user=$(shell id -u)
# deployment settings
gunicorn?=$(shell which gunicorn)
devPort?=8000
prodPort?=8000
hostname?=0.0.0.0
projectDir=$(PWD)
.PHONY: build deploy
build-dir:
mkdir -p build
init:
./scripts/install-conda.sh $(conda)
requirements:
pip install -r requirements.txt
migrate:
python app/manage.py migrate
start-dev:
enableDebug=yes python app/manage.py runserver 0:$(devPort)
test:
python app/manage.py test app/tests
#### Deployment section ####
build: build-dir
sed -e 's#<gunicorn_path>#$(gunicorn)#' \
-e 's#<project_dir>#$(projectDir)/app#' \
-e 's#<hostname>#$(hostname)#' \
-e 's#<port>#$(prodPort)#' \
deploy/app.service > build/app.service
deploy:
ifeq ($(user),0)
sudo cp build/app.service /etc/systemd/system/app.service
sudo systemctl enable app.service
sudo systemctl start app.service
else
@echo "Please run as sudo to install"
endif
restart:
ifeq ($(user),0)
sudo systemctl restart app.service
else
@echo "Please run as sudo to restart"
endif
#### Deployment section ####