-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
181 lines (147 loc) · 6.33 KB
/
Makefile
File metadata and controls
181 lines (147 loc) · 6.33 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# Makefile for Yeko Project Docker Development Environment
# Provides convenient commands for managing Docker services
.PHONY: help docker-up docker-down docker-logs docker-rebuild docker-clean docker-build docker-prod-up docker-prod-down docker-status
# Default target
help: ## Show this help message
@echo "Yeko Docker Development Environment"
@echo "==================================="
@echo ""
@echo "Development Commands:"
@echo " docker-up Start all development services"
@echo " docker-down Stop all development services"
@echo " docker-logs View logs from all services"
@echo " docker-rebuild Rebuild and restart all services"
@echo " docker-build Build all Docker images"
@echo " docker-clean Clean containers and images"
@echo " docker-status Show status of all services"
@echo ""
@echo "Production Commands:"
@echo " docker-prod-up Start all production services"
@echo " docker-prod-down Stop all production services"
@echo " docker-prod-build Build all production images"
@echo ""
@echo "Service-specific Commands:"
@echo " core-up Start only yeko-core service"
@echo " school-up Start only yeko-school service"
@echo " teacher-up Start only yeko-teacher service"
@echo " data-up Start only data-service"
@echo " worker-up Start only queue-worker"
@echo ""
@echo "Tunnel Commands (ngrok):"
@echo " tunnel Start all ngrok tunnels"
@echo " tunnel-core Start ngrok tunnel for yeko-core"
@echo " tunnel-school Start ngrok tunnel for yeko-school"
@echo " tunnel-teacher Start ngrok tunnel for yeko-teacher"
@echo " tunnel-data Start ngrok tunnel for data-service"
@echo ""
@echo "Utility Commands:"
@echo " shell-core Open shell in yeko-core container"
@echo " shell-school Open shell in yeko-school container"
@echo " shell-teacher Open shell in yeko-teacher container"
@echo " shell-data Open shell in data-service container"
@echo " shell-worker Open shell in queue-worker container"
# Development Commands
docker-up: ## Start all development services
docker compose up -d
@echo "✅ All development services started"
@echo "🌐 yeko-core: http://localhost:3000"
@echo "🌐 yeko-school: http://localhost:3001"
@echo "🌐 yeko-teacher: http://localhost:3002"
@echo "🌐 data-service: http://localhost:8787"
docker-down: ## Stop all development services
docker compose down
@echo "🛑 All development services stopped"
docker-logs: ## View logs from all services
docker compose logs -f
docker-rebuild: ## Rebuild and restart all services
docker compose down
docker compose build --no-cache
docker compose up -d
@echo "🔄 All services rebuilt and restarted"
docker-build: ## Build all Docker images
docker compose build
@echo "🏗️ All Docker images built"
docker-clean: ## Clean containers and images
docker compose down -v --remove-orphans
docker system prune -f
docker volume prune -f
@echo "🧹 Docker containers and images cleaned"
docker-status: ## Show status of all services
docker compose ps
# Production Commands
docker-prod-up: ## Start all production services
docker compose -f docker-compose.prod.yml up -d
@echo "✅ All production services started"
docker-prod-down: ## Stop all production services
docker compose -f docker-compose.prod.yml down
@echo "🛑 All production services stopped"
docker-prod-build: ## Build all production images
docker compose -f docker-compose.prod.yml build
@echo "🏗️ All production Docker images built"
# Service-specific Development Commands
core-up: ## Start only yeko-core service
docker compose up -d yeko-core
@echo "✅ yeko-core started: http://localhost:3000"
school-up: ## Start only yeko-school service
docker compose up -d yeko-school
@echo "✅ yeko-school started: http://localhost:3001"
teacher-up: ## Start only yeko-teacher service
docker compose up -d yeko-teacher
@echo "✅ yeko-teacher started: http://localhost:3002"
data-up: ## Start only data-service
docker compose up -d data-service
@echo "✅ data-service started: http://localhost:8787"
worker-up: ## Start only queue-worker
docker compose up -d queue-worker
@echo "✅ queue-worker started"
# Tunnel Commands
tunnel: ## Start all ngrok tunnels
ngrok start --config ngrok.yml --all
tunnel-core: ## Start ngrok tunnel for yeko-core
ngrok start --config ngrok.yml yeko-core
tunnel-school: ## Start ngrok tunnel for yeko-school
ngrok start --config ngrok.yml yeko-school
tunnel-teacher: ## Start ngrok tunnel for yeko-teacher
ngrok start --config ngrok.yml yeko-teacher
tunnel-data: ## Start ngrok tunnel for data-service
ngrok start --config ngrok.yml data-service
# Utility Commands
shell-core: ## Open shell in yeko-core container
docker compose exec yeko-core sh
shell-school: ## Open shell in yeko-school container
docker compose exec yeko-school sh
shell-teacher: ## Open shell in yeko-teacher container
docker compose exec yeko-teacher sh
shell-data: ## Open shell in data-service container
docker compose exec data-service sh
shell-worker: ## Open shell in queue-worker container
docker compose exec queue-worker sh
# Development workflow shortcuts
dev: docker-up ## Alias for docker-up
stop: docker-down ## Alias for docker-down
logs: docker-logs ## Alias for docker-logs
rebuild: docker-rebuild ## Alias for docker-rebuild
clean: docker-clean ## Alias for docker-clean
# Production workflow shortcuts
prod: docker-prod-up ## Alias for docker-prod-up
prod-stop: docker-prod-down ## Alias for docker-prod-down
prod-build: docker-prod-build ## Alias for docker-prod-build
# Advanced Commands
docker-pull: ## Pull latest base images
docker pull node:22-alpine
docker pull nginx:alpine
@echo "📥 Latest base images pulled"
docker-backup: ## Backup important volumes
docker run --rm -v yeko_postgres_data:/data -v $(PWD):/backup alpine tar czf /backup/postgres-backup.tar.gz -C /data .
@echo "💾 Database backed up"
docker-restore: ## Restore from backup
docker run --rm -v yeko_postgres_data:/data -v $(PWD):/backup alpine tar xzf /backup/postgres-backup.tar.gz -C /data
@echo "📂 Database restored"
# Health check
health: ## Check health of all services
@echo "🏥 Checking service health..."
@docker compose ps --format "table {{.Name}}\t{{.Status}}\t{{.Ports}}"
# Network info
network: ## Show network information
docker network ls | grep yeko
docker network inspect yeko_yeko-network