Ontos
Last updated on July 14, 2026

Configuration

Environment variables, Keycloak realm setup, Fuseki named graphs, and Helm values for local and production deployments.

Environment Variables

All configuration is environment-variable driven. Local dev: .env file. Kubernetes: Helm values or Kubernetes Secrets.

VariableRequiredDefaultDescription
ANTHROPIC_API_KEYyes—Anthropic API key for NL→SPARQL and AI mapping.
ONTOS_LLM_MODELnoclaude-sonnet-4-6Claude model ID. Override to use a different model.
FUSEKI_URLnohttp://fuseki:3030Internal Fuseki base URL (docker-compose name).
FUSEKI_DATASETnodsTDB2 dataset name.
KEYCLOAK_URLnohttp://keycloak:8080Keycloak base URL. JWT issuer for resource servers.
KEYCLOAK_REALMnoontosKeycloak realm name.
POSTGRES_URLnojdbc:postgresql://postgres:5432/ontosPlatform Postgres JDBC URL.
POSTGRES_USERnoontosPostgres username.
POSTGRES_PASSWORDnoontosOverride in production.
OPENSEARCH_URLnohttp://opensearch:9200OpenSearch base URL for search indexing.
KAFKA_BOOTSTRAPnokafka:9092Kafka bootstrap server.
GATEWAY_PORTno8082Port the gateway listens on.
RATE_LIMIT_RPSno20Per-user rate limit in requests/second (bucket4j).
WEB_ORIGINnohttp://localhost:5173Allowed CORS origin for the web app.

Keycloak Realm

The realm is auto-imported on first start from deploy/keycloak/realm-ontos.json. It configures:

  • Realm: ontos
  • Client: ontos-web — public PKCE, redirect URIs: http://localhost:5173/*
  • Users: maya (analyst), chen (steward)
  • Realm roles: analyst, steward, admin

Adding a User

bash
TOKEN=$(curl -s -X POST \
  http://localhost:8080/realms/master/protocol/openid-connect/token \
  -d 'grant_type=password&client_id=admin-cli&username=admin&password=admin' \
  | jq -r .access_token)

curl -X POST http://localhost:8080/admin/realms/ontos/users \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "username": "alice",
    "enabled": true,
    "credentials": [{"type":"password","value":"alice","temporary":false}],
    "realmRoles": ["steward"]
  }'

Fuseki TDB2 Configuration

Fuseki runs with a TDB2 persistent dataset at /fuseki/databases/ds inside the container, mounted to ./data/fuseki on the host.

Named Graphs

Graph URIPurposeWriter
urn:ontos:ontologyPublished schema (Turtle)ontology-svc on publish
urn:ontos:dataApproved instance dataingest-svc after steward approval
urn:ontos:stagingUnapproved AI/connector proposalsingest-svc / ai-svc

SPARQL Endpoint

⚠️
Always query through the gateway (:8082), not Fuseki directly (:3030). Direct Fuseki bypasses JWT validation and the policy filter.
bash
# Get a token
TOKEN=$(curl -s -X POST \
  http://localhost:8080/realms/ontos/protocol/openid-connect/token \
  -d 'grant_type=password&client_id=ontos-web&username=maya&password=maya' \
  | jq -r .access_token)

# Query through gateway (auth + policy applied)
curl -X POST http://localhost:8082/api/graph/sparql \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/sparql-query" \
  -d "SELECT ?s ?p ?o WHERE { GRAPH <urn:ontos:data> { ?s ?p ?o } } LIMIT 10"

Helm Values (Kubernetes)

deploy/helm/ontos/values-local.yaml (key overrides)
gateway:
  image: ontos/gateway:local
  env:
    RATE_LIMIT_RPS: "20"
    WEB_ORIGIN: "http://localhost:5173"

graphEngine:
  image: ontos/graph-engine:local

aiSvc:
  image: ontos/ai-svc:local
  # Set at install time: --set aiSvc.anthropicApiKey=sk-ant-...

fuseki:
  persistence:
    size: 5Gi
    storageClass: standard   # kind default

keycloak:
  realmImport: true
  startDev: true             # dev mode; production: false

Rate Limiting

The gateway uses bucket4j for per-user rate limiting. Default: 20 requests/second. Exceeding returns HTTP 429 with Retry-After: 1.

bash
# Verify: at least one 429 after 20 rapid requests
for i in $(seq 1 25); do
  curl -s -o /dev/null -w "%{http_code} " \
    -H "Authorization: Bearer $TOKEN" \
    http://localhost:8082/api/graph/search?q=supplier
done

Next: Admin Guide — user management, ontology publishing, data stewardship.

Was this page helpful?