-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
63 lines (49 loc) · 2.14 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
.PHONY: help build run deploy stop test migrations migrate admin local_confmap prod_confmap k8s
help:
@echo "Available targets:"
@echo " help - Show this help message."
@echo " build - Build the docker image."
@echo " run - Run the docker container."
@echo " deploy - Run the docker container in production mode."
@echo " stop - Stop the docker container."
@echo " test - Run the tests."
@echo " migrations - Create migrations."
@echo " migrate - Run migrations."
@echo " admin - Create admin user."
@echo " local_confmap - Make Kubernetes config maps for local stage"
@echo " prod_confmap - Make Kubernetes config maps for production stage"
@echo " k8s - Deploy to Kubernetes"
build:
docker compose build
run:
ifeq ($(DETACHED),true)
docker compose up -d
else
docker compose up
endif
deploy:
docker compose -f docker-compose.prod.yaml up -d
stop:
docker compose down
test:
docker exec food-anywhere-backend pytest
migrations:
docker exec food-anywhere-backend python manage.py makemigrations
migrate:
docker exec food-anywhere-backend python manage.py migrate
admin:
docker exec -it food-anywhere-backend python manage.py createsuperuser
local_confmap:
kubectl create configmap food-anywhere-env --from-env-file=envs/.env.local \
&& kubectl create configmap food-anywhere-env-file --from-file=.env=envs/.env.local \
&& kubectl create configmap prometheus-config --from-file=prometheus.yml=./prometheus/config.yaml \
&& kubectl create configmap promtail-config --from-file=promtail.yaml=./promtail/config.yaml \
&& kubectl create configmap grafana-config --from-file=datasources.yaml=./grafana/datasources.yaml
prod_confmap:
kubectl create configmap food-anywhere-env --from-env-file=.envs/.env.prod \
&& kubectl create configmap food-anywhere-env-file --from-file=.env=envs/.env.prod \
&& kubectl create configmap prometheus-config --from-file=prometheus.yml=./prometheus/config.yaml \
&& kubectl create configmap promtail-config --from-file=promtail.yaml=./promtail/config.yaml \
&& kubectl create configmap grafana-config --from-file=datasources.yaml=./grafana/datasources.yaml
k8s:
kubectl apply -f kubernetes/