Skip to content

Getting started

The default configuration needs no external services. It uses RDFLib for the graph and SQLite for metrics, and loads a sample Kafka estate at startup. The steps below take about five minutes.

Requirements

  • Python 3.11 or newer
  • Git
  • Docker, only for the Fuseki and Cassandra stack

1. Install and run

git clone https://github.com/eoinjordan/blackfox.git
cd blackfox
python -m venv .venv
source .venv/bin/activate        # Windows: .venv\Scripts\activate
pip install -e .
blackfox serve

Open http://localhost:7860. The UI and the API share that origin. Run the commands from the repository root, because the service reads frontend/ and ontology/ from there.

2. Check that it is up

In a second terminal, with the virtual environment active:

blackfox health

On a first start the response reports embedded-rdflib with 298 quads and sqlite with 96 metric samples. The same data is at http://localhost:7860/health.

3. Ask a question

blackfox ask 'What is the blast radius of `orders.v1`?'
blackfox ask "Which consumer groups are falling behind?"
blackfox ask "Are there any problems?"

The router matches keywords and runs one of four fixed operations: topology, topic flow, consumer lag or anomalies. It returns intent, answer and data. A question it does not recognise returns the help intent.

4. Run SPARQL

blackfox sparql --file sparql/blast-radius.rq
blackfox sparql --file sparql/cluster-inventory.rq

The first query follows producer, consumer, dependency and hosting links from orders.v1 and returns five affected resources in the sample data. More queries are on the examples page.

5. Send data

Write endpoints need a signed-in session. For a local trial, stop the server and start it again with the development login enabled:

AUTH_DEV_LOGIN=true AUTH_ALLOWLIST=dev-user blackfox serve

On Windows PowerShell:

$env:AUTH_DEV_LOGIN = "true"; $env:AUTH_ALLOWLIST = "dev-user"; blackfox serve

Then emit synthetic metrics:

python collectors/demo_generator.py --dev-login --count 20 --interval 2

Refresh the UI to see the metrics and anomalies change. The development login issues a session without any check. Never enable it on a server that other people can reach. See authentication for GitHub sign-in.

Full stack with Fuseki and Cassandra

RDF_BACKEND=fuseki METRIC_BACKEND=cassandra docker compose --profile full up --build

The service falls back to its embedded stores if either dependency is unavailable at startup. Set STRICT_EXTERNAL_STORES=true to fail instead. This stack is not covered by the automated tests.

Configuration

Set environment variables or use a .env file. .env.example lists the settings. The main ones:

Variable Default Purpose
RDF_BACKEND embedded embedded or fuseki
METRIC_BACKEND sqlite sqlite or cassandra
CORS_ORIGINS * Comma-separated allowed origins
ENABLE_PUBLIC_SPARQL true Enable the SPARQL endpoint. When false it returns 403 for every caller.
GITHUB_OAUTH_CLIENT_ID unset Enables GitHub sign-in
AUTH_ALLOWLIST unset GitHub usernames allowed to write
AUTH_DEV_LOGIN false Local development login. Never set on a public server.

Next: examples, architecture, authentication.