westworld/.gitea/workflows
Rohit Arora 9e8a9fd6e9
Build & Redeploy to Portainer (local images) / build-and-redeploy (push) Failing after 1m48s Details
feat: add pgvector semantic memory, PgBouncer pooling, and Alembic migrations
pgvector — semantic memory retrieval:
- Postgres Dockerfile builds pgvector v0.7.4 from source (Alpine)
- memories table gains embedding vector(384) column + IVFFlat cosine index
- EmbeddingService: lazy-loads all-MiniLM-L6-v2 (384 dims) via
  sentence-transformers; embed_text() / embed_batch() with graceful
  degradation if model unavailable
- DBManager: asyncpg vector codec registration (text-cast fallback),
  upsert_memory_embedding(), get_semantically_relevant_memories()
  retrieves by cosine similarity rather than importance score

PgBouncer — connection pooling:
- Transaction-mode pooling: 200 max clients → 20 Postgres connections
- Sits between all app services (FastAPI + 4 Celery workers) and Postgres
- DATABASE_URL in .env now routes through westworld-pgbouncer:5432
- Added to docker-compose.yml and CI/CD pipeline (build-deploy.yaml)

Alembic — versioned schema migrations:
- alembic.ini configured for async SQLAlchemy + asyncpg
- env.py uses async_engine_from_config; reads DATABASE_URL from env
- Initial migration 0001_initial_schema.py: creates vector extension,
  all 13 tables (including embedding column), all 14 indexes
- Downgrade drops tables in correct FK dependency order

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 23:20:03 -04:00
..
build-deploy.yaml feat: add pgvector semantic memory, PgBouncer pooling, and Alembic migrations 2026-03-23 23:20:03 -04:00