Skip to content

feat: Docker engine + unified compose + root health route#2

Open
3L0935 wants to merge 2 commits into
jangles-byte:mainfrom
3L0935:feat/docker-engine-and-health-route
Open

feat: Docker engine + unified compose + root health route#2
3L0935 wants to merge 2 commits into
jangles-byte:mainfrom
3L0935:feat/docker-engine-and-health-route

Conversation

@3L0935

@3L0935 3L0935 commented Jul 4, 2026

Copy link
Copy Markdown

Problem

The current install flow requires manually patching 15+ files into an Osiris checkout (integrations/osiris/INSTALL.md). This is fragile:

  • Every Osiris update breaks the patches (page.tsx, globals.css, layout.tsx, OsirisMap.tsx, LayerPanel.tsx, etc.)
  • The overlay adds 15 new files + modifies 6 existing ones
  • No Docker support for the engine — only run-all.sh and a macOS .app wrapper
  • FastAPI has no GET / route, so load balancers and service monitors (Docker healthcheck, k8s probes, Hermes Hub) get 404

Solution

Three additions, zero breaking changes:

1. Dockerfile for the engine

Multi-stage Python 3.13 Alpine build (~80MB final image). Uses uv for fast dependency resolution. The engine talks to Osiris via HTTP — no frontend overlay needed.

2. docker-compose.yml

Unified stack: Osiris (GHCR prebuilt image) + Pythia engine (local build). Docker internal network so Pythia reaches Osiris at http://osiris:3000. All config via environment variables with sensible defaults. Single docker compose up -d to start the full agent API.

3. Root health route (GET /)

FastAPI returns 404 on / by default. Added a lightweight root route returning {"status":"ok","service":"pythia-oracle"} so Docker healthchecks, k8s probes, and service dashboards work out of the box.

Also added .dockerignore to keep the image lean.

How to test

git clone https://github.com/jangles-byte/Pythia && cd Pythia
git checkout feat/docker-engine-and-health-route
docker compose up -d
# Wait ~40s for Osiris cold start + Pythia boot
curl http://localhost:8088/agent/view | jq ".event_count"
# → 200+
curl http://localhost:8088/
# → {"status":"ok","service":"pythia-oracle"}

What this does NOT change

  • The existing run-all.sh / PYTHIA.app / overlay install still work
  • No Python dependency changes
  • No API contract changes
  • The docker-compose.yml uses the GHCR prebuilt Osiris image (falls back to local build if unavailable)

Why this matters

This makes Pythia usable as a headless agent API — no globe UI needed. Agents (Hermes, Claude, custom) get the full world view via GET /agent/view with zero frontend setup. The compose file is also a foundation for future improvements (adding Ollama as a compose service, healthcheck definitions, etc.).

3L0935 added 2 commits July 4, 2026 19:01
Three changes to make Pythia self-hostable without fragile frontend patches:

1. **Dockerfile for the engine** — multi-stage Python 3.13 Alpine build
   (~80MB final image). Uses uv for fast dependency resolution.
   No Osiris overlay needed — the engine talks to Osiris via HTTP.

2. **docker-compose.yml** — unified stack: Osiris (GHCR prebuilt) +
   Pythia engine (local build). Docker internal network so Pythia
   reaches Osiris at http://osiris:3000. All config via env vars
   with sensible defaults. Single 'docker compose up -d' to start.

3. **Root health route (GET /)** — FastAPI returns 404 on / by default,
   which breaks load balancers, service monitors (Docker healthcheck,
   Hermes Hub, k8s probes). Added a lightweight root route returning
   {"status":"ok","service":"pythia-oracle"}.

Also added .dockerignore to keep the image lean.

Why: the current install requires manually patching 15+ files into an
Osiris checkout. This compose file gives you the full agent API
(/agent/view, /agent/events, /predictions, /chat, /state/stream)
with zero frontend patches — just docker compose up.
…condition, .dockerignore coverage

Follow-up improvements to the Docker engine PR:

Dockerfile:
- Split pip install uv from uv sync for better layer caching
- Add --no-cache-dir to pip install to keep builder lean
- Add HEALTHCHECK using the root route (GET /)
- Add PYTHONUNBUFFERED=1 and PYTHIA_ROOT env vars
- Named runtime stage for clarity

docker-compose.yml:
- Add healthcheck on osiris service (wget /api/health)
- depends_on now uses condition: service_healthy
- Fix LLM_BASE_URL default: localhost is unreachable from a container;
  use host.docker.internal instead (with extra_hosts mapping)
- Add extra_hosts to pythia service for host.docker.internal on Linux

.dockerignore:
- Add .github, .env.example, demo.mp4, .gitignore, .dockerignore,
  docker-compose.yml
- Use *.md glob instead of enumerating README.md + CONTRIBUTING.md

engine/server.py:
- Root route now includes app.version for debugging
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.

1 participant