Deployment¶
Only the first two paths below have been exercised: the local server on a developer machine and the Docker image build in CI. The others are written down but have not been run end to end. Treat them as starting points.
1. Local all-in-one¶
This serves the UI and API on port 7860, with embedded RDF and SQLite.
2. Docker¶
Mount /data to keep the embedded data between runs:
The Container workflow builds this image on every push to main and
publishes it to the GitHub Container Registry of the repository.
3. Docker Compose with Fuseki and Cassandra¶
The Compose stack starts:
- the Black Fox API and UI;
- Apache Jena Fuseki with TDB2;
- Apache Cassandra;
- one-off jobs that load the ontology and apply the CQL migrations.
For a clean rebuild:
The Cassandra adapter reads and writes two of the tables in
cassandra/migrations: metric_samples_by_entity_day and
latest_metrics_by_tenant. The event, observation and configuration history
tables are defined for later work and are not written yet.
4. Static frontend on GitHub Pages¶
The frontend is static and has no build step. The Pages workflow uploads
frontend/ as it is. The workflow is manual, because GitHub Pages is not
available for a private repository on the current plan.
- In the repository settings, set Pages to deploy from GitHub Actions.
- Run the "Deploy GitHub Pages" workflow.
- Open "Backend settings" in the deployed UI and enter the backend URL.
Set the backend CORS_ORIGINS to the Pages origin, for example:
5. Hugging Face Docker Space¶
Generate a minimal Space repository:
Push dist/hf-space/ to a Space configured as Docker. The container listens
on port 7860.
Suggested variables for a public demo:
APP_ENV=huggingface
RDF_BACKEND=embedded
METRIC_BACKEND=sqlite
SQLITE_PATH=/tmp/blackfox.sqlite3
CORS_ORIGINS=https://www.blackfoxgraph.dev,https://YOUR-NAME-blackfox.hf.space
Space storage is not durable. Use external Fuseki and Cassandra for data you need to keep.
6. AWS App Runner¶
The root image runs on App Runner. A Terraform starter is in
infra/aws/apprunner. It has not been applied as part of validation.
The default App Runner configuration is stateless and suits a demo. For durable data:
- deploy Fuseki with TDB2 on ECS or EKS with persistent storage, or use another SPARQL service;
- deploy Cassandra, or adapt the CQL layer for Amazon Keyspaces;
- use VPC connectivity;
- load credentials from Secrets Manager;
- disable public SPARQL or enforce authenticated graph scope;
- put CloudFront, WAF or API Gateway in front where required.
7. Static frontend on S3 and CloudFront¶
Upload the contents of frontend/ to an S3 bucket behind CloudFront. The
browser stores the selected API URL in local storage.
8. Project site¶
https://www.blackfoxgraph.dev is a static site on Vercel. vercel.json builds
it from this repository:
web/index.htmlandweb/assets/are the homepage;- MkDocs builds
docs/intoweb/docs/; frontend/is copied toweb/app/and runs with its bundled sample data.
Build it locally with make site. The generated web/docs/ and web/app/
directories are not committed.
Environment variables¶
See .env.example. The main controls for a deployment: