qmd/test/pg-compose.yml
Haitao Pan 47bd3ded44 feat(pg): add switchable PostgreSQL backend + OpenClaw/Hermes memory bridge
Add an optional PostgreSQL backend (QMD_BACKEND=pg) alongside the
unchanged default SQLite path. PG store uses pgvector (HNSW) for vectors
and pg_jieba + pg_trgm for full-text/Chinese tokenization, with a
namespace column isolating multi-agent memory (openclaw/hermes).

- src/pg/: config, db-pg, schema bootstrap, memory store
- MCP memory_add/memory_search/memory_get tools; qmd pg status + memory CLI
- connection via QMD_PG_URL/DATABASE_URL/qmd config, stunnel TLS 5443
- tests: pg-config (unit) + pg-memory integration (gated on QMD_PG_URL) + pg-compose
- docs/plan: plan, usage, test report, changelog; track docs/**/*.md

SQLite path: zero regression (typecheck clean, 249 passed / 6 skipped).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 19:13:04 +08:00

25 lines
836 B
YAML

# Local PostgreSQL for qmd memory-bridge integration tests.
#
# docker compose -f test/pg-compose.yml up -d
# QMD_PG_URL='postgres://postgres:postgres@localhost:5432/postgres' \
# npx vitest run test/pg-memory.integration.test.ts
# docker compose -f test/pg-compose.yml down -v
#
# pgvector/pgvector ships pgvector but NOT pg_jieba, so FTS falls back to the
# 'english' text-search config. For full Chinese tokenization use the
# postgresql.svc.plus image (ghcr.io/x-evor/images/postgresql) which bundles
# pgvector + pg_jieba + pg_trgm.
services:
qmd-pg:
image: pgvector/pgvector:pg16
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 2s
timeout: 5s
retries: 20