Railway

Deploy RAGFlow

Turns your documents into a searchable, citable knowledge base

Deploy RAGFlow

Just deployed

Just deployed

/data

Just deployed

/usr/share/elasticsearch/data

Just deployed

/var/lib/mysql

ragflow-storage

Bucket

Just deployed

RAGFlow logo

Deploy and Host RAGFlow on Railway

RAGFlow is an open-source retrieval-augmented generation engine built around deep document understanding. Instead of splitting a PDF on character counts, it runs layout recognition and OCR over the page first, so tables stay tables, headings stay attached to the text under them, and a scanned invoice or a 200-page manual produces chunks a language model can cite. Teams use it to turn contracts, research libraries, support archives and internal wikis into a knowledge base, then attach a chat assistant or an agent that answers with citations back to the source page.

This template lets you self-host RAGFlow on Railway with every backing service already wired together. The RAGFlow container serves the web interface and API and runs the document task executor. Elasticsearch stores chunks and serves hybrid keyword-plus-vector retrieval. A private text-embeddings-inference service loads BAAI/bge-small-en-v1.5, so the deployment produces real embeddings with no external API key. MySQL holds datasets, documents, users and agents, Redis carries the parsing queue, and a Railway bucket keeps the uploaded files.

Diagram of the RAGFlow, Elasticsearch, embedding, MySQL and Redis services on Railway

Getting Started with RAGFlow on Railway

Open the RAGFlow service's public URL once the deploy is live. Sign in with the email you set in DEFAULT_SUPERUSER_EMAIL and the password Railway generated for DEFAULT_SUPERUSER_PASSWORD, readable on that service's Variables tab. Registration is off, so this account is the only way in until you invite teammates from the Team page. Open the avatar menu and check Model providers → Set default models: the embedding model already reads BAAI/bge-small-en-v1.5, supplied by the bundled service. Add a chat provider key here too — OpenAI, DeepSeek, Anthropic, OpenRouter or any OpenAI-compatible endpoint — since RAGFlow asks for a language model before it opens the dataset dialog.

Now go to Dataset, create one, and drag in a PDF or a few text files. Each row shows a Chunks count once parsing finishes; if it stays at zero, open Logs on that dataset. Then click Retrieval testing, ask a question your documents answer, and press Run. Scored results with hybrid, term and vector similarity mean the path is healthy end to end: object storage, parser, embedding service and Elasticsearch.

RAGFlow dataset listing three parsed text files with chunk counts

Document preview beside the chunks RAGFlow embedded from it

Retrieval test scoring five chunks by hybrid and vector similarity

About Hosting RAGFlow

RAGFlow is a complete RAG platform rather than a library: it ships the ingestion pipeline, the chunk store, a retrieval tuner, a chat builder and a visual agent canvas, so a knowledge assistant needs no orchestration code. Self-hosting matters because the documents are the sensitive part — they stay in your own infrastructure, and only the prompt leaves.

Key capabilities:

  • Layout-aware parsing of PDF, DOCX, PPTX, XLSX, images, HTML and Markdown, with OCR and table recognition
  • Chunk templates per document type — paper, book, laws, manual, resume, table, Q&A
  • Hybrid BM25-plus-vector retrieval, with optional reranking and cross-language search
  • Grounded answers citing the exact chunk and page
  • A visual agent builder, an MCP server, and a REST API with Python and JavaScript SDKs

The template splits the work across five services. RAGFlow serves the UI and API through nginx and runs the task executor that parses documents. Elasticsearch holds every chunk with its vector and answers retrieval queries. tei runs Hugging Face's text-embeddings-inference server, keeping embedding local and free. MySQL stores metadata and Redis queues parsing jobs. The bucket holds original files, streamed back through the app rather than exposed publicly.

Why Deploy RAGFlow on Railway

Railway removes the infrastructure work this stack needs:

  • Elasticsearch, MySQL, Redis, embeddings and object storage provisioned and connected in one deploy
  • Private networking, with only the web interface exposed
  • Persistent volumes for the search index and the model cache
  • Free HTTPS on a generated domain, plus per-service metrics and vertical scaling

Common Use Cases

  • An internal knowledge assistant over policies, runbooks and onboarding material, answering with citations staff can verify
  • Contract and compliance review, where layout-aware parsing keeps clause numbering and tables intact across scanned pages
  • Support deflection grounded in product manuals and past tickets
  • A private research library answering cross-document questions without sending files to a third party

Dependencies for RAGFlow

Environment Variables Reference

VariableServicePurpose
DEFAULT_SUPERUSER_EMAILRAGFlowEmail for the administrator created on first boot
DEFAULT_SUPERUSER_PASSWORDRAGFlowThat administrator's password; change it after signing in
REGISTER_ENABLEDRAGFlow1 opens self-service signup, 0 keeps the instance closed
TEI_MODELRAGFlowEmbedding model; must match MODEL_ID on the tei service
ES_JAVA_OPTSelasticsearchJVM heap for the search index

Deployment Dependencies

Hardware Requirements for Self-Hosting RAGFlow

ResourceMinimumRecommended
CPU4 vCPU across all services8 vCPU or more
RAM8 GB total16 GB, 4 GB for Elasticsearch
Storage5 GB index, 5 GB model cache20 GB+ as the corpus grows
RuntimeDockerDocker

Parsing is the CPU-hungry part: OCR and layout recognition on a large scanned PDF saturates a core for minutes, so raise the RAGFlow service first. Elasticsearch wants headroom above its heap; -Xms2g -Xmx2g suits an 8 GB container.

Self-Hosting RAGFlow with Docker

Upstream ships a Compose stack. Clone the repository and start it with these shell commands:

git clone https://github.com/infiniflow/ragflow.git
cd ragflow/docker
docker compose -f docker-compose.yml up -d

Every service is configured through docker/.env. To point RAGFlow at external backing services instead of the bundled ones, set these there before the first start:

DOC_ENGINE=elasticsearch
ES_HOST=elasticsearch.internal
ELASTIC_PASSWORD=your-elastic-password
MYSQL_HOST=mysql.internal
MYSQL_PASSWORD=your-mysql-password
REDIS_HOST=redis.internal

Storage is chosen with STORAGE_IMPL, which accepts MINIO, AWS_S3, OSS, GCS and the Azure variants; its settings live in docker/service_conf.yaml.template. This template already uses the S3 path against a managed bucket.

How Much Does RAGFlow Cost to Self-Host?

RAGFlow is free and open source under the Apache 2.0 licence, with no seat limits and no paid edition of the server. Self-hosting on Railway costs infrastructure only — roughly a small application plus a search cluster. The one variable expense is the language model, billed by whichever provider key you configure; embeddings are generated locally and cost nothing beyond CPU.

FAQ

What is RAGFlow?

RAGFlow is an open-source retrieval-augmented generation engine from InfiniFlow. It ingests documents, understands their layout, chunks and embeds them, and serves hybrid retrieval with citations.

What does this Railway template deploy?

Five services — RAGFlow, Elasticsearch as the document engine, a text-embeddings-inference server, MySQL and Redis — plus a bucket for uploaded files.

Do I need an OpenAI API key to run self-hosted RAGFlow?

Not to ingest documents: parsing, chunking, embedding and retrieval testing work out of the box, because embeddings come from the bundled service. Chat and agents call a language model, so those need a provider key.

Why does RAGFlow need Elasticsearch, MySQL, Redis and object storage?

Each holds different state. Elasticsearch stores chunks and vectors and does the ranking, MySQL stores datasets, documents, users and agents, Redis queues parsing jobs, and the bucket keeps the originals.

How do I change the embedding model in self-hosted RAGFlow?

Set MODEL_ID on the embedding service and TEI_MODEL on RAGFlow to the same value, then redeploy both. BAAI/bge-m3 and Qwen/Qwen3-Embedding-0.6B are the other built-ins and need much more memory. Datasets parsed under the old model must be re-parsed.

How do I speed up document parsing on Railway?

Raise the RAGFlow service's CPU and memory first, since parsing runs there. For bulk ingestion, add a second service from the same repository with the start command /ragflow/entrypoint-railway.sh --disable-webserver --workers=2; it takes jobs off the same Redis queue.


Template Content

More templates in this category

View Template
Chat Chat
Chat Chat, your own unified chat and search to AI platform.

okisdev
116
View Template
stella
Self-host stella with web, API, Postgres, Redis, and object storage.

Jan Kubica
5
View Template
Hermes Agent | OpenClaw Alternative with Dashboard
Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

codestorm
64