-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
146 lines (123 loc) · 4.06 KB
/
Copy pathMakefile
File metadata and controls
146 lines (123 loc) · 4.06 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
.PHONY: help dev infra backend stop logs test lint clean setup health prune
# Default target
help:
@echo "QuantForge AI Engine - Development Commands"
@echo ""
@echo " SETUP"
@echo " make setup - First-time setup (create .env, pull images)"
@echo " make install - Install Python dependencies locally"
@echo ""
@echo " DEVELOPMENT"
@echo " make dev - Start infra + backend (full stack)"
@echo " make infra - Start infrastructure services only"
@echo " make backend - Start backend locally (uvicorn)"
@echo " make stop - Stop all Docker services"
@echo ""
@echo " MAINTENANCE"
@echo " make logs - View Docker logs"
@echo " make health - Check health of services"
@echo " make test - Run tests"
@echo " make lint - Run linters"
@echo " make clean - Remove containers and volumes"
@echo " make prune - Clean up Docker (reclaim disk space)"
@echo ""
@echo " DATABASE"
@echo " make migrate - Run Alembic migrations"
@echo " make db-shell - Open psql shell to TimescaleDB"
# =============================================================================
# SETUP
# =============================================================================
# First-time setup
setup:
@echo "Setting up QuantForge development environment..."
@if not exist .env copy .env.example .env
docker compose pull
@echo ""
@echo "Setup complete! Run 'make dev' to start."
# Install Python dependencies locally
install:
pip install -r requirements.txt
# =============================================================================
# DEVELOPMENT
# =============================================================================
# Start infrastructure services (Docker) + backend (local)
dev: infra
@echo ""
@echo "Starting backend locally..."
@echo "Press Ctrl+C to stop"
@echo ""
uvicorn backend.main:app --reload --host 127.0.0.1 --port 8000
# Start infrastructure services only (Docker)
infra:
docker compose up -d
@echo ""
@echo "Infrastructure services starting..."
@echo " Redis: localhost:6379"
@echo " MinIO: http://localhost:9001"
@echo " Weaviate: http://localhost:8080"
@echo " TimescaleDB: localhost:5433"
@echo " Ollama: http://localhost:11434"
# Start backend locally (assumes infra is running)
backend:
@echo "Starting backend..."
@echo " API: http://localhost:8000"
@echo " Swagger: http://localhost:8000/docs"
@echo ""
uvicorn backend.main:app --reload --host 127.0.0.1 --port 8000
# Start Celery worker locally
celery:
celery -A backend.workers.celery_app worker --loglevel=info
# Stop all Docker services
stop:
docker compose down
# =============================================================================
# MAINTENANCE
# =============================================================================
# View Docker logs
logs:
docker compose logs -f
# View logs for specific service
logs-%:
docker compose logs -f $*
# Check health of services
health:
@echo "Checking service health..."
@echo ""
@docker ps --filter "name=quantforge" --format "table {{.Names}}\t{{.Status}}"
# Run tests locally
test:
pytest tests/ -v
# Run linters
lint:
black backend/ tests/ --check
isort backend/ tests/ --check-only
mypy backend/
# Format code
format:
black backend/ tests/
isort backend/ tests/
# Clean up containers and volumes
clean:
docker compose down -v
@echo "Containers and volumes removed."
# Clean up Docker to reclaim disk space
prune:
@echo "Cleaning up Docker..."
docker system prune -a -f
docker builder prune -f
@echo ""
@echo "Disk space reclaimed!"
@docker system df
# =============================================================================
# DATABASE
# =============================================================================
# Run Alembic migrations
migrate:
alembic upgrade head
# Create new migration
migration:
@read -p "Migration message: " msg; \
alembic revision --autogenerate -m "$$msg"
# Open psql shell to TimescaleDB
db-shell:
docker exec -it quantforge-timescale psql -U quantforge -d market_data