Feat: add admin server to docker (#10522)

### What problem does this PR solve?

Add admin server to docker.

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
Lynn
2025-10-13 19:05:54 +08:00
committed by GitHub
parent 8c75803b70
commit 74ec734d69
6 changed files with 44 additions and 3 deletions

View File

@ -191,6 +191,7 @@ ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
ENV PYTHONPATH=/ragflow/ ENV PYTHONPATH=/ragflow/
COPY web web COPY web web
COPY admin admin
COPY api api COPY api api
COPY conf conf COPY conf conf
COPY deepdoc deepdoc COPY deepdoc deepdoc

View File

@ -267,10 +267,25 @@ class AdminCLI:
columns = list(data[0].keys()) columns = list(data[0].keys())
col_widths = {} col_widths = {}
def get_string_width(text):
half_width_chars = (
" !\"#$%&'()*+,-./0123456789:;<=>?@"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`"
"abcdefghijklmnopqrstuvwxyz{|}~"
"\t\n\r"
)
width = 0
for char in text:
if char in half_width_chars:
width += 1
else:
width += 2
return width
for col in columns: for col in columns:
max_width = len(str(col)) max_width = get_string_width(str(col))
for item in data: for item in data:
value_len = len(str(item.get(col, ''))) value_len = get_string_width(str(item.get(col, '')))
if value_len > max_width: if value_len > max_width:
max_width = value_len max_width = value_len
col_widths[col] = max(2, max_width) col_widths[col] = max(2, max_width)

View File

@ -91,6 +91,7 @@ REDIS_PASSWORD=infini_rag_flow
# The port used to expose RAGFlow's HTTP API service to the host machine, # The port used to expose RAGFlow's HTTP API service to the host machine,
# allowing EXTERNAL access to the service running inside the Docker container. # allowing EXTERNAL access to the service running inside the Docker container.
SVR_HTTP_PORT=9380 SVR_HTTP_PORT=9380
ADMIN_SVR_HTTP_PORT=9381
# The RAGFlow Docker image to download. # The RAGFlow Docker image to download.
# Defaults to the v0.20.5-slim edition, which is the RAGFlow Docker image without embedding models. # Defaults to the v0.20.5-slim edition, which is the RAGFlow Docker image without embedding models.

View File

@ -22,9 +22,14 @@ services:
# - --no-transport-sse-enabled # Disable legacy SSE endpoints (/sse and /messages/) # - --no-transport-sse-enabled # Disable legacy SSE endpoints (/sse and /messages/)
# - --no-transport-streamable-http-enabled # Disable Streamable HTTP transport (/mcp endpoint) # - --no-transport-streamable-http-enabled # Disable Streamable HTTP transport (/mcp endpoint)
# - --no-json-response # Disable JSON response mode in Streamable HTTP transport (instead of SSE over HTTP) # - --no-json-response # Disable JSON response mode in Streamable HTTP transport (instead of SSE over HTTP)
# Example configration to start Admin server:
# command:
# - --enable-adminserver
container_name: ragflow-server container_name: ragflow-server
ports: ports:
- ${SVR_HTTP_PORT}:9380 - ${SVR_HTTP_PORT}:9380
- ${ADMIN_SVR_HTTP_PORT}:9381
- 80:80 - 80:80
- 443:443 - 443:443
- 5678:5678 - 5678:5678

View File

@ -11,6 +11,7 @@ function usage() {
echo " --disable-webserver Disables the web server (nginx + ragflow_server)." echo " --disable-webserver Disables the web server (nginx + ragflow_server)."
echo " --disable-taskexecutor Disables task executor workers." echo " --disable-taskexecutor Disables task executor workers."
echo " --enable-mcpserver Enables the MCP server." echo " --enable-mcpserver Enables the MCP server."
echo " --enable-adminserver Enables the Admin server."
echo " --consumer-no-beg=<num> Start range for consumers (if using range-based)." echo " --consumer-no-beg=<num> Start range for consumers (if using range-based)."
echo " --consumer-no-end=<num> End range for consumers (if using range-based)." echo " --consumer-no-end=<num> End range for consumers (if using range-based)."
echo " --workers=<num> Number of task executors to run (if range is not used)." echo " --workers=<num> Number of task executors to run (if range is not used)."
@ -21,12 +22,14 @@ function usage() {
echo " $0 --disable-webserver --consumer-no-beg=0 --consumer-no-end=5" echo " $0 --disable-webserver --consumer-no-beg=0 --consumer-no-end=5"
echo " $0 --disable-webserver --workers=2 --host-id=myhost123" echo " $0 --disable-webserver --workers=2 --host-id=myhost123"
echo " $0 --enable-mcpserver" echo " $0 --enable-mcpserver"
echo " $0 --enable-adminserver"
exit 1 exit 1
} }
ENABLE_WEBSERVER=1 # Default to enable web server ENABLE_WEBSERVER=1 # Default to enable web server
ENABLE_TASKEXECUTOR=1 # Default to enable task executor ENABLE_TASKEXECUTOR=1 # Default to enable task executor
ENABLE_MCP_SERVER=0 ENABLE_MCP_SERVER=0
ENABLE_ADMIN_SERVER=0 # Default close admin server
CONSUMER_NO_BEG=0 CONSUMER_NO_BEG=0
CONSUMER_NO_END=0 CONSUMER_NO_END=0
WORKERS=1 WORKERS=1
@ -70,6 +73,10 @@ for arg in "$@"; do
ENABLE_MCP_SERVER=1 ENABLE_MCP_SERVER=1
shift shift
;; ;;
--enable-adminserver)
ENABLE_ADMIN_SERVER=1
shift
;;
--mcp-host=*) --mcp-host=*)
MCP_HOST="${arg#*=}" MCP_HOST="${arg#*=}"
shift shift
@ -185,6 +192,12 @@ if [[ "${ENABLE_WEBSERVER}" -eq 1 ]]; then
done & done &
fi fi
if [[ "${ENABLE_ADMIN_SERVER}" -eq 1 ]]; then
echo "Starting admin_server..."
while true; do
"$PY" admin/admin_server.py
done &
fi
if [[ "${ENABLE_MCP_SERVER}" -eq 1 ]]; then if [[ "${ENABLE_MCP_SERVER}" -eq 1 ]]; then
start_mcp_server start_mcp_server

View File

@ -1,3 +1,9 @@
---
sidebar_position: 6
slug: /manage_users_and_services
---
# Admin CLI and Admin Service # Admin CLI and Admin Service
@ -50,7 +56,7 @@ Commands are case-insensitive and must be terminated with a semicolon(;).
`SHOW SERVICE <id>;` `SHOW SERVICE <id>;`
- Shows detailed status information for the service identified by <id>. - Shows detailed status information for the service identified by **id**.
- [Example](#example-show-service) - [Example](#example-show-service)
### User Management Commands ### User Management Commands