Deploying a Ragflow App
Introduction
Ragflow is an open-source retrieval-augmented generation (RAG) workflow builder that orchestrates document ingestion, vector indexing, and LLM queries. Deploying Ragflow with a Dockerfile on Klutch.sh provides reproducible builds, managed secrets, and persistent storage—all configured from klutch.sh/app. This guide covers installation, Dockerfile setup, environment variables, storage, Nixpacks overrides, and sample API calls.
Prerequisites
- A Klutch.sh account (sign up)
- A GitHub repository containing your Ragflow Dockerfile (GitHub is the only supported git source)
- External Postgres (recommended) and a vector database (e.g., Qdrant) if your setup requires it
- LLM API keys for your providers (store in Klutch.sh secrets)
For onboarding, see the Quick Start.
Architecture and ports
- Ragflow serves HTTP on internal port
3000. Choose HTTP traffic and set the internal port to3000. - Persistent storage is recommended for uploaded documents and cached embeddings; databases remain external.
Repository layout
ragflow/├── Dockerfile # Must be at repo root for auto-detection├── app/ # Ragflow source└── README.mdKeep secrets out of Git; store them in Klutch.sh environment variables.
Installation (local) and starter commands
Build and run locally (ensure Postgres/vector DB are reachable):
docker build -t ragflow-local .docker run -p 3000:3000 \ -e DATABASE_URL=postgres://user:pass@localhost:5432/ragflow \ -e VECTOR_DB_URL=http://localhost:6333 \ -e OPENAI_API_KEY=sk-xxxx \ ragflow-localDockerfile for Ragflow (production-ready)
Place this at the repo root; Klutch.sh auto-detects Dockerfiles.
FROM node:18-alpine AS builderWORKDIR /appCOPY package*.json ./RUN npm ciCOPY . .RUN npm run build
FROM node:18-alpine AS runnerWORKDIR /appENV NODE_ENV=productionENV PORT=3000COPY --from=builder /app/.next ./.nextCOPY --from=builder /app/public ./publicCOPY --from=builder /app/package*.json ./RUN npm ci --omit=devEXPOSE 3000CMD ["npm", "run", "start"]Notes:
— Pin Node to the version Ragflow supports; adjust if upstream changes. — Keep the Dockerfile at the repo root; Docker selection is automatic in Klutch.sh.
Environment variables (Klutch.sh)
Set these before deploying:
PORT=3000DATABASE_URL=postgres://<user>:<password>@<host>:5432/<db>VECTOR_DB_URL=https://<vector-host>(e.g., Qdrant or another vector service)OPENAI_API_KEY=<your-api-key>(or other LLM provider keys)- Optional:
EMBEDDING_MODEL,MAX_CHUNK_SIZE,RAGFLOW_BASE_URL=https://example-app.klutch.sh
If deploying without the Dockerfile and relying on Nixpacks:
NIXPACKS_NODE_VERSION=18NIXPACKS_START_CMD=npm run start
Attach persistent volumes
If you cache documents or embeddings locally, add storage in Klutch.sh (path and size only):
/app/storage— uploaded docs/cache.
Ensure the path matches your Ragflow configuration.
Deploy Ragflow on Klutch.sh (Dockerfile workflow)
- Push your repository—with the Dockerfile at the root—to GitHub.
- Open klutch.sh/app, create a project, and add an app.
- Select HTTP traffic and set the internal port to
3000. - Add the environment variables above (database, vector DB, and LLM API keys).
- Attach a volume at
/app/storageif you need local caching or uploads, sized for your content. - Deploy. Your app will be reachable at
https://example-app.klutch.sh.
Sample API usage
Health check:
curl -I https://example-app.klutch.sh/api/healthExample RAG query (placeholder endpoint, adjust to your API):
curl -X POST https://example-app.klutch.sh/api/rag/query \ -H "Content-Type: application/json" \ -d '{"question":"What is in the docs?","top_k":3}'Health checks and production tips
- Add an HTTP readiness probe to
/api/health(or your chosen health endpoint). - Keep DB, vector DB, and LLM keys in Klutch.sh secrets; rotate regularly.
- Pin Node and dependency versions; test upgrades in staging before production.
- Monitor storage usage on
/app/storageif enabled; resize volumes proactively.
Ragflow on Klutch.sh delivers reproducible Docker builds, managed secrets, and optional storage—without extra YAML or CI steps. Configure ports, env vars, and volumes, then launch your RAG workflows.