Implementation:Infiniflow Ragflow Entrypoint And Server
| Knowledge Sources | |
|---|---|
| Domains | DevOps, Backend_Architecture |
| Last Updated | 2026-02-12 06:00 GMT |
Overview
Concrete tool for starting the RAGFlow server and workers provided by the entrypoint script and ragflow_server.py.
Description
docker/entrypoint.sh (273 lines) orchestrates multi-process startup: envsubst, nginx, ragflow_server.py, sync_data_source.py, admin_server.py (optional), task_executor.py workers (with jemalloc), and MCP server (optional). api/ragflow_server.py initializes Flask, calls init_web_db and init_web_data for database schema and seed data, then starts the Quart/Hypercorn server.
Usage
Automatic in Docker. For local dev: bash docker/launch_backend_service.sh.
Code Reference
Source Location
- Repository: ragflow
- File: docker/entrypoint.sh (L1-273), api/ragflow_server.py (L76-157)
Signature
# api/ragflow_server.py
def main():
"""Start the RAGFlow server.
CLI args:
--enable-adminserver
--disable-webserver
--disable-taskexecutor
--disable-datasync
--enable-mcpserver
--workers=N (default 1)
--host-id=STRING
Server config:
HOST_IP: default "0.0.0.0"
HOST_PORT: default 9380
"""
Import
# Entry point script - not importable
# Run: python3 api/ragflow_server.py
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| service_conf.yaml | file | Yes | Generated configuration |
| MySQL connection | service | Yes | Database must be healthy |
Outputs
| Name | Type | Description |
|---|---|---|
| HTTP server | service | Port 9380 (API), 80 (HTTP via nginx) |
| Task workers | processes | Background document processors |
| Admin server | service | Optional, port 9381 |
| MCP server | service | Optional, port 9382 |
Usage Examples
# Docker startup (automatic)
docker compose up -d
docker logs -f ragflow-server
# Local development
source .venv/bin/activate
export PYTHONPATH=$(pwd)
bash docker/launch_backend_service.sh