-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
147 lines (131 loc) · 4 KB
/
Makefile
File metadata and controls
147 lines (131 loc) · 4 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
.PHONY: setup sync deploy deploy-user deploy-game deploy-org deploy-stock deploy-debug deploy-focus deploy-safety test clean help emulator dev-game
# Load config
PROJECT_NAME ?= my-app
GCP_REGION ?= us-central1
help:
@echo "Available commands:"
@echo ""
@echo "Local Development:"
@echo " make emulator - Start Firestore emulator (keep running in terminal)"
@echo " make dev-game - Run game-service locally (requires emulator running)"
@echo ""
@echo "Setup & Deploy:"
@echo " make setup - Run initial setup (sync shared code, update modules)"
@echo " make sync - Sync /shared code to all services"
@echo " make deploy - Deploy all services to Cloud Run"
@echo " make deploy-user - Deploy user-service only"
@echo " make deploy-game - Deploy game-service only"
@echo " make deploy-org - Deploy org-service only"
@echo " make deploy-stock - Deploy stock-prices service"
@echo " make deploy-debug - Deploy debug-logs service"
@echo " make deploy-focus - Deploy focus-tube backend + frontend"
@echo " make deploy-safety - Deploy safety-pulse service"
@echo ""
@echo "Other:"
@echo " make test - Run tests for all services"
@echo " make clean - Remove synced files from services"
setup:
@chmod +x setup.sh
@./setup.sh
sync:
@echo "🔄 Syncing shared code..."
@./setup.sh
deploy: setup
@echo "🚀 Deploying all services..."
@$(MAKE) deploy-user
@$(MAKE) deploy-game
deploy-user:
@echo "🚀 Deploying user-service..."
@cd services/user-service && \
gcloud run deploy user-service \
--source . \
--region $(GCP_REGION) \
--allow-unauthenticated \
--platform managed \
--quiet
deploy-game:
@echo "🚀 Deploying game-service..."
@cd services/game-service && \
gcloud run deploy game-service \
--source . \
--region $(GCP_REGION) \
--allow-unauthenticated \
--platform managed \
--set-env-vars ENV=production,GCP_PROJECT=michal-playground-2026 \
--quiet
deploy-org:
@echo "🚀 Deploying org-service..."
@cd services/org-service && \
gcloud run deploy org-service \
--source . \
--region $(GCP_REGION) \
--allow-unauthenticated \
--platform managed \
--quiet
deploy-stock:
@echo "Deploying stock-prices..."
@cd standalone-apis/stock-prices && \
gcloud run deploy stock-prices \
--source . \
--region $(GCP_REGION) \
--allow-unauthenticated \
--platform managed \
--quiet
deploy-focus:
@echo "Deploying focus-tube..."
@cd standalone-apis/focus-tube && \
gcloud run deploy focus-tube \
--source . \
--region $(GCP_REGION) \
--allow-unauthenticated \
--platform managed \
--quiet
deploy-debug:
@echo "Deploying debug-logs..."
@cd standalone-apis/debug-logs && \
gcloud run deploy debug-logs \
--source . \
--region $(GCP_REGION) \
--allow-unauthenticated \
--platform managed \
--quiet
deploy-safety:
@echo "Deploying safety-pulse..."
@cd standalone-apis/safety-pulse && \
gcloud run deploy safety-pulse \
--source . \
--project michal-playground-2026 \
--region $(GCP_REGION) \
--allow-unauthenticated \
--platform managed \
--set-env-vars ENV=production,GCP_PROJECT=michal-playground-2026 \
--quiet
test:
@echo "🧪 Running tests..."
@for service in services/*; do \
if [ -d "$$service" ]; then \
echo "Testing $$(basename $$service)..."; \
cd $$service && go test -v ./... || exit 1; \
cd ../..; \
fi \
done
clean:
@echo "🧹 Cleaning synced files..."
@find services -type d -name "auth" -o -name "middleware" -o -name "response" | xargs rm -rf
@echo "✅ Clean complete"
# Local Development
emulator:
@echo "🔥 Starting Firestore emulator..."
@echo "Keep this terminal open! Press Ctrl+C to stop."
@gcloud emulators firestore start
dev-game:
@echo "🎮 Starting game-service locally..."
@echo ""
@echo "Make sure emulator is running in another terminal:"
@echo " make emulator"
@echo ""
@cd services/game-service && \
export PATH=$$HOME/go/bin:$$PATH && \
export GCP_PROJECT=michal-playground-2026 && \
export FIRESTORE_EMULATOR_HOST=localhost:8080 && \
go run .