-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
98 lines (84 loc) · 3.79 KB
/
Makefile
File metadata and controls
98 lines (84 loc) · 3.79 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
.PHONY: install backend frontend dev index seed demo \
docker-up docker-down docker-logs lint clean test metrics
install:
uv venv && source .venv/bin/activate && uv sync
backend:
cd backend && uv run python run.py
frontend:
cd frontend && npm run dev
dev:
@echo "Starting backend and frontend..."
@make -j2 backend frontend
index:
curl -s -X POST http://localhost:8000/schema/index \
-H "Content-Type: application/json" -d '{}' | python3 -m json.tool
seed:
@bash scripts/seed_dvdrental.sh
demo:
@echo ""
@echo "==> Checking .env..."
@if [ ! -f .env ]; then \
echo "ERROR: .env not found."; \
echo "Copy the template and fill in your credentials:"; \
echo " cp .env.example .env"; \
echo "Then set DB_URL=postgresql+asyncpg://<user>@localhost:5432/dvdrental"; \
exit 1; \
fi
@echo ""
@echo "==> Seeding dvdrental database..."
@bash scripts/seed_dvdrental.sh
@echo ""
@echo "==> Indexing schema into Qdrant..."
@if curl -sf http://localhost:8000/health >/dev/null 2>&1; then \
curl -s -X POST http://localhost:8000/schema/index \
-H "Content-Type: application/json" -d '{}' | python3 -m json.tool; \
echo ""; \
echo "################################################################"; \
echo "# #"; \
echo "# speakql demo ready! (local Postgres path) #"; \
echo "# #"; \
echo "# Primary path: see README Quick Start for cloud setup #"; \
echo "# (Neon + Upstash + Qdrant Cloud + Groq — no local install) #"; \
echo "# #"; \
echo "# Next steps: #"; \
echo "# make dev (starts backend + frontend) #"; \
echo "# Open: http://localhost:5173 -> Optimize SQL tab #"; \
echo "# #"; \
echo "################################################################"; \
else \
echo "Backend is not running — schema index skipped."; \
echo ""; \
echo "################################################################"; \
echo "# #"; \
echo "# Database seeded. Finish setup (local Postgres path): #"; \
echo "# #"; \
echo "# Primary path: see README Quick Start for cloud setup #"; \
echo "# (Neon + Upstash + Qdrant Cloud + Groq — no local install) #"; \
echo "# #"; \
echo "# 1. make backend (in one terminal) #"; \
echo "# 2. make index (once backend is up, in another) #"; \
echo "# 3. make frontend (in a third terminal) #"; \
echo "# 4. Open: http://localhost:5173 -> Optimize SQL tab #"; \
echo "# #"; \
echo "# Or just: make dev (backend + frontend together) #"; \
echo "# then: make index #"; \
echo "# #"; \
echo "################################################################"; \
fi
docker-up:
docker compose up --build -d
docker-down:
docker compose down
docker-logs:
docker compose logs -f backend
test:
cd backend && uv run pytest tests/ -v
metrics:
curl -s http://localhost:8000/metrics | grep speakql
lint:
uv run ruff check backend/
clean:
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null; \
find . -name "*.pyc" -delete 2>/dev/null; \
rm -rf .venv dist build; \
echo "Cleaned."