Skip to content

v0.6.0: bundled Postgres option, isolated test stack, built-in frontend, new branding - #13

Merged
dimknaf merged 5 commits into
mainfrom
feat/internal-postgres
Jun 12, 2026
Merged

v0.6.0: bundled Postgres option, isolated test stack, built-in frontend, new branding#13
dimknaf merged 5 commits into
mainfrom
feat/internal-postgres

Conversation

@dimknaf

@dimknaf dimknaf commented Jun 12, 2026

Copy link
Copy Markdown
Owner

What's in this PR

Bundled internal Postgres — one flag in .env (closes #12)

  • New braindb_db service (pgvector/pg17) guarded by a compose profile. .env.example now ships COMPOSE_PROFILES=internal-db, so a fresh clone gets a working database with plain docker compose up -d — nothing to install.
  • External mode is unchanged: remove the flag and set DATABASE_URL. Existing deployments are untouched — without the flag the bundled service does not exist. Optional knobs for the host port, db name, and credentials.
  • Implemented as a single compose file with a profile switch (rather than a second compose file) so the two modes can't drift. Requires Docker Compose >= 2.20. Thanks @yourpropertyexpert for proposing this in Docker compose file to include a DB #12.

Tests now run on an isolated stack — never your database

  • New docker-compose.test.yml: its own API (port 8002) and its own throwaway Postgres (port 5436) on a private network. up -dpytestdown -v wipes everything.
  • The old session-end cleanup that deleted pattern-matched rows from the configured database is removed entirely. Previously, running the suite against a live stack could leak test entities into real data.
  • Bare pytest without the test stack now fails fast with instructions instead of touching anything.

Frontend served by the stack

  • A frontend service (nginx over the static frontend/ directory) joins docker compose up -d — the read-only browser UI is at http://localhost:8642 right after startup (loopback-only; FRONTEND_PORT to change it). The manual static-server route still works.

Branding

  • BrainDB logo at the top of the README and in the frontend header (plus favicon).
  • Five architecture diagrams embedded in their README sections: the keyword-graph mechanism, the retrieval pipeline, the save/ingest lanes, and the wiki maintainer + writer loops. All SVG with built-in dark backgrounds, so they render identically on GitHub light and dark themes.
  • docs/assets/social-preview.png added for the repo's link-share card.

Verification

  • Full test suite green (148 passed) against the isolated stack; the external personal database verified byte-untouched before/after (identical entity counts, zero test-named leftovers).
  • Both database modes booted end-to-end: a brand-new internal volume (healthcheck → migrations → save/recall) and an existing external database (no new containers, data intact).
  • Frontend live-checked at 8642 (page, logo, and favicon all 200; API health unaffected).

dimknaf added 5 commits June 12, 2026 00:21
New braindb_db service (pgvector/pg17) guarded by the internal-db
compose profile. .env.example ships COMPOSE_PROFILES=internal-db, so a
fresh clone gets a working database with plain `docker compose up -d` -
nothing to install. Without that line the service does not exist and
existing setups run exactly as before: DATABASE_URL keeps pointing at
your own Postgres.

DATABASE_URL defaults to the bundled DSN via nested interpolation; an
explicit value always wins. Optional knobs: POSTGRES_PORT (host
inspection port, loopback-only, default 5435), POSTGRES_DB,
POSTGRES_USER, POSTGRES_PASSWORD. The api waits on the DB healthcheck
via depends_on with required: false, so one compose file serves both
modes. Requires Compose >= 2.20. Closes #12.
…user's

The suite previously ran against the live personal stack at :8000 and
relied on pattern-matched cleanup of what it created; the cleanup
silently failed from the host and test keywords leaked into real data.
Deleting rows from whatever database the user has configured is the
wrong design regardless of pattern.

Now: docker-compose.test.yml runs a self-contained stack (API on 8002,
throwaway Postgres braindb_test on host port 5436, own project
namespace, no watcher/scheduler so tests are deterministic). conftest
defaults to it and fails fast with instructions if it isn't up - bare
pytest can no longer reach a personal database. The session-end
deletion sweep is removed entirely; `down -v` wipes all test data.

Ingest tests write into data_test/ (the test stack's data dir), the
direct-DB graph tests default to the test Postgres and skip with a
clear reason when it is unreachable, and test keywords consistently
use the _pytest_ prefix.
…n header

- New always-on `frontend` service: nginx:alpine over the static frontend/
  directory, published loopback-only at 127.0.0.1:8642 (FRONTEND_PORT knob).
  No build step, no Dockerfile; `docker compose up -d` now includes the
  browser UI with zero manual steps. Loopback is deliberate: the UI calls
  the API at http://localhost:8000 from the browser, so wider publishing
  would not make it usable remotely anyway.
- Logo in the frontend header (replaces the text brand) + SVG favicon.
- frontend/README.md updated: compose is the default route, any static
  server still works.
- Relocated the wiki_scheduler comment block that had ended up stranded
  above braindb_db.
- BrainDB logo (SVG) centered at the top of the README, replacing the
  plain-text H1.
- Five architecture diagrams placed in their sections: keyword-graph
  mechanism (Why BrainDB?), retrieval pipeline (How Retrieval Works),
  save/ingest lanes (File Ingestion), maintainer loop + writer pipeline
  (Autonomous Wiki Maintenance). All self-contained SVGs with explicit
  dark backgrounds, so they render identically on GitHub light and dark
  themes.
- docs/assets/social-preview.png (1280x640): the link-share card for the
  repo. GitHub Settings -> General -> Social preview accepts PNG/JPG only,
  so this is the one raster asset; everything rendered in the repo is SVG.
- Frontend README section: now served by the stack at localhost:8642.
@dimknaf
dimknaf merged commit 7d5cbcb into main Jun 12, 2026
1 check failed
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.

Docker compose file to include a DB

1 participant