ragflow-runbook Skill
A practical runbook for deploying, operating, troubleshooting, and calling RAGFlow (Retrieval-Augmented Generation).
Goal: any agent should be able to bring RAGFlow up, diagnose failures, and call the API safely even without knowing the deployment details up front.
1) When To Use
- - Deploy RAGFlow (Docker / Windows / Linux / WSL2).
- Troubleshoot failures: startup issues, unhealthy backend services, port conflicts, performance problems.
- Use the API for operations purposes: validate liveness/readiness, verify auth, and check system endpoints.
- Run health checks, automate smoke tests, or prepare backup/restore.
2) What The Agent Must Ask First (Minimum Inputs)
Before running any commands, confirm the following (missing any of these often leads to wrong assumptions):
- - Deployment environment: INLINECODE0
- Install directory (the directory that contains
docker-compose.yml) - Access method:
-
RAGFLOW_BASE_URL (e.g.
http://localhost:9380 or an internal/Tailscale address)
- Whether there is an Nginx/reverse proxy in front (and whether Web UI uses port 80/8080)
- - Whether an API key already exists (do NOT paste secrets into chat; use env vars / secret manager)
- Current symptom:
- "does not start" vs "starts but UI/API errors" vs "retrieval quality is poor"
Security: never store or share API keys / DB passwords in plaintext (docs, repo, or chat).
3) Canonical Environment Variables (Recommended)
Use environment variables so all agents can run the same commands:
- -
RAGFLOW_BASE_URL: prefer an internal/Tailscale URL, e.g. INLINECODE5 - INLINECODE6 : Bearer token (created in the RAGFlow Web UI)
Quick verification (separate liveness / readiness / auth; tolerate path differences across versions):
- - Liveness (usually no auth; try in order, any 200 is OK):
-
GET $RAGFLOW_BASE_URL/openapi.json
-
GET $RAGFLOW_BASE_URL/api/v1/openapi.json
-
GET $RAGFLOW_BASE_URL/v1/system/ping
- - Readiness (often requires auth; try in order):
-
GET $RAGFLOW_BASE_URL/v1/system/status
- INLINECODE11
If these do not match your deployment: treat the returned openapi.json as the source of truth.
This skill ships with its own ops helpers under scripts/:
- -
scripts/ragflow_ping.py: liveness + readiness - INLINECODE15 : auth + API smoke (system-level only)
- INLINECODE16 : compact status summary
- INLINECODE17 : send an ops alert via OpenClaw messaging
This skill is intentionally decoupled from any workspace-specific application content. It focuses only on RAGFlow runtime operations.
4) Bootstrap (Fresh Install; Windows/WSL2 + Linux)
This section targets a brand-new machine. Goal: get to a working UI + API quickly:
clone upstream docker bundle -> start -> create API key in UI -> validate via curl/scripts.
4.1 Choose Install Mode (Default)
- - Primary path (best for most desktop / Windows users): Windows + WSL2
- Alternate path: a Linux server (Ubuntu/Debian/CentOS/etc.)
4.1.1 Fresh Install: Copy/Paste (WSL2 / Linux)
WSL2 (recommended: store files on a Windows drive like D:; run commands inside WSL2):
CODEBLOCK0
Linux:
CODEBLOCK1
Next: open Web UI (default http://<host>:80), finish initialization, create an API key, then validate using ## 3 + ## 8.
4.2 Get The Official Docker Compose Bundle (Robust; Verified Against Upstream)
To avoid missing files or mismatched versions, use git clone and run from the upstream docker/ directory:
CODEBLOCK2
The upstream docker/ folder typically includes:
- -
docker-compose.yml (often include: ./docker-compose-base.yml) - INLINECODE27 (backend services: database + cache + object storage + document engine)
- INLINECODE28 (default ports/passwords; change for production)
- INLINECODE29 (used to generate
service_conf.yaml at container startup) - INLINECODE31 (commonly started with flags like
--enable-adminserver / --enable-mcpserver) - INLINECODE34 (for built-in Web UI / reverse proxy)
- INLINECODE35 (docker-specific docs)
Note: upstream explicitly warns that some compose variants (e.g. docker-compose-macos.yml) are not actively maintained. Do not use them unless you know why.
4.3 First Bring-Up (Upstream COMPOSE_PROFILES)
Upstream .env defaults:
- -
COMPOSE_PROFILES is derived from selected backend profiles (e.g. document engine + compute device)
So you typically do not need to pass --profile manually. docker compose up -d will pick profiles from .env.
Before starting (Linux/WSL2, for some document engine profiles):
CODEBLOCK3
Start:
CODEBLOCK4
Switch CPU/GPU (examples):
CODEBLOCK5
Enable embeddings service (TEI): upstream suggests adding a tei profile to COMPOSE_PROFILES:
CODEBLOCK6
Validation: wait for key services to be running/healthy in docker compose ps, then run liveness/readiness (## 3) and API prefix detection (## 8).
4.4 First-Time Setup Checklist (Aligned With Upstream .env)
In upstream docker/.env (main branch), exposed ports typically mean:
- - Web UI / WebServer:
SVR_WEB_HTTP_PORT (default 80), SVR_WEB_HTTPS_PORT (default 443) - API (RAGFlow HTTP):
SVR_HTTP_PORT (default 9380) - Admin Server:
ADMIN_SVR_HTTP_PORT (default 9381) - MCP:
SVR_MCP_PORT (default 9382)
Shortest path to a usable setup:
1) Open Web UI: http://<host>:${SVR_WEB_HTTP_PORT} (default http://<host>:80)
2) Complete initialization (admin/org setup depending on version)
3) Create an API key (usually under Settings/System/API Keys)
4) Set on the client side (recommended env vars):
- -
RAGFLOW_BASE_URL=http://<host>:${SVR_HTTP_PORT} (default http://<host>:9380) - INLINECODE56 (Bearer token; do not paste secrets into chat)
Then validate with liveness/readiness in ## 3.
Production warning: upstream .env explicitly warns against using default passwords. At minimum change ELASTIC_PASSWORD, MYSQL_PASSWORD, MINIO_PASSWORD, and REDIS_PASSWORD.
5) Quick Start (Ops Checklist)
5.1 Prerequisites
- - Docker Engine + Docker Compose v2 (
docker compose ...) - Resources (rule of thumb):
- CPU >= 4 cores, RAM >= 16GB (32GB recommended)
- Disk >= 50GB (depends on document volume + vector index size)
- - Linux/WSL2:
vm.max_map_count >= 262144 (required by some document engine profiles)
Checks:
CODEBLOCK7
Temporary fix (Linux/WSL2):
CODEBLOCK8
5.2 Bring-Up (Docker Compose)
Prereq: you are in the directory that contains docker-compose.yml.
CODEBLOCK9
Tail logs:
CODEBLOCK10
6) Service Management (Day-2 Operations)
CODEBLOCK11
Note: service names differ across compose versions. If you see "no such service", run docker compose ps and use the actual service name.
7) Health Checks (Common Root Causes)
7.1 Document engine unhealthy / crash loop
Common causes: vm.max_map_count too small, low RAM, disk full.
CODEBLOCK12
7.2 Database connection failures
CODEBLOCK13
7.3 Port conflicts
- - Symptom: containers fail to start or port mapping fails.
- Fix: find the process using the port, or change port mappings in
.env / compose and restart.
8) API Usage (Agent-Safe Patterns)
8.1 Base URL + Auth
RAGFlow often exposes:
- - Web UI (port 80/8080)
- API (commonly 9380, or a reverse-proxied path)
Recommended convention:
- -
RAGFLOW_BASE_URL points to the API root, e.g. INLINECODE70 - Auth header: INLINECODE71
8.2 Minimal curl examples (Prefix Auto-Detect; Prefer v1)
Across versions/deployments, RAGFlow may have two API prefixes:
- -
v1/... (often system/user/token) - INLINECODE74 (often application endpoints)
Use this template to auto-detect the prefix (prefer v1, fallback to api/v1).
CODEBLOCK14
Ops-only examples (no application-level endpoints):
Example 1: system ping (no secrets in output)
CODEBLOCK15
Example 2: system status (auth)
CODEBLOCK16
Example 3: fetch openapi schema (liveness)
CODEBLOCK17
Note: If your deployment uses different paths, openapi.json is the source of truth. Avoid calling application-level endpoints from ops runbooks.
8.3 Agent Guidance
- - Always fetch
openapi.json first to confirm real paths/fields/version differences. - If you get 404: suspect base URL (hitting UI port), reverse proxy misconfig, or a different path prefix.
- If you get 401/403: suspect missing/expired key or missing
Bearer prefix.
9) Backup / Restore (Practical)
Principle: stop services first, then back up volumes, then back up compose configs.
Backup (example; volume names depend on your environment):
CODEBLOCK18
Restore:
CODEBLOCK19
10) Security Baseline (Minimum)
- - Do not use
latest in production; pin image versions. - API keys must be stored in env vars / secret manager only.
- Minimize exposure: allow only internal/Tailscale ranges to access API ports.
- If public access is required: add TLS + auth at reverse proxy, and restrict source IP ranges.
11) Troubleshooting Flow (Agent Playbook)
When a user says "RAGFlow is not working", use this order to reduce back-and-forth:
1) docker compose ps (which containers are unhealthy/exited)
2) docker compose logs --tail=200 <unhealthy-service> (capture the first actionable errors)
3) Resources: docker stats, disk, vm.max_map_count (Linux/WSL2)
4) Network: from the caller machine curl $RAGFLOW_BASE_URL/openapi.json
5) Auth: ragflow_ping.py or GET /v1/system/status (with Bearer)
12) OpenClaw Ops Integration
This section documents an end-to-end operations workflow for running RAGFlow with OpenClaw.
It is intentionally decoupled from any application-layer usage and focuses only on RAGFlow runtime operations.
12.1 Scope
Included:
- - Host/service health verification (liveness/readiness)
- Basic auth verification (API key works)
- Smoke checks (API reachable, key endpoints respond)
- Alerting hooks (what to check, what to report)
- Scheduling (daily/periodic checks)
Excluded (by design):
- - Any application-layer conventions
- Content parsing/chunking/index strategy
- Retrieval quality evaluation
12.2 Standard Environment Contract
On the machine running OpenClaw, set:
- -
RAGFLOW_BASE_URL (prefer an internal/Tailscale address) - INLINECODE89 (Bearer token; never commit; do not paste into chat)
Recommended ops endpoints:
- - Liveness (no auth): INLINECODE90
- Readiness (auth): INLINECODE91
If paths differ in your deployment, use openapi.json as the source of truth.
12.3 Local Workspace Helpers (Preferred)
This skill includes built-in helpers under scripts/.
They are designed to be:
- - non-interactive
- safe to run repeatedly
- machine-readable (short output + non-zero exit code on failure)
Helpers:
- Purpose: liveness + readiness checks.
- Purpose: auth verification + minimal API smoke calls.
- Note: it only uses system endpoints. It does not depend on any application-level data.
- Purpose: fetch
/v1/system/status and print a compact key summary.
- Purpose: send an ops alert to Telegram via the
openclaw message send CLI.
(Prefer the skill-local scripts so the runbook works in any environment.)
12.3.1 Script Contracts (Inputs / Outputs / Exit Codes)
INLINECODE100
-
RAGFLOW_BASE_URL
-
RAGFLOW_API_KEY (if set, readiness check is performed)
-
GET {base_url}/openapi.json (no auth)
-
GET {base_url}/v1/system/status (Bearer auth)
-
OK_LIVE (no api key set)
-
OK_READY keys=...
-
LIVENESS_FAIL ...
-
READINESS_FAIL ...
-
0 OK
-
2 liveness failed
-
3 readiness failed
INLINECODE112
-
RAGFLOW_BASE_URL
-
RAGFLOW_API_KEY
-
GET {base_url}/v1/system/status (auth)
-
GET {base_url}/v1/system/ping (auth or no-auth depending on deployment)
-
OK smoke
-
FAIL system/status ...
-
FAIL system/ping ...
-
0 OK
-
2 system/status failed
-
3 system/ping failed
INLINECODE123
-
RAGFLOW_BASE_URL
-
RAGFLOW_API_KEY
-
GET {base_url}/v1/system/status
-
OK keys=key1,key2,... (compact, no secrets)
-
0 OK
-
2 HTTP failure
-
3 invalid JSON
INLINECODE131
- - Purpose: notify humans when ping/smoke fails.
- Inputs:
- CLI flags:
--title (required),
--details (optional)
- Optional env:
OPENCLAW_PRIMARY_CHAT_ID (default target)
- Sends a Telegram message via
openclaw message send ....
- Do not include secrets in
--details.
12.4 Ops Workflow (Suggested)
1) Connectivity
- Confirm OpenClaw host can reach RAGFLOW_BASE_URL over the network.
2) Liveness
- Check openapi.json responds with HTTP 200.
3) Readiness
- Check v1/system/status responds with HTTP 200 when authenticated.
4) Smoke
- Run the skill-local smoke helper: scripts/ragflow_smoke.py (system endpoints only).
5) Escalation artifacts
- Collect:
- docker compose ps
- docker compose logs --tail=200 <ragflow-service>
- the exact endpoint + HTTP code observed from the OpenClaw side
12.5 Scheduling (Copy/Paste Examples)
Goal: provide copy/paste recipes. An agent can create these tasks when needed.
12.5.1 cron (Linux)
Ping every 10 minutes and alert on failure:
CODEBLOCK20
Smoke once per day at 06:05 and alert on failure:
CODEBLOCK21
Notes:
- - Replace
/path/to/skills/... with the real absolute path. - Prefer sourcing secrets from a root-owned env file, or use your secret manager. Avoid putting API keys directly into crontab.
12.5.2 launchd (macOS)
Create two plist files (one for ping, one for smoke) and load them with launchctl.
Ping (every 10 minutes):
CODEBLOCK22
Smoke (daily at 06:05):
CODEBLOCK23
Notes:
- - Replace
/ABS/PATH/... with the real absolute path. - Prefer storing secrets outside the plist and injecting them safely; do not commit plists with secrets.
12.6 Security Notes
- - Do not expose
SVR_HTTP_PORT to the public internet. - Prefer allowlisting internal/Tailscale ranges.
- Store
RAGFLOW_API_KEY in env/secret manager only.
References
- - RAGFlow Docs: https://ragflow.io/docs/
- GitHub: https://github.com/infiniflow/ragflow
ragflow-runbook 技能
一份实用的操作手册,用于部署、运维、故障排查和调用 RAGFlow(检索增强生成)。
目标:任何智能体都应能够启动 RAGFlow、诊断故障并安全调用 API,即使事先不了解部署细节。
1) 使用场景
- - 部署 RAGFlow(Docker / Windows / Linux / WSL2)。
- 故障排查:启动问题、后端服务不健康、端口冲突、性能问题。
- 使用 API 进行运维操作:验证存活/就绪状态、验证认证、检查系统端点。
- 运行健康检查、自动化冒烟测试,或准备备份/恢复。
2) 智能体必须首先询问的内容(最低输入要求)
在执行任何命令之前,请确认以下信息(缺少任何一项都可能导致错误的假设):
- - 部署环境:Windows / WSL2 / Linux / macOS(仅客户端)
- 安装目录(包含 docker-compose.yml 的目录)
- 访问方式:
- RAGFLOW
BASEURL(例如 http://localhost:9380 或内部/Tailscale 地址)
- 前端是否有 Nginx/反向代理(以及 Web UI 是否使用 80/8080 端口)
- - 是否已存在 API 密钥(请勿将密钥粘贴到聊天中;使用环境变量/密钥管理器)
- 当前症状:
- 无法启动 vs 启动但 UI/API 报错 vs 检索质量差
安全:切勿以明文形式(文档、仓库或聊天中)存储或共享 API 密钥/数据库密码。
3) 规范环境变量(推荐)
使用环境变量,以便所有智能体都能运行相同的命令:
- - RAGFLOWBASEURL:优先使用内部/Tailscale URL,例如 http://100.x.y.z:9380
- RAGFLOWAPIKEY:Bearer 令牌(在 RAGFlow Web UI 中创建)
快速验证(区分存活/就绪/认证;容忍不同版本间的路径差异):
- - 存活检查(通常无需认证;按顺序尝试,任何 200 响应均可):
- GET $RAGFLOW
BASEURL/openapi.json
- GET $RAGFLOW
BASEURL/api/v1/openapi.json
- GET $RAGFLOW
BASEURL/v1/system/ping
- GET $RAGFLOW
BASEURL/v1/system/status
- GET $RAGFLOW
BASEURL/v1/system/ping
如果这些与您的部署不匹配:请将返回的 openapi.json 视为权威来源。
此技能在 scripts/ 目录下附带了自己的运维辅助脚本:
- - scripts/ragflowping.py:存活 + 就绪检查
- scripts/ragflowsmoke.py:认证 + API 冒烟测试(仅系统级别)
- scripts/ragflowstatus.py:紧凑的状态摘要
- scripts/ragflowalert.py:通过 OpenClaw 消息发送运维告警
此技能特意与任何特定工作区的应用程序内容解耦。它只关注 RAGFlow 运行时操作。
4) 引导安装(全新安装;Windows/WSL2 + Linux)
本节针对全新的机器。目标:快速获得可用的 UI + API:
克隆上游 Docker 包 -> 启动 -> 在 UI 中创建 API 密钥 -> 通过 curl/脚本验证。
4.1 选择安装模式(默认)
- - 主要路径(最适合大多数桌面/Windows 用户):Windows + WSL2
- 备选路径:Linux 服务器(Ubuntu/Debian/CentOS 等)
4.1.1 全新安装:复制/粘贴(WSL2 / Linux)
WSL2(建议:将文件存储在 Windows 驱动器上,如 D:;在 WSL2 内运行命令):
bash
WSL2
cd /mnt/d
git clone https://github.com/infiniflow/ragflow.git
cd ragflow/docker
某些文档引擎配置的常见要求
sudo sysctl -w vm.max
mapcount=262144 || true
默认 .env = elasticsearch + cpu
要更改端口/密码/镜像版本:编辑 docker/.env
docker compose up -d
docker compose ps
Linux:
bash
Linux
sudo mkdir -p /opt && cd /opt
sudo chown -R $USER /opt
git clone https://github.com/infiniflow/ragflow.git
cd ragflow/docker
sudo sysctl -w vm.maxmapcount=262144 || true
docker compose up -d
docker compose ps
下一步:打开 Web UI(默认 http://<主机>:80),完成初始化,创建 API 密钥,然后使用 ## 3 + ## 8 进行验证。
4.2 获取官方 Docker Compose 包(稳健;已验证与上游一致)
为避免缺少文件或版本不匹配,请使用 git clone 并从上游的 docker/ 目录运行:
bash
git clone https://github.com/infiniflow/ragflow.git
cd ragflow/docker
可选:为生产环境固定到特定标签/提交
git checkout <标签或提交>
上游的 docker/ 文件夹通常包含:
- - docker-compose.yml(通常 include: ./docker-compose-base.yml)
- docker-compose-base.yml(后端服务:数据库 + 缓存 + 对象存储 + 文档引擎)
- .env(默认端口/密码;生产环境请更改)
- serviceconf.yaml.template(用于在容器启动时生成 serviceconf.yaml)
- entrypoint.sh(通常以 --enable-adminserver / --enable-mcpserver 等标志启动)
- nginx/(用于内置 Web UI / 反向代理)
- README.md(Docker 相关文档)
注意:上游明确警告某些 compose 变体(例如 docker-compose-macos.yml)未积极维护。除非您了解原因,否则不要使用它们。
4.3 首次启动(上游 COMPOSE_PROFILES)
上游 .env 默认值:
- - COMPOSE_PROFILES 源自选定的后端配置文件(例如文档引擎 + 计算设备)
因此,您通常不需要手动传递 --profile。docker compose up -d 将从 .env 中选择配置文件。
启动前(Linux/WSL2,针对某些文档引擎配置文件):
bash
cat /proc/sys/vm/maxmapcount || true
sudo sysctl -w vm.maxmapcount=262144 || true
启动:
bash
在 ragflow/docker 目录下
可选:如果您不想依赖 COMPOSE_PROFILES,可以显式指定配置文件
docker compose --profile elasticsearch --profile cpu up -d
docker compose up -d
docker compose ps
切换 CPU/GPU(示例):
bash
选项 1:编辑 docker/.env
DEVICE=gpu
选项 2:临时覆盖(不修改文件)
DEVICE=gpu docker compose up -d
启用嵌入服务(TEI):上游建议将 tei 配置文件添加到 COMPOSE_PROFILES:
bash
示例:
COMPOSEPROFILES=${COMPOSEPROFILES},tei-cpu
或:
COMPOSEPROFILES=${COMPOSEPROFILES},tei-gpu
docker compose up -d
验证:等待关键服务在 docker compose ps 中显示为运行/健康状态,然后运行存活/就绪检查(## 3)和 API 前缀检测(## 8)。
4.4 首次设置清单(与上游 .env 对齐)
在上游 docker/.env(主分支)中,暴露的端口通常意味着:
- - Web UI / Web 服务器:SVRWEBHTTPPORT(默认 80),SVRWEBHTTPSPORT(默认 443)
- API(RAGFlow HTTP):SVRHTTPPORT(默认 9380)
- 管理服务器:ADMINSVRHTTPPORT(默认 9381)
- MCP:SVRMCP_PORT(默认 9382)
获得可用设置的最短路径:
1) 打开 Web UI:http://<主机>:${SVRWEBHTTP_PORT}(默认 http://<主机>:80)
2) 完成初始化(根据版本进行管理员/组织设置)
3) 创建 API 密钥(通常在设置/系统/API 密钥下)
4) 在客户端设置(推荐环境变量):
- - RAGFLOWBASEURL=http://<主机>:${SVRHTTPPORT}(默认 http://<主机>:9380)
- RAGFLOWAPIKEY=ragflow-...(Bearer 令牌;请勿将密钥粘贴到聊天中)
然后使用