-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
124 lines (99 loc) · 4.56 KB
/
Copy pathMakefile
File metadata and controls
124 lines (99 loc) · 4.56 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
.PHONY: setup format lint check test test-integration clean \
worker resurrector dev dev-down dev-logs prod prod-down \
bench bench-docker bench-docker-down docs docs-serve docs-build
# =============================================================================
# Setup & quality
# =============================================================================
# Install the project and dev tooling into a local virtualenv.
setup:
uv venv
uv pip install -e ".[dev]"
pre-commit install
format:
uv run ruff format src/ tests/
uv run ruff check --fix src/ tests/
lint:
uv run ruff check src/ tests/
uv run ruff format --check src/ tests/
check: lint
uv run mypy src/
test:
uv run pytest tests/unit/ -v
test-integration:
uv run pytest tests/integration/ -v --timeout=120 --reruns 2 --reruns-delay 1
clean:
find . -type d -name "__pycache__" -exec rm -rf {} +
find . -type d -name ".pytest_cache" -exec rm -rf {} +
find . -type d -name ".mypy_cache" -exec rm -rf {} +
find . -type d -name ".ruff_cache" -exec rm -rf {} +
@echo "Local cache cleared."
# =============================================================================
# Docs (MkDocs Material)
# =============================================================================
# Docs deps live in the `docs` dependency group, not the base install, so a
# plain `mkdocs serve` in the project venv fails with "No module named mkdocs".
# These targets pull the group on demand via uv, matching the CI build in
# .github/workflows/docs.yml.
# Live-reload server at http://127.0.0.1:8001
# Port 8001 (not mkdocs' default 8000) avoids clashing with a Relier app
# served by `uvicorn main:app`, which also binds 8000. On Windows both can
# bind 8000 and the OS routes requests to whichever started first, so the
# docs would silently show the app's 404 instead. Override with PORT=...
PORT ?= 8001
docs docs-serve:
uv run --group docs mkdocs serve -a 127.0.0.1:$(PORT)
# Strict build (fails on broken links / nav), same as CI.
docs-build:
uv run --group docs mkdocs build --strict
# =============================================================================
# Run bare-metal (no Docker)
# =============================================================================
# Relier is a plain Python library, these targets run the processes directly,
# the same way you would run Celery. They require a reachable Redis: set
# RELIER_REDIS_URL if it is not redis://localhost:6379/0. Relier preflight-checks
# Redis and refuses to start if it is unreachable.
# See docs/running.md.
# Run a Celery worker consuming every Relier queue (fine for local dev).
worker:
uv run celery -A relier.tasks.app worker -l info \
-Q high_priority,default,low_priority,re-queue
# Run the Phoenix resurrector (detects dead workers and replays their tasks).
resurrector:
uv run rl run-resurrector
# =============================================================================
# Run with Docker - dev
# =============================================================================
# Single-node Redis (AOF + RDB) + workers + resurrector. See docker-compose.yml.
dev:
docker compose up -d --build
@echo "[SUCCESS] Relier dev cluster running. Logs: make dev-logs"
dev-down:
docker compose down
dev-logs:
docker compose logs -f
# =============================================================================
# Run with Docker - prod
# =============================================================================
# HA topology: Redis master + replicas + Sentinel + backup sidecar.
# Requires REDIS_PASSWORD and SENTINEL_PASSWORD (via the environment or a
# .env file). See docker-compose.prod.yml and docs/running.md.
prod:
docker compose -f docker-compose.prod.yml up -d --build
@echo "[SUCCESS] Relier prod cluster running."
prod-down:
docker compose -f docker-compose.prod.yml down
# =============================================================================
# Benchmarks
# =============================================================================
# Synthetic mode is the default — no Ollama, no GPU, ~2 min, runs against a
# locally reachable Redis. Override BENCH_SYNTHETIC_SLEEP / BENCH_BATCH_SIZE
# in your environment to tune. See bench/README.md.
bench:
uv run python -m bench.bench --synthetic
# Full bench in an isolated Docker network with Prometheus + Grafana wired up.
# Use this when you want dashboards or repeatable hardware-independent runs.
# Results land in ./bench-results/. Grafana: http://localhost:3001
bench-docker:
docker compose -f docker-compose.bench.yml up --build
bench-docker-down:
docker compose -f docker-compose.bench.yml down -v