-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
102 lines (75 loc) · 2.7 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Makefile - common commands for development.
DJANGO_CONTAINER_NAME = web
DJANGO_SERVICE_NAME = web
DATABASE_SERVICE_NAME = postgres
PGADMIN_SERVICE_NAME = pgadmin
REDIS_SERVICE_NAME = redis
REDIS_COMMANDER_SERVICE_NAME = redis-commander
JUPYTER_NOTEBOOK_SERVICE_NAME = notebook
MAIL_HOG_SERVICE_NAME = mailhog
BEAT_SERVICE_NAME = beat
WORKER_SERVICE_NAME = worker
## -- docker targets --
init:
docker exec -it ${DJANGO_CONTAINER_NAME} ./scripts/init_data.sh
ps:
docker ps --format 'table {{.Names}}\t{{.Image}}\t{{.Ports}}\t{{.Status}}'
attach:
docker exec -it ${DJANGO_CONTAINER_NAME} bash
shell:
docker exec -it ${DJANGO_CONTAINER_NAME} python manage.py shell
## -- docker-compose targets --
## validate file
config:
docker-compose config
## run postgres service
up-postgres:
docker-compose -f docker-compose.dev.yml up ${DATABASE_SERVICE_NAME} -d
## run pgadmin service
up-pgadmin:
docker-compose -f docker-compose.dev.yml up ${PGADMIN_SERVICE_NAME} -d
## run redis service
up-redis:
docker-compose -f docker-compose.dev.yml up ${REDIS_SERVICE_NAME} -d
## run web service
up-redis-commander:
docker-compose -f docker-compose.dev.yml up ${REDIS_COMMANDER_SERVICE_NAME} -d
## run web service
up-web:
docker-compose -f docker-compose.dev.yml up ${DJANGO_SERVICE_NAME} -d
## run beat service
up-beat:
docker-compose -f docker-compose.dev.yml up ${BEAT_SERVICE_NAME} -d
## run worker service
up-worker:
docker-compose -f docker-compose.dev.yml up ${WORKER_SERVICE_NAME} -d
## run jupyter service
up-jupyter:
docker-compose -f docker-compose.dev.yml up ${JUPYTER_NOTEBOOK_SERVICE_NAME} -d
## run mail service
up-mail:
docker-compose -f docker-compose.dev.yml up ${MAIL_HOG_SERVICE_NAME} -d
## build and run web service, if image source is updated
build-web:
docker-compose -f docker-compose.dev.yml up --build ${DJANGO_SERVICE_NAME} -d
## docker compose up in development and background
up-dev:
docker-compose -f docker-compose.dev.yml up -d
down-dev:
docker-compose -f docker-compose.dev.yml down
## test web service
test:
docker-compose -f docker-compose.dev.yml run --rm ${DJANGO_SERVICE_NAME} pytest
## make migrations in web service
migrate:
docker-compose -f docker-compose.dev.yml exec ${DJANGO_SERVICE_NAME} python manage.py makemigrations
docker-compose -f docker-compose.dev.yml exec ${DJANGO_SERVICE_NAME} python manage.py migrate
## run pytest-cov with web service
pytest-cov:
docker-compose run ${DJANGO_SERVICE_NAME} pytest --cov-report html --cov=.
## Check to see if the local postgres service service is running
pg-is-ready:
docker-compose exec ${DATABASE_SERVICE_NAME} pg_isready
## Check to see if the local redis service is running
redis-ping:
docker-compose exec ${REDIS_SERVICE_NAME} redis-cli ping