services: # Database with pgvector for embeddings postgres: image: pgvector/pgvector:pg16 shm_size: 1g user: postgres environment: POSTGRES_DB: email_rag POSTGRES_USER: email_user POSTGRES_PASSWORD: email_pass ports: - "5433:5432" volumes: - postgres_data:/var/lib/postgresql/data - ./services/database/init.sql:/docker-entrypoint-initdb.d/init.sql command: | postgres -c wal_level=logical -c max_wal_senders=10 -c max_replication_slots=5 -c hot_standby=on -c hot_standby_feedback=on healthcheck: test: ["CMD-SHELL", "pg_isready -U email_user -d email_rag"] interval: 5s timeout: 5s retries: 5 restart: unless-stopped # IMAP sync service - lightweight, handles email ingestion only imap-sync: build: ./services/imap-sync environment: DATABASE_URL: postgresql://email_user:email_pass@postgres:5432/email_rag?sslmode=disable EMAIL_STORE_PATH: /var/lib/email-store # User-configurable IMAP settings IMAP_HOST: ${IMAP_HOST:?IMAP_HOST is required} IMAP_PORT: ${IMAP_PORT:-993} IMAP_USER: ${IMAP_USER:?IMAP_USER is required} IMAP_PASS: ${IMAP_PASS:?IMAP_PASS is required} IMAP_TLS: ${IMAP_TLS:-true} SYNC_INTERVAL: ${SYNC_INTERVAL:-300s} LOG_LEVEL: ${LOG_LEVEL:-info} depends_on: postgres: condition: service_healthy volumes: - email_store:/var/lib/email-store restart: unless-stopped volumes: postgres_data: email_store: # Raw email storage for go-imap-sql networks: default: name: email-rag-network