Streamlit RAG with RedisSearch in Docker Compose¶
Local RAG demo
This example extends the small Streamlit chat demo into a local retrieval-augmented generation stack with file upload, embeddings through LunarGate, Ollama for local models, and RedisSearch for vector retrieval.
Source code: github.com/lunargate-ai/gateway-examples/tree/main/streamlit-rag-redissearch-docker-compose
Use this example when:
- you want a local RAG demo with a browser UI
- you want to upload
.txtand.mdfiles and chat over them - you want a concrete example of chat plus embeddings in one stack
What it demonstrates¶
- Streamlit upload flow for
.txtand.md - chunking local files into retrieval units
- embeddings through LunarGate with local Ollama
- RedisSearch as a local vector store
- chat answers grounded in retrieved chunks
Services in the stack¶
gatewayollamaollama-pull-modelsredisstreamlit-rag
Run it¶
Simple local mode:
Observability mode with the LunarGate Dashboard on app.lunargate.ai:
cp .env.example .env
cp config-observability.yaml.example config.yaml
export LUNARGATE_GATEWAY_API_KEY="lgw_your_gateway_api_key"
docker compose up --build
Create that gateway API key in the Gateways section of app.lunargate.ai.
On the first run, startup can take a while because ollama-pull-models downloads both required models before the Streamlit app starts.
Open:
What to inspect¶
app/app.pyfor chunking, embedding, retrieval, and chat flowdocker-compose.ymlfor the five-service local stackconfig-simple.yaml.examplefor separate chat and embeddings routesconfig-observability.yaml.examplefor request inspection in the LunarGate Dashboard onapp.lunargate.aiplus remote controlgateway.Dockerfilefor the published-image wrapper that bakes in the localconfig.yaml
Files that matter¶
.env.examplefor compose runtime env vars and model namesconfig-simple.yaml.examplefor the smallest working local setupconfig-observability.yaml.examplefordata_sharingand remote controlconfig.yamlfor the file that actually gets baked into the gateway image duringdocker compose build
Why this example matters¶
This is the first example in the docs set that shows both:
POST /v1/embeddingsPOST /v1/chat/completions
working together in one runnable local app.
That makes it the best starting point if you want to prototype semantic search, knowledge-base chat, or small internal copilots without adding an external vector database first.
Important deployment detail¶
The gateway service wraps the published ghcr.io/lunargate-ai/gateway:latest image and copies the example-local config.yaml into it during docker compose build.
That wrapper-image pattern is intentional. It is more reliable than bind-mounting a config file when Docker runs on a remote context instead of directly on your machine.