Deploy RAGFlow Document RAG Stack
RAGFlow document RAG with Elasticsearch, MySQL, MinIO and Valkey
Elasticsearch
Just deployed
MySQL
Just deployed
Just deployed
RAGFlow
Just deployed
Redis
Just deployed
Deploy and Host RAGFlow on Railway
RAGFlow is an open source RAG engine built around deep document understanding. Instead of splitting PDFs on newlines, it runs OCR, layout analysis and table structure recognition over your files, chunks them with a method you choose per knowledge base, and answers questions with citations back to the exact page and block. It also ships an agent builder, a team workspace and a full HTTP API.
About Hosting RAGFlow
Self-hosting RAGFlow means running five containers, not one. The application container holds nginx, the Python API, the admin server and a document task executor. Around it sit MySQL for metadata, Elasticsearch as the document engine that stores chunks and vectors, MinIO for the uploaded files, and Valkey for the task queue. This template deploys all five, wires them over Railway's private network, generates every password, and puts the application behind a public domain with a health check that only passes when all four backing services answer.
Two upstream pieces are deliberately left out because Railway cannot host them: the code sandbox, which needs privileged Docker in Docker, and the bundled embedding server, whose default model wants about 25 GB of RAM. Bring your own model provider instead, which is the normal production setup anyway.
Budget for it: roughly 4 to 6 GB of memory at idle and 8 to 10 GB while documents are parsing, running continuously.
Common Use Cases
- Chat with your documents: upload contracts, manuals, papers or reports and get answers with citations
- Knowledge base for a support team: one workspace, many datasets, per team permissions
- RAG API behind your own app: mint an API key and call the retrieval and chat endpoints
- Agents over private data: build a flow that retrieves, reasons and calls tools
- Parsing hard documents: scanned PDFs, multi column layouts and tables, handled by the bundled DeepDoc models
Dependencies for RAGFlow Hosting
- MySQL 8.0: users, tenants, knowledge bases, documents, agents, API tokens (included)
- Elasticsearch 8: chunks, BM25 indexes and dense vectors (included)
- MinIO: object storage for uploaded files (included)
- Valkey: task queue, locks and cache (included)
- An LLM provider: not needed to boot or to log in, but a chat model and an embedding model must be added in the UI before any document can be parsed or queried. OpenAI, DeepSeek, Anthropic, Ollama, a LiteLLM gateway and many others are supported.
Deployment Dependencies
First steps after deploy
- Wait for the RAGFlow service to go green. First boot creates the schema, runs migrations and bootstraps the admin account, so give it several minutes; the image is also about 4 GB to pull.
- Copy
ADMIN_DEFAULT_PASSWORDfrom the RAGFlow service variables. - Open the public domain and log in as
admin@ragflow.iowith that password, then change it. - Add a chat model and an embedding model under Settings, then Model providers.
- Create a knowledge base, upload a file, press Parse, and start chatting.
Self-service signup is closed by default (REGISTER_ENABLED=0) so a public URL does not become an open account factory. Invite teammates from the team settings, or flip the variable to 1 while they register and back to 0 afterwards.
Implementation Details
The application renders its whole configuration file from environment variables at boot, so nothing has to be mounted. The template pins API_PROXY_SCHEME=python (the upstream default), which is why the Go path services NATS, Kvrocks and ClickHouse are not part of the stack.
PORT=80
DOC_ENGINE=elasticsearch
DB_TYPE=mysql
API_PROXY_SCHEME=python
STORAGE_IMPL=MINIO
ADMIN_DEFAULT_PASSWORD=${{secret(32)}}
RAGFLOW_SECRET_KEY=${{secret(64)}}
REGISTER_ENABLED=0
MYSQL_HOST=${{MySQL.RAILWAY_PRIVATE_DOMAIN}}
ES_HOST=${{Elasticsearch.RAILWAY_PRIVATE_DOMAIN}}
MINIO_HOST=${{MinIO.RAILWAY_PRIVATE_DOMAIN}}
REDIS_HOST=${{Redis.RAILWAY_PRIVATE_DOMAIN}}
Health check: GET /api/v1/system/healthz, which reports MySQL, Valkey, Elasticsearch and MinIO individually and fails the deploy if any of them is unreachable.
Why Deploy RAGFlow on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
RAGFlow is a five service stack, and wiring it by hand means standing up MySQL, Elasticsearch, MinIO and Valkey, generating credentials for each, and making sure the app finds all four before it starts. This template does that in one deploy: every dependency runs on Railway's private network, every password is generated per deployment, the bootstrap admin account is created with a generated password instead of the upstream default, self-service signup is off, and the volumes for the index, the object store and the database are already in place. You get managed SSL and a public URL for the UI, and nothing else is exposed to the internet.
Template Content
Elasticsearch
elasticsearch:8.11.3MySQL
mysql:8.0.40RAGFlow
infiniflow/ragflow:v0.27.2Redis
valkey/valkey:8.1.4