The RAGFlow Admin Service and CLI provide a dedicated management layer for system administrators to oversee users, monitor service health, manage ingestion tasks, and perform maintenance. This system is implemented as a dual-layer architecture: a Go-based admin server for core operations and a multi-language CLI (Python and Go) for developer and operator interactions.
The Admin Service operates as a privileged management interface. It provides endpoints for superuser authentication, user lifecycle management, and system-wide task monitoring.
The administrative logic is primarily implemented in the Go backend, which serves as the central point for privileged operations.
AdminConfig which defines the host and port internal/server/config.go58-62 The server uses the Gin framework and is managed by internal/admin/handler.go and internal/admin/service.go internal/admin/handler.go39-50IsSuperuser flag to be true. The Login handler in Go verifies this flag after a successful email/password check internal/admin/handler.go145-153admin.Service struct aggregates various DAOs (Data Access Objects) to perform cross-functional administrative tasks, including user, tenant, and ingestion task management internal/admin/service.go45-91The following diagram illustrates the authentication flow for administrative access via the Go-based admin handler.
Admin Login Sequence
Sources: internal/admin/handler.go124-185 internal/service/user.go108-171 internal/admin/handler.go145-152
The ragflow-cli is a command-line interface that allows administrators and users to interact with RAGFlow services. It features a robust Go-based implementation with a custom parser and a Python client for scriptability.
Parser internal/cli/parser.go27-42 and a Lexer internal/cli/lexer.go25-30 to handle SQL-like syntax. It supports different modes: AdminMode and APIMode internal/cli/parser.go254-262LOGIN, DATASETS, INGESTION, and METADATA internal/cli/lexer.go187-250 internal/cli/types.go26-185rf.yml to manage multiple API server profiles, including host, tokens, and credentials internal/cli/cli.go49-56| Category | Example Commands | File Reference |
|---|---|---|
| System | PING, SHOW SERVER VERSION, LIST CONFIGS | internal/cli/user_command.go40-114 internal/cli/user_parser.go62-70 |
| User Mgmt | REGISTER USER, LOGIN USER, LIST USERS | internal/cli/user_parser.go72-117 internal/cli/user_parser.go27-60 |
| Data Mgmt | LIST DATASETS, LIST DOCUMENTS FROM 'id', GET METADATA OF DATASET | internal/cli/user_parser.go186-220 internal/cli/user_parser.go222-268 |
| Ingestion | LIST INGESTION, START INGESTION, STOP INGESTION | internal/cli/user_parser.go162-163 internal/cli/user_parser.go221-224 |
| Admin | LIST SERVICES, SHOW SERVICE <num>, SHUTDOWN SERVICE | admin/client/ragflow_client.py120-170 internal/cli/parser.go80-144 |
Sources: internal/cli/user_parser.go17-270 internal/cli/types.go26-203 internal/cli/user_command.go40-114
The admin.Service in Go encapsulates the business logic for privileged operations.
ListIngestionTasks retrieves all tasks and joins them with user information and the latest logs to show the current processing step internal/admin/service.go104-148StopIngestionTasks sets a task status to STOPPING and publishes the stop signal to the message queue (e.g., Redis Streams or Nats) internal/admin/service.go167-186ListUsers provides a summary of all registered accounts, including their superuser status and creation dates internal/admin/service.go214-231Logout invalidates a user's session by prefixing their access token with INVALID_ in the database internal/admin/service.go94-101The admin handler provides diagnostic endpoints for system maintenance.
GET /admin/health returns basic service status internal/admin/handler.go106-108GetConfigs allows administrators to verify the connectivity and host addresses for Redis, the Database, and the Document Engine (Elasticsearch or Infinity) internal/cli/user_command.go116-207Code Entity Mapping: Admin Service Layer
Sources: internal/admin/handler.go39-50 internal/admin/service.go45-91 internal/admin/service.go167-186 internal/admin/handler.go111-113
The system tracks service availability and configuration integrity through several mechanisms:
PING command. Admin mode hits /admin/ping while API mode hits /system/ping internal/cli/common_command.go106-125ShowServerVersion and Ping support an iterations parameter to perform multiple requests and measure average duration/latency internal/cli/user_command.go40-52 internal/cli/common_command.go98-104GetConfigs utility specifically extracts host and type information for the DocEngine (Elasticsearch/Infinity) and StorageEngine (Minio), allowing operators to identify configuration mismatches internal/cli/user_command.go128-205RAGFlowClient performs a ping_server check before login to ensure the target instance is reachable admin/client/ragflow_client.py57-68Sources: internal/cli/user_command.go40-207 internal/cli/common_command.go98-158 admin/client/ragflow_client.py86-98
Refresh this wiki
This wiki was recently refreshed. Please wait 3 days to refresh again.