forked from ctripcorp/tars
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
84 lines (53 loc) · 1.69 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
SETTINGS_CONFIG_LOCAL = --settings=tars.settings.local
SETTINGS_CONFIG_DOCKE = --settings=tars.settings.docker
all: docker_up
# Docker commands
docker_bootstrap: docker_init docker_db_init docker_up
docker_build:
docker-compose build
docker_up:
docker-compose up
docker_init: docker_frontend_build docker_build
docker_db_up:
docker-compose up -d db
docker_db_create_user: docker_db_up
docker-compose run worker python manage.py createsuperuser $(SETTINGS_CONFIG_DOCKE)
docker_db_migrate: docker_db_up
docker-compose run worker python manage.py migrate $(SETTINGS_CONFIG_DOCKE)
docker_db_init: docker_db_up sleep_20s docker_db_migrate docker_db_create_user
docker_clean:
docker-compose stop && docker-compose rm -f
# common
sleep_10s:
sleep 10
sleep_20s:
sleep 20
sleep_40s:
sleep 40
# Django commands
server: frontend
python manage.py runserver 0.0.0.0:8000 $(SETTINGS_CONFIG_LOCAL)
db_create_user:
python manage.py createsuperuser $(SETTINGS_CONFIG_LOCAL)
db_migrate:
python manage.py migrate $(SETTINGS_CONFIG_LOCAL)
npm_registry:
npm config set registry http://registry.npm.taobao.org
frontend_requirements_gulp: npm_registry
gulp --version || npm install -g gulp
frontend_npm: npm_registry
cd tars/surface/static && npm install
frontend_gulp: frontend_requirements_gulp
cd tars/surface/static && gulp
frontend: frontend_npm frontend_gulp
frontend_docker:
docker-compose -f docker-compose-frontend.yml up
frontend_docker_stop:
docker-compose -f docker-compose-frontend.yml stop
frontend_docker_rm: frontend_docker_stop
docker-compose -f docker-compose-frontend.yml rm -v -f
flush_priviledge:
chown -R $$USER .
# Aliases
runserver: server
docker_frontend_build: frontend_docker