How oscxrojas/rag_environment works
Project Type and Purpose
• This is not a monolithic application but a “playground” environment composed of multiple Docker‐based microservices to support Retrieval-Augmented Generation (RAG) experimentation.
• Purpose: spin up LLM inference (Ollama), vector storage (Qdrant), relational/analytics stores (Postgres, ClickHouse), object store (MinIO), caching (Redis), event tracking (Langfuse worker + web UI), and Jupyter notebooks for interactive demos—all via Docker Compose.
File Structure
• .env-template: holds environment variables for API keys, model names, ports.
• docker-compose.yml: defines the nine services and how they network/connect.
• bootstrap.sh: orchestrates build, cleanup, startup, and model downloading via volumes/ollama/model-downloader.sh.
• requirements.txt: Python deps for Jupyter environment.
• volumes/jupyter/demos: sample notebooks that interact with the services.
• volumes/ollama: persistent store for downloaded Ollama models.
README for Insights
• Outlines startup sequence: Docker removes orphaned containers, builds images, brings up services in order.
• Lists service URLs and ports.
• Emphasizes environment customization via .env.
• Mentions “Langfuse” for event tracking and the model-change workflow.
• Client Tier
• Web Browser → Jupyter UI (port 8888)
• Web Browser → Langfuse Web UI (port 3000)
• Compute/Service Tier (hexagons or rectangles)
• Jupyter Notebook Server (Python kernel, uses requirements.txt)
• Ollama LLM Server
• Langfuse Worker
• Langfuse Web UI
• Qdrant (vector DB)
• Postgres (metadata store)
• ClickHouse (analytics store)
• MinIO (S3-compatible object store)
• Redis (caching or message broker)
• Infrastructure Tier
• Docker Host / Docker Compose Network
• Shared Volumes (for model storage and demo notebooks)
• Jupyter → Ollama: POST requests to /v1/chat/completions for model inference
• Jupyter → Qdrant: upsert/query embeddings via Qdrant HTTP API
• Jupyter → MinIO: PUT/GET for document storage (if demos use it)
• Jupyter → Redis: caching intermediate values (optional)
• Langfuse Worker → Postgres/ClickHouse: write event logs and analytics data
• Langfuse Web UI → ClickHouse/Postgres: read for dashboards
• All containers communicate over the Docker Compose network
• Shared volumes mount at host → containers for persistent data
c. Architectural Patterns & Principles
• Microservices: each major function is a separate container
• Clear separation: UI (Jupyter + Langfuse Web), compute (Ollama, Worker), storage (DBs, object store)
• Environment-as-code: all services and dependencies are declared in docker-compose.yml + .env
• Event-driven logging/analytics: Langfuse captures every interaction for observability
d. Key Technologies & Frameworks
• Docker + Docker Compose for orchestration
• Python/Jupyter for interactive experimentation
• Ollama for local LLM serving
• Qdrant, Postgres, ClickHouse, Redis, MinIO for data persistence
• Langfuse for event tracking and UI dashboards