-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
93 lines (67 loc) · 2.96 KB
/
Makefile
File metadata and controls
93 lines (67 loc) · 2.96 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
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
.PHONY: help build deploy-dev deploy-prod rollback clean
help: ## Show this help message
@echo 'Usage: make [target]'
@echo ''
@echo 'Available targets:'
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
# Docker Compose Commands
up: ## Start all services with Docker Compose
docker compose up -d
down: ## Stop all services
docker compose down
logs: ## View logs
docker compose logs -f
build-local: ## Build Docker images locally
docker compose build
# Kubernetes Commands
k8s-dev: ## Deploy to Kubernetes development
kubectl apply -k k8s/overlays/development
k8s-prod: ## Deploy to Kubernetes production
kubectl apply -k k8s/overlays/production
deploy-dev: ## Deploy to development environment
./scripts/deploy-dev.sh
deploy-prod: ## Deploy to production environment
./scripts/deploy-prod.sh
rollback-dev: ## Rollback development deployment
./scripts/rollback.sh dev $(service)
rollback-prod: ## Rollback production deployment
./scripts/rollback.sh prod $(service)
health-dev: ## Check development health
./scripts/health-check.sh dev
health-prod: ## Check production health
./scripts/health-check.sh prod
# Image Building
build-images: ## Build all Docker images
docker build -t auraweb/frontend:latest ./frontend
docker build -t auraweb/admin:latest ./admin
docker build -t auraweb/backend:latest ./backend
push-images: ## Push images to registry
docker push auraweb/frontend:latest
docker push auraweb/admin:latest
docker push auraweb/backend:latest
# Kubernetes Management
k8s-status-dev: ## Show development cluster status
kubectl get all -n auraweb-dev
k8s-status-prod: ## Show production cluster status
kubectl get all -n auraweb-prod
k8s-logs-dev: ## View development logs
kubectl logs -f -l app=$(service) -n auraweb-dev
k8s-logs-prod: ## View production logs
kubectl logs -f -l app=$(service) -n auraweb-prod
k8s-shell-dev: ## Get shell in development pod
kubectl exec -it $(pod) -n auraweb-dev -- /bin/sh
k8s-shell-prod: ## Get shell in production pod
kubectl exec -it $(pod) -n auraweb-prod -- /bin/sh
# Database
db-backup: ## Backup database
kubectl exec -n auraweb-prod $(shell kubectl get pods -n auraweb-prod -l app=database -o jsonpath='{.items[0].metadata.name}') -- pg_dump -U postgres auraweb > backup-$(shell date +%Y%m%d-%H%M%S).sql
db-restore: ## Restore database (file=backup.sql)
kubectl exec -i -n auraweb-prod $(shell kubectl get pods -n auraweb-prod -l app=database -o jsonpath='{.items[0].metadata.name}') -- psql -U postgres auraweb < $(file)
# Cleanup
clean: ## Clean up local Docker resources
./scripts/cleanup local dev --yes
clean-k8s-dev: ## Delete development namespace
kubectl delete namespace auraweb-dev
clean-k8s-prod: ## Delete production namespace (DANGEROUS!)
@echo "⚠️ WARNING: This will delete the production namespace!"
@read -p "Are you sure? (yes/no): " confirm && [ "$$confirm" = "yes" ] && kubectl delete namespace auraweb-prod || echo "Cancelled"