-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
89 lines (65 loc) · 3.03 KB
/
Copy pathMakefile
File metadata and controls
89 lines (65 loc) · 3.03 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
# ============================================================
# RedSea Intelligence — Makefile
# ============================================================
.PHONY: help install dev test lint build up down logs clean
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
# ---- Development ----
install: ## Install all dependencies
pip install -r requirements.txt
cd frontend && npm install
dev-backend: ## Run all backend services locally
@echo "Starting API Gateway on :8000..."
uvicorn services.api-gateway.app.main:app --host 0.0.0.0 --port 8000 --reload &
@echo "Starting Data Ingestion on :8001..."
uvicorn services.data-ingestion.app.main:app --host 0.0.0.0 --port 8001 --reload &
@echo "Starting Simulation Engine on :8002..."
uvicorn services.simulation-engine.app.main:app --host 0.0.0.0 --port 8002 --reload &
@echo "Starting Congestion Prediction on :8003..."
uvicorn services.congestion-prediction.app.main:app --host 0.0.0.0 --port 8003 --reload &
@echo "Starting Anomaly Detection on :8004..."
uvicorn services.anomaly-detection.app.main:app --host 0.0.0.0 --port 8004 --reload &
@echo "Starting Route Optimization on :8005..."
uvicorn services.route-optimization.app.main:app --host 0.0.0.0 --port 8005 --reload &
@echo "Starting AI Assistant on :8006..."
uvicorn services.ai-assistant.app.main:app --host 0.0.0.0 --port 8006 --reload &
dev-frontend: ## Run frontend dev server
cd frontend && npm run dev
# ---- Testing ----
test: ## Run all tests
pytest tests/ -v --cov=services --cov=shared --cov-report=term-missing
test-unit: ## Run unit tests only
pytest tests/ -v -m "not integration"
test-integration: ## Run integration tests only
pytest tests/ -v -m "integration"
# ---- Code Quality ----
lint: ## Run linters
flake8 services/ shared/ --max-line-length=120 --ignore=E501,W503
cd frontend && npx tsc --noEmit
format: ## Format code
black services/ shared/ tests/
isort services/ shared/ tests/
# ---- Docker ----
build: ## Build all Docker images
docker compose build
up: ## Start all services with Docker Compose
docker compose up -d
down: ## Stop all services
docker compose down
logs: ## View logs for all services
docker compose logs -f
logs-service: ## View logs for a specific service (usage: make logs-service SERVICE=api-gateway)
docker compose logs -f $(SERVICE)
# ---- Database ----
db-migrate: ## Run database migrations
@echo "Running database migrations..."
docker compose exec postgres psql -U redsea -d redsea_intelligence -f /docker-entrypoint-initdb.d/init.sql
db-shell: ## Open database shell
docker compose exec postgres psql -U redsea -d redsea_intelligence
# ---- Cleanup ----
clean: ## Clean up generated files and containers
docker compose down -v --remove-orphans
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete 2>/dev/null || true
rm -rf frontend/dist frontend/node_modules
rm -rf .pytest_cache .mypy_cache htmlcov