Ctrl K
ComunidadGuías…

Makefile

Rama main · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
.PHONY: all build ui backend clean test dev demo demo-build demo-down demo-db bench smoke man docs

all: ui backend

ui:
	cd ui && npm install && npm run build
	powershell -NoProfile -Command "New-Item -ItemType Directory -Force internal/admin/web/dist/grafana | Out-Null"
	copy grafana\marbor.json internal\admin\web\dist\grafana\marbor.json

backend:
	go build -o marbor ./cmd/marbor
	go build -o marbor-agent ./cmd/marbor-agent

build: ui backend

test:
	@mkdir -p internal/admin/web/dist/assets
	@touch internal/admin/web/dist/index.html
	go test ./...

test-ci: ui test

dev-ui:
	cd ui && npm run dev

## Demo targets - spin up mock Ollama/vLLM/TGI/llama.cpp nodes + marbor, send real traffic
demo-build: ## Build demo Docker images (mocknode runtimes + marbor)
	docker compose -f demo/docker-compose.yml build

demo: demo-build ## Spin up demo stack (all 4 runtimes), send 20 real requests, show dashboard URL (Docker only, no Go needed)
	@echo "Starting demo stack (mock Ollama x2 + vLLM + TGI + llama.cpp + marbor + Prometheus + Grafana)..."
	docker compose -f demo/docker-compose.yml up -d ollama-node-a ollama-node-b vllm-node tgi-node llamacpp-node marbor prometheus grafana
	@echo "Sending demo traffic (20 requests, runs in Docker - no local Go needed)..."
	docker compose -f demo/docker-compose.yml run --rm demotraffic
	@echo ""
	@echo "Dashboard: http://localhost:8080  (credentials: admin / admin)"
	@echo "Proxy:     http://localhost:11434 (key:   demo-api-key)"
	@echo "Grafana:   http://localhost:3000"

demo-down: ## Stop and remove demo stack
	docker compose -f demo/docker-compose.yml down -v

demo-db: backend ## Regenerate demo/marbor.demo.db (and its inline copy in the standalone compose) from live schema (migrate()) + demo/seed_demo.sql
	rm -f demo/marbor.demo.db.tmp demo/marbor.demo.db.tmp.key
	./marbor -db demo/marbor.demo.db.tmp -seed-node "name=_schema_init,url=http://init,runtime=ollama"
	sqlite3 demo/marbor.demo.db.tmp < demo/seed_demo.sql
	mv demo/marbor.demo.db.tmp demo/marbor.demo.db
	rm -f demo/marbor.demo.db.tmp.key
	bash scripts/sync-demo-compose-db.sh
	@echo "demo/marbor.demo.db and the inline copy in demo/docker-compose.standalone.yml regenerated - review with 'git diff demo/' before committing"

smoke: ## Gate the demo path: build, run, assert auth/routing/streaming/admin/metrics, tear down
	bash scripts/smoke.sh

bench: ## Warm-vs-cold first-token latency benchmark. Pass BENCH_ARGS to override flags.
	## Example: make bench BENCH_ARGS="-endpoint http://localhost:11434 -model llama3 -runs 5"
	go run ./cmd/bench $(BENCH_ARGS)

man: ## Regenerate man pages (docs/man/*.1) + docs/cli.md + README CLI table from the CLI registry
	go run ./cmd/gen-docs

docs: man ## Alias for `make man` - CI's drift check runs the same generator and diffs the result

clean:
	rm -f marbor marbor-agent
	rm -rf internal/admin/web/dist
	rm -rf ui/node_modules