Skip to content

Make SentinelAI runnable locally via Docker Compose (golden path) - #1

Merged
CoreyLeath-code merged 3 commits into
mainfrom
copilot/make-sentinelai-runnable-locally
Apr 2, 2026
Merged

Make SentinelAI runnable locally via Docker Compose (golden path)#1
CoreyLeath-code merged 3 commits into
mainfrom
copilot/make-sentinelai-runnable-locally

Conversation

Copilot AI commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

The repo had no coherent local run story: broken CI filename, incomplete docker-compose.yml (Prometheus/Grafana only, missing services: key), no Dockerfiles for most services, and a README quickstart pointing at directories that didn't exist.

Core: docker compose up --build now starts the full stack

Seven services, wired with healthchecks and depends_on:

Service Lang Port
postgres 5432
ingestion-service Go 8080
drift-engine C++ + Python 7070
llm-guard Python 8000
streamlit-dashboard Python 8501
prometheus 9090
grafana 3000

New files

  • .env.exampleWAREHOUSE_MODE=postgres default; Snowflake vars present but blank for opt-in
  • docker/initdb/01_schema.sql — bootstraps inference_logs, drift_baselines, drift_scores, incidents, incident_summaries on first Postgres start
  • drift-engine/drift_engine.cpp now reads JSON from stdin / emits JSON to stdout; wrapped by a FastAPI server (server.py); multi-stage Dockerfile (GCC → Python slim)
  • ingestion-service/main.go — proper Go module; writes to Postgres when WAREHOUSE_MODE=postgres, logs otherwise; exposes /log, /health, /metrics
  • llm-guard/app.py — calls Ollama for summarization, falls back to rule-based stub if unreachable; writes summaries to incident_summaries
  • streamlit-dashboard/app.py — four-tab UI (inference logs, drift scores, incidents, service health) reading directly from Postgres
  • monitoring/grafana/provisioning/ — Grafana auto-provisions Prometheus datasource on startup
  • .gitignore

Fixes

  • Renamed .github/workflows/ci.yml).github/workflows/ci.yml; replaced stub content with a full pipeline (Compose build, go vet, C++ build, Python lint, pytest)
  • Added permissions: contents: read to CI workflow
  • README quickstart is now cp .env.example .env && docker compose up --build with curl examples

Quick example

cp .env.example .env
docker compose up --build

# ingest a log
curl -X POST http://localhost:8080/log \
  -H "Content-Type: application/json" \
  -d '{"model_id":"demo","latency_ms":120,"status":"ok"}'

# compute drift
curl -X POST http://localhost:7070/drift \
  -H "Content-Type: application/json" \
  -d '{"model_id":"demo","feature_name":"latency","expected":[0.2,0.3,0.25,0.25],"actual":[0.1,0.35,0.30,0.25]}'
Original prompt

Create a pull request to make Trojan3877/SentinelAI runnable locally via Docker Compose as the primary "golden path".

Goals

  1. Running docker compose up --build from repo root should start a coherent local stack:
    • Postgres as the default local warehouse
    • Ingestion service
    • Drift engine service
    • LLM guard service
    • Streamlit dashboard
    • Prometheus + Grafana
  2. Keep Snowflake integration optional (do not require it for local dev). Prefer an explicit env switch like WAREHOUSE_MODE=postgres|snowflake.
  3. Fix obvious repo papercuts that prevent automation / correctness:
    • Rename workflow file .github/workflows/ci.yml) to .github/workflows/ci.yml and ensure the README badge points to the correct workflow file.
    • Ensure README quickstart matches actual repo structure and uses Docker Compose as the recommended path.

Required changes

  • Add .env.example with safe defaults for local mode, including Postgres defaults and placeholders for Snowflake configuration.
  • Replace/upgrade docker-compose.yml so it defines a full stack and is syntactically correct (top-level services: etc.), with sensible ports and healthchecks.
  • Add Postgres initialization SQL under docker/initdb/ (or similar) to create minimal tables needed for local mode; keep schema minimal but practical for:
    • inference logs
    • drift baselines
    • drift scores
    • incidents
    • incident summaries
  • Add minimal Dockerfiles for each service if missing so Compose can build:
    • ingestion-service/ (Go multi-stage)
    • llm-guard/ (Python)
    • streamlit-dashboard/ (Python)
    • drift-engine/ (C++ service). If the drift engine is currently a standalone drift_engine.cpp, move it into a drift-engine/ directory and wrap it with a tiny HTTP server (or comparable) so other services can call it.
  • Add/adjust Prometheus config so it scrapes /metrics from local services.
  • Ensure containers expose /health endpoints (or at least healthchecks) and Compose uses depends_on appropriately.

Documentation

  • Update README.md so the first Quickstart is:
    1. cp .env.example .env
    2. docker compose up --build
    3. URLs for Streamlit/Grafana/Prometheus
    4. A simple curl example to post a sample inference log
  • Update Contributing.md if needed to mention Docker Compose local dev.

CI

  • Fix workflow filename and ensure CI runs at least:
    • Build docker images (or docker compose build)
    • Basic lint/test commands if already present

Notes

  • The repository contains multiple languages (Python, TypeScript, C++, Dockerfile, CSS). Preserve existing structure where possible but prioritize a working Compose-based local path.
  • Keep changes small and incremental; if some services are currently placeholders, provide minimal working stubs so the stack starts cleanly.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: https://github.com/Trojan3877/SentinelAI how can this repo be improved?

Assistant: I’m the GitHub Copilot Chat Assistant. Here are the highest-impact ways to improve Trojan3877/SentinelAI based on what’s currently in the repo (default branch main, latest commit on 2026-03-17).

1) Fix repo “paper cuts” that block automation

  • Rename the workflow file: you currently have .github/workflows/ci.yml) (note the trailing )). That will likely prevent GitHub Actions from running at all, and it also makes your README badge point to a file name that doesn’t exist (ci.yml).
    Action: rename to .github/workflows/ci.yml.
  • Fix README quickstart paths: README says cd drift-engine, but the repo root shows drift_engine.cpp and ingestion_cpp/—not drift-engine/.
    Action: align README commands with actual directories/files.

2) Make it installable/runnable in a predictable way

Right now you have multiple components (Go ingestion, C++ drift engine, Streamlit UI, FastAPI deps, k8s/helm/terraform), but the “one command to run it” story is incomplete.

  • Add a proper docker-compose.yml header: your compose file only defines services (Prometheus/Grafana) and appears to be missing the top-level services: key and version (depending on syntax).
    Action: make docker-compose up work and include core services (ingestion, dashboard, etc.) or rename it to docker-compose.monitoring.yml.
  • Pin Python dependencies: requirements.txt is unpinned (e.g., fastapi, torch, transformers). This will create breakage over time.
    Action: pin versions, or adopt uv/poetry and commit a lockfile.
  • Document runtime prerequisites: you mention Snowflake, SageMaker, Ollama/LangChain, Kubernetes—add an .env.example explaining required env vars and “local mode” defaults.

3) Strengthen CI quality gates (beyond “it builds”)

Your Contributing.md calls out Black + Pytest, but there’s no proof they run end-to-end.

  • CI should run per-language checks:
    • Python: ruff/`black --chec...

This pull request was created from Copilot chat.

Copilot AI and others added 2 commits April 2, 2026 15:03
Copilot AI changed the title [WIP] Add Docker Compose setup for local execution of SentinelAI Make SentinelAI runnable locally via Docker Compose (golden path) Apr 2, 2026
Copilot AI requested a review from CoreyLeath-code April 2, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants