Files
Momento/docker-compose.yml
Antigravity 03e6a62b80
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m12s
feat: migrate semantic search to pgvector + full-text search
Replace JSON-string embeddings with native pgvector(1536) storage and
add PostgreSQL full-text search (tsvector/GIN) with Reciprocal Rank Fusion
for hybrid keyword + semantic ranking.

Changes:
- NoteEmbedding.embedding: String → vector(1536) via pgvector
- NoteEmbedding: added updatedAt for reindex tracking
- Note: added tsv (tsvector) with auto-update trigger for FTS
- semantic-search.service: hybrid FTS + vector search with RRF fusion
- embedding.service: toVectorString() for pgvector SQL literals
- Removed JS-side cosine similarity loops (now DB-side via <=>)
- Added HNSW index on NoteEmbedding.embedding (cosine distance)
- Added GIN index on Note.tsv for FTS queries

Schema migration in: prisma/migrations/20260512120000_pgvector_and_fts_search/

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 07:03:56 +00:00

152 lines
4.3 KiB
YAML

services:
# ============================================
# PostgreSQL - Shared Database
# ============================================
postgres:
image: postgres:16-alpine
container_name: memento-postgres
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER:-memento}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-memento}
POSTGRES_DB: ${POSTGRES_DB:-memento}
volumes:
- postgres-data:/var/lib/postgresql/data
ports:
- "127.0.0.1:${POSTGRES_PORT:-5433}:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-memento}"]
interval: 5s
timeout: 5s
retries: 5
networks:
- memento-network
# ============================================
# memento-note - Next.js Web Application
# ============================================
memento-note:
build:
context: ./memento-note
dockerfile: Dockerfile
container_name: memento-web
env_file:
- .env.docker
ports:
- "3000:3000"
environment:
# DATABASE_URL is auto-constructed from PostgreSQL credentials (not in .env.docker)
- DATABASE_URL=postgresql://${POSTGRES_USER:-memento}:${POSTGRES_PASSWORD:-memento}@postgres:5432/${POSTGRES_DB:-memento}
- NODE_ENV=production
- NEXT_TELEMETRY_DISABLED=1
# ADMIN_EMAIL comes from .env.docker via env_file directive above
volumes:
- uploads-data:/app/data/uploads
- backup-data:/app/data/backups
depends_on:
postgres:
condition: service_healthy
restart: unless-stopped
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3000/',r=>process.exit(r.statusCode<500?0:1)).on('error',()=>process.exit(1))"]
interval: 15s
timeout: 10s
retries: 5
start_period: 60s
networks:
- memento-network
deploy:
resources:
limits:
cpus: '2'
memory: 2G
reservations:
cpus: '0.5'
memory: 512M
# ============================================
# mcp-server - MCP Protocol Server
# ============================================
mcp-server:
build:
context: ./mcp-server
dockerfile: Dockerfile
container_name: memento-mcp
env_file:
- .env.docker
ports:
# SSE mode exposes port 3001, stdio mode doesn't need ports
- "3001:3001"
environment:
# DATABASE_URL is auto-constructed from PostgreSQL credentials (not in .env.docker)
- DATABASE_URL=postgresql://${POSTGRES_USER:-memento}:${POSTGRES_PASSWORD:-memento}@postgres:5432/${POSTGRES_DB:-memento}
- NODE_ENV=production
- APP_BASE_URL=http://memento-note:3000
- MCP_MODE=sse
- MCP_REQUIRE_AUTH=true
depends_on:
postgres:
condition: service_healthy
restart: unless-stopped
networks:
- memento-network
deploy:
resources:
limits:
cpus: '1'
memory: 512M
reservations:
cpus: '0.25'
memory: 128M
healthcheck:
test: ["CMD-SHELL", "wget --header \"x-api-key: 1b11f42537c1442456ea413feee75bac\" -q -O /dev/null http://localhost:3001/ || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
# ============================================
# Ollama - Local LLM Provider (Optional)
# ============================================
ollama:
image: ollama/ollama:latest
container_name: memento-ollama
ports:
- "11434:11434"
volumes:
- ollama-data:/root/.ollama
restart: unless-stopped
networks:
- memento-network
deploy:
resources:
limits:
cpus: '4'
memory: 8G
reservations:
cpus: '2'
memory: 4G
# Ollama is optional - only enable if you set AI_PROVIDER_TAGS=ollama
profiles:
- ollama
# ============================================
# Volumes - Data Persistence
# ============================================
volumes:
postgres-data:
driver: local
uploads-data:
driver: local
backup-data:
driver: local
ollama-data:
driver: local
# ============================================
# Networks - Service Communication
# ============================================
networks:
memento-network:
driver: bridge