-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
51 lines (41 loc) · 1.99 KB
/
Copy pathMakefile
File metadata and controls
51 lines (41 loc) · 1.99 KB
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
CLUSTER ?= skillpulse
NAMESPACE ?= skillpulse
BACKEND_IMAGE ?= trainwithshubham/skillpulse-backend:latest
FRONTEND_IMAGE ?= trainwithshubham/skillpulse-frontend:latest
.PHONY: up down build load apply status logs mysql restart
up: ## One-shot: build images, create cluster, load images, apply manifests
$(MAKE) build
kind create cluster --config k8s/kind-config.yaml --name $(CLUSTER)
$(MAKE) load
$(MAKE) apply
@echo
@echo " SkillPulse is live at http://localhost:8888"
@echo
build: ## Build backend + frontend images for the host's architecture
docker build -t $(BACKEND_IMAGE) ./backend
docker build -t $(FRONTEND_IMAGE) ./frontend
load: ## Push built images into the kind node
kind load docker-image $(BACKEND_IMAGE) --name $(CLUSTER)
kind load docker-image $(FRONTEND_IMAGE) --name $(CLUSTER)
apply: ## Apply manifests and wait for rollouts
kubectl apply -f k8s/00-namespace.yaml \
-f k8s/10-mysql.yaml \
-f k8s/20-backend.yaml \
-f k8s/30-frontend.yaml
kubectl rollout status statefulset/mysql -n $(NAMESPACE) --timeout=180s
kubectl rollout status deployment/backend -n $(NAMESPACE) --timeout=120s
kubectl rollout status deployment/frontend -n $(NAMESPACE) --timeout=60s
down: ## Delete the cluster
kind delete cluster --name $(CLUSTER)
status: ## Quick health snapshot
@kubectl get pods,svc,endpoints -n $(NAMESPACE)
logs: ## Tail all three workloads at once
@kubectl logs -n $(NAMESPACE) -l 'app in (mysql,backend,frontend)' --all-containers --tail=50 -f --max-log-requests=10
mysql: ## Open a mysql shell into the StatefulSet pod
kubectl exec -it -n $(NAMESPACE) mysql-0 -- mysql -uskillpulse -pskillpulse123 skillpulse
restart: ## Rebuild + reload images, roll backend + frontend
$(MAKE) build
$(MAKE) load
kubectl rollout restart deployment/backend deployment/frontend -n $(NAMESPACE)
kubectl rollout status deployment/backend -n $(NAMESPACE) --timeout=120s
kubectl rollout status deployment/frontend -n $(NAMESPACE) --timeout=60s