# Postgres with pgvector + RAG Agent app (from repo git@git.lesha.spb.ru:alex/RagAgent.git). # Clone the repo, then: docker compose up -d # App and DB share network "rag_net"; app uses RAG_DB_DSN with host=postgres. # DB init: scripts in docker/postgres-init/ run on first start (empty volume); to disable, comment out the init volume. services: postgres: image: pgvector/pgvector:pg16 container_name: rag-postgres environment: POSTGRES_USER: ${POSTGRES_USER:-rag} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-rag_secret} POSTGRES_DB: ${POSTGRES_DB:-rag} ports: - "${POSTGRES_PORT:-5432}:5432" volumes: - rag_pgdata:/var/lib/postgresql/data # Init scripts run once on first start (create extension, tables). Optional: comment out to skip. - ./docker/postgres-init:/docker-entrypoint-initdb.d:ro healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-rag} -d ${POSTGRES_DB:-rag}"] interval: 5s timeout: 5s retries: 5 networks: - rag_net app: build: context: . dockerfile: Dockerfile image: rag-agent:latest container_name: rag-agent restart: unless-stopped depends_on: postgres: condition: service_healthy ports: - "${WEBHOOK_PORT:-8000}:8000" environment: RAG_DB_DSN: "postgresql://${POSTGRES_USER:-rag}:${POSTGRES_PASSWORD:-rag_secret}@postgres:5432/${POSTGRES_DB:-rag}" RAG_REPO_PATH: ${RAG_REPO_PATH:-/data} RAG_EMBEDDINGS_DIM: ${RAG_EMBEDDINGS_DIM:-1536} GIGACHAT_CREDENTIALS: ${GIGACHAT_CREDENTIALS:-} GIGACHAT_EMBEDDINGS_MODEL: ${GIGACHAT_EMBEDDINGS_MODEL:-Embeddings} WEBHOOK_SECRET: ${WEBHOOK_SECRET:-} volumes: - ${RAG_REPO_PATH:-./data}:/data entrypoint: ["rag-agent"] command: ["serve", "--host", "0.0.0.0", "--port", "8000"] networks: - rag_net networks: rag_net: driver: bridge volumes: rag_pgdata: