-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
81 lines (72 loc) · 2.95 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
CMD:=poetry run
client_dir:=cd client
server_dir:=cd server
terraform:=cd terraform
celery_app:=.celery_app
help:
@echo "\n- Docker: To build and run a specific service, execute 'make docker-up service=<service_name>'"
@echo "\n- To run the backend project, execute 'make run server=<backend>'"
@echo "\n- To run the frontend project, execute 'make run server=<frontend>'"
@echo "\n- To run the backend celery scheduler, execute 'make run server=<celery_beat>'"
@echo "\n- To run the backend celery server, execute 'make run server=<celery_worker>'"
install:
$(server_dir) && poetry install
$(server_dir) && poetry check
$(client_dir) && pnpm i
run:
ifeq ($(server), backend)
$(server_dir) && $(CMD) python3 manage.py runserver
else ifeq ($(server), frontend)
$(client_dir) && pnpm dev
else ifeq ($(server), celery_beat)
$(server_dir) && $(CMD) python3 -m celery -A $(celery_app) beat -l info
else ifeq ($(server), celery_worker)
$(server_dir) && $(CMD) python3 -m celery -A $(celery_app) worker -l info
endif
docker-up:
ifeq ($(service), frontend)
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env up frontend --build -d
else ifeq ($(service), backend)
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env up backend --build -d
else ifeq ($(service), postgres)
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env up postgres --build -d
else
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env up --build -d
endif
docker-down:
ifeq ($(service), frontend)
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env down frontend
else ifeq ($(service), backend)
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env down backend
else ifeq ($(service), postgres)
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env down postgres
else
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env down
endif
docker-logs:
ifeq ($(service), frontend)
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env logs -f frontend
else ifeq ($(service), backend)
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env logs -f backend
else ifeq ($(service), postgres)
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env logs -f postgres
else
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env logs -f
endif
test:
$(server_dir) && $(CMD) python3 manage.py test
lint:
$(server_dir) && $(CMD) black . --exclude=__init__.py
$(server_dir) && $(CMD) flake8 . --exclude=__init__.py
$(client_dir) && pnpm lint
migrate:
$(server_dir) && $(CMD) python3 manage.py makemigrations
$(server_dir) && $(CMD) python3 manage.py migrate
user:
$(server_dir) && $(CMD) python3 manage.py createsuperuser
data:
$(server_dir) && $(CMD) python3 manage.py create locations users
deploy:
$(terraform) && terraform init && terraform apply -auto-approve
destroy:
$(terraform) && terraform destroy -auto-approve