
Deploy RAGFlow Gemini
Use Google Gemini chat and embedding models in RAGFlow
Just deployed
/data
Redis
Just deployed
/data
ragflow
Just deployed
/ragflow/logs
MySQL
Just deployed
/var/lib/mysql
Elasticsearch
Just deployed
/usr/share/elasticsearch/data
Deploy and Host self hosted RAGFlow Gemini (Self-Hosted RAG With Google Gemini) on Railway
This template deploys RAGFlow with Elasticsearch, MySQL, Redis, and MinIO. It suits developers and small teams who want Gemini answering questions over their own documents.
About Hosting RAGFlow Gemini open-source software on Railway (self hosted Google Gemini as a model provider in RAGFlow template)
Your documents stay in your own Railway project. Railway generates the secrets on each deploy.
Why Deploy RAGFlow Gemini, the NotebookLM alternative on Railway (Railway Free Trial)
NotebookLM is the easiest way to query your documents, but your files sit on Google's side and you get the experience Google chooses to ship. Railway's $5 trial covers a short test first.
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.
By deploying RAGFlow Gemini on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Railway vs Other Hosting Providers and VPS for RAGFlow Gemini self hosting
RAGFlow runs as five containers, so the hosting choice is about how much of that stack you wire up yourself.
| Provider | What You Get with Railway | What You Get with the Other Provider |
|---|---|---|
| DigitalOcean | All five services in one template with generated secrets. You add your Gemini key in the UI after deploy. | A Droplet where you write the Compose file and set vm.max_map_count yourself. |
| AWS | No VPC or IAM setup to start. | Fine-grained networking and sizing, but you own every part of it. |
| Hetzner | Health checks and redeploys without patching a Linux box. | Low prices and plenty of RAM, if you handle updates and backups. |
Railway is the faster route to a working instance, while a VPS is cheaper and more hands-on.
Common Use Cases for hosted RAGFlow Gemini
- Answering questions over internal PDFs: Upload policy docs, contracts, or manuals, and set a Gemini chat model as the Default LLM so answers cite the exact chunks they came from.
- Choosing gemini-embedding-001 for dataset vectors: Set it as the Default embedding model under Set default models, and keep one embedding model across datasets you plan to query together.
- Switching the default LLM between gemini-2.5-flash and gemini-2.5-pro: Use flash for high-volume lookups where cost matters and pro for harder questions. Changing the chat model does not require reparsing.
- Re-embedding a dataset after changing the embedding model: RAGFlow runs a sample re-embed check and wants an average similarity of at least 0.9. If it fails, remove the chunks and re-parse, or start a new dataset.
- Comparing Gemini against NotebookLM or Vertex AI Search: Run the same document set through each tool and judge which gives better-grounded answers and clearer control over where your files live.
Dependencies for RAGFlow Gemini Docker hosted on Railway
This template runs as five Railway services that depend on each other. Gemini is not wired in at deploy time, so you add the API key in the UI afterward.
Deployment Dependencies for Managed RAGFlow Gemini Service (RAG Engine)
The ragflow service needs Elasticsearch 8.11.3, MySQL 8.4.11 with the rag_flow database, Redis 8.2.10, and MinIO via pgsty/silo. Elasticsearch runs single node with a 1 GB heap.
Implementation Details for RAGFlow Gemini (Using RAGFlow official docker image)
The ragflow service starts with /ragflow/entrypoint.sh --enable-adminserver --init-model-provider-tables and writes logs to /ragflow/logs. Set REGISTER_ENABLED to 0 after that.
How does RAGFlow Gemini compare against other ways to run Gemini-backed RAG on your own servers
Each of these options wins somewhere, so match the tool to the job.
RAGFlow Gemini vs NotebookLM (Google's Research Assistant)
- Hosting and data control: RAGFlow Gemini runs in your Railway project, so documents stay in your own MySQL, Elasticsearch, and MinIO services. NotebookLM is hosted by Google.
- Model choice: You pick the Gemini chat and embedding models in Model providers and can switch between gemini-2.5-flash and gemini-2.5-pro.
- Where NotebookLM wins: Setup is close to zero for a few sources you read yourself.
RAGFlow Gemini vs Dify (LLM App Platform)
- Focus: RAGFlow is built around document understanding, with DeepDoc parsing for PDFs, scans, and tables. Dify is a broader platform for building LLM apps.
- Retrieval depth: RAGFlow combines vector search, full-text search, and reranking, and returns answers with citations.
- Where Dify wins: If you want app and workflow scaffolding beyond document Q&A, Dify covers more ground.
RAGFlow Gemini vs AnythingLLM (All-in-One Document Chat)
- Simplicity: AnythingLLM is MIT-licensed and runs as a desktop app or in Docker, so it is lighter for a quick personal setup.
- Pipeline depth: RAGFlow exposes chunking templates and hybrid search, which helps when a team tunes retrieval over a large knowledge base.
- Where AnythingLLM wins: It runs on a laptop with far less to configure.
RAGFlow Gemini vs Vertex AI Search (Google Cloud Managed Search)
- Managed versus self-hosted: Vertex AI Search is a managed enterprise search service, so you give up infrastructure work and gain Google's scaling.
- Portability: RAGFlow keeps parsing, chunking, and storage in your project and uses Gemini only as the model provider, so you can change providers later.
- Where Vertex AI Search wins: If you already run on Google Cloud and want a fully managed search layer, it removes most of the operations work.
How to use RAGFlow Gemini (the OSS RAG engine)?
Once the stack is running, all setup happens in the RAGFlow web UI. Work through these steps in order, since default models must exist before a dataset can use them.
- Open the public domain of the ragflow service on port 80 after deploy.
- Register an account while REGISTER_ENABLED=1, then set REGISTER_ENABLED to 0 once accounts exist.
- Go to User settings Model providers and select Gemini in Available models (or Google Cloud if your key targets that factory).
- Enter an instance name, paste your Gemini API key into the API Key field, keep the default Base URL, select or add models, then click Verify all models and Save.
- Go to Set default models. Set the Default LLM to a gemini-* chat model such as gemini-2.5-flash, and the Default embedding model to gemini-embedding-001.
- If a model is missing, use Add custom model, match the model ID exactly, and enable Tool calling only when supported.
- Create the dataset and upload documents.
How to self host RAGFlow Gemini on other VPS Services (RAGFlow self hosting guide)
This section covers running the same stack on a plain Linux VPS. You manage the host yourself, and Gemini is added later in the UI under Model providers.
Clone the Repository
Clone the upstream repository and move into the docker folder.
git clone https://github.com/infiniflow/ragflow
cd ragflow/docker
Install Dependencies
Install Docker 24 or newer with the Compose plugin. Elasticsearch needs a higher memory map limit on the host.
sudo sysctl -w vm.max_map_count=262144
Configure Environment Variables
Copy the example env file and set strong passwords for Elasticsearch, MinIO, MySQL, and Redis, plus a long RAGFLOW_SECRET_KEY. Leave your Gemini key out of the file.
cp .env.example .env
nano .env
Start the RAGFlow Gemini Application
Start the stack in the background and confirm the RAGFlow service reports healthy. Railway handles the host, public domain, and health checks for you.
Official Pricing of RAGFlow Gemini (RAGFlow pricing)
RAGFlow itself is open source under the Apache-2.0 license, so there is no license fee to pay for self hosting it.
RAGFlow Gemini cloud vs self hosted comparison (Pricing, features, costs, and more)
Running RAGFlow Gemini yourself splits into two costs: the Railway bill for the stack, and whatever you pay Google for Gemini calls.
Monthly cost of self hosting RAGFlow Gemini on Railway
Expect roughly $40-80 per month on Railway. Large knowledge bases push the number higher. Railway's $5 trial covers a short evaluation, but not a stack this size running around the clock.
System Requirements for Hosting RAGFlow Gemini on a VPS
Upstream RAGFlow lists a minimum of 4 CPU cores, 16 GB RAM, 50 GB disk, and Docker 24+. The host also needs vm.max_map_count set to 262144 for Elasticsearch to start.
Frequently Asked Questions (FAQs)
Do I need to set my Gemini API key as a Railway variable?
No. The template does not take an LLM, embedding, or rerank key as an environment variable.
Why does verification fail after I enter a Gemini key?
The most common cause is a wrong Base URL, so keep the default unless you have a specific reason to change it.
What happens to existing chunks when I change the embedding model?
RAGFlow runs a compatibility check that re-embeds a sample and requires an average similarity of at least 0.9.
Does changing the default LLM require reparsing?
No. Only embedding model changes affect stored vectors, so switching the Default LLM from gemini-2.5-flash to gemini-2.5-pro applies to new answers immediately.
Which Gemini model should I pick for chat versus embeddings?
Use a gemini-* chat model such as gemini-2.5-flash as the Default LLM and gemini-embedding-001 as the Default embedding model. Pick gemini-2.5-pro when answer quality matters more than cost.
How do I add a Gemini model that isn't in the list?
Click Add custom model, enter the model ID exactly as Google publishes it, and select the model type.
Template Content
Redis
redis:8.2.10ragflow
infiniflow/ragflow:v0.27.2MySQL
mysql:8.4.11Elasticsearch
elasticsearch:8.11.3
