RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
refactor: Update entrypoint.sh (#20744)
Jin Hai7c29e7a8eee2
diff --git a/Dockerfile_ci b/Dockerfile_ciindex dc6ba86b78..149fa3b447 100644--- a/Dockerfile_ci+++ b/Dockerfile_ci@@ -66,7 +66,6 @@ COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"ENV PYTHONPATH=/ragflow/-# copy entrypoint.sh and entrypoint-pasar.shCOPY docker/service_conf.yaml.template ./conf/service_conf.yaml.templateCOPY docker/entrypoint*.sh ./RUN chmod +x ./entrypoint*.shdiff --git a/docker/docker-compose.yml b/docker/docker-compose.ymlindex 1a278e40dd..3c8d701502 100644--- a/docker/docker-compose.yml+++ b/docker/docker-compose.yml@@ -22,7 +22,6 @@ services:# Example configuration to start Admin server:command:- - --enable-adminserver- --init-superuser#- --init-model-provider-tablesports:diff --git a/docker/entrypoint.sh b/docker/entrypoint.shindex 07ba2ba480..39e8b8201b 100755--- a/docker/entrypoint.sh+++ b/docker/entrypoint.sh@@ -2,7 +2,7 @@set -e-echo "Start RAGFlow cluster, version: "+echo "Start RAGFlow, version: "cat /ragflow/VERSION# -----------------------------------------------------------------------------@@ -11,70 +11,44 @@ cat /ragflow/VERSIONfunction usage() {echo "Usage: $0 [OPTIONS]"echo- echo " --disable-webserver Disables the web server (nginx + ragflow_server)."- echo " --disable-taskexecutor Disables task executor workers."- echo " --disable-datasync Disables synchronization of datasource workers."- echo " --enable-adminserver Enables the Admin server."- echo " --init-model-provider-tables Run model provider table migrations and exit."- echo " --init-superuser Initializes the superuser (needs --enable-adminserver)."- 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 " --workers=<num> Number of task executors to run (if range is not used)."- echo " --host-id=<string> Unique ID for the host (defaults to \`hostname\`)."+ echo " --disable-api-server Disables the web server (nginx + ragflow_server)."+ echo " --disable-ingestor Disables ingestor."+ echo " --disable-syncer Disables data source syncer."+ echo " --init-model-provider-tables Run model provider table migrations and exit."+ echo " --init-superuser Initializes the superuser."+ echo " --ingestors=<num> Number of ingestors to run."echoecho "Examples:"- echo " $0 --disable-taskexecutor"- echo " $0 --disable-webserver --consumer-no-beg=0 --consumer-no-end=5"- echo " $0 --disable-webserver --workers=2 --host-id=myhost123"- echo " $0 --enable-adminserver"- echo " $0 --enable-adminserver --init-superuser"+ echo " $0 --disable-ingestor"+ echo " $0 --disable-api-server --ingestors=2"+ echo " $0 --init-superuser"exit 1}-ENABLE_WEBSERVER=1 # Default to enable web server-ENABLE_TASKEXECUTOR=1 # Default to enable task executor+ENABLE_API_SERVER=1 # Default to enable web server+ENABLE_INGESTOR=1 # Default to enable ingestorENABLE_DATASYNC=1-ENABLE_ADMIN_SERVER=0 # Default close admin server+INIT_SUPERUSER_ARGS="" # Default to not initialize superuserINIT_MODEL_PROVIDER_TABLES=0-CONSUMER_NO_BEG=0-CONSUMER_NO_END=0-WORKERS=1--# ------------------------------------------------------------------------------# Host ID logic:-# 1. By default, use the system hostname if length <= 32-# 2. Otherwise, use the full MD5 hash of the hostname (32 hex chars)-# ------------------------------------------------------------------------------CURRENT_HOSTNAME="$(hostname)"-if [ ${#CURRENT_HOSTNAME} -le 32 ]; then- DEFAULT_HOST_ID="$CURRENT_HOSTNAME"-else- DEFAULT_HOST_ID="$(echo -n "$CURRENT_HOSTNAME" | md5sum | cut -d ' ' -f 1)"-fi--HOST_ID="$DEFAULT_HOST_ID"+INGESTOR_NUMBER=1# Parse argumentsfor arg in "$@"; docase $arg in- --disable-webserver)- ENABLE_WEBSERVER=0+ --disable-api-server)+ ENABLE_API_SERVER=0shift;;- --disable-taskexecutor)- ENABLE_TASKEXECUTOR=0+ --disable-ingestor)+ ENABLE_INGESTOR=0shift;;- --disable-datasync)+ --disable-syncer)ENABLE_DATASYNC=0shift;;- --enable-adminserver)- ENABLE_ADMIN_SERVER=1- shift- ;;--init-model-provider-tables)INIT_MODEL_PROVIDER_TABLES=1shift@@ -83,20 +57,8 @@ for arg in "$@"; doINIT_SUPERUSER_ARGS="--init-superuser"shift;;- --consumer-no-beg=*)- CONSUMER_NO_BEG="${arg#*=}"- shift- ;;- --consumer-no-end=*)- CONSUMER_NO_END="${arg#*=}"- shift- ;;- --workers=*)- WORKERS="${arg#*=}"- shift- ;;- --host-id=*)- HOST_ID="${arg#*=}"+ --ingestors=*)+ INGESTOR_NUMBER="${arg#*=}"shift;;*)@@ -156,7 +118,7 @@ function go_backend_enabled() {if [[ "${ENABLE_DATASYNC}" -eq 1 ]]; thenreturn 0fi- if [[ "${ENABLE_ADMIN_SERVER}" -eq 1 ]] || [[ "${ENABLE_WEBSERVER}" -eq 1 ]]; then+ if [[ "${ENABLE_API_SERVER}" -eq 1 ]]; thenreturn 0fireturn 1@@ -194,19 +156,10 @@ if go_backend_enabled; thenrun_go_migrationsfi-if [[ "${ENABLE_DATASYNC}" -eq 1 ]]; then- echo "Starting data sync..."- run_with_restart "RAGFlow go server" bin/ragflow_server --syncer &-fi--sleep 5--if [[ "${ENABLE_ADMIN_SERVER}" -eq 1 ]]; then- echo "Starting Admin go server..."- run_with_restart "Admin go server" bin/ragflow_server --admin ${INIT_SUPERUSER_ARGS} &-fi+echo "Starting Admin go server..."+run_with_restart "Admin go server" bin/ragflow_server --admin ${INIT_SUPERUSER_ARGS} &-if [[ "${ENABLE_WEBSERVER}" -eq 1 ]]; then+if [[ "${ENABLE_API_SERVER}" -eq 1 ]]; thenecho "Starting nginx..."/usr/sbin/nginx -c /etc/nginx/nginx.conf@@ -214,25 +167,17 @@ if [[ "${ENABLE_WEBSERVER}" -eq 1 ]]; thenrun_with_restart "RAGFlow go server" bin/ragflow_server --api &fi-# MCP configuration comes from service_conf.yaml and RAGFLOW_MCP_* environment-# variables. The API process owns its optional standalone listener.+if [[ "${ENABLE_DATASYNC}" -eq 1 ]]; then+ echo "Starting data sync..."+ run_with_restart "RAGFlow go server" bin/ragflow_server --syncer &+fi-# Task execution is the Go ingestor's job. This image ships no Python task-# executor (rag/svr/task_executor.py is not copied), so --ingestor is the only-# worker that can run here.-if [[ "${ENABLE_TASKEXECUTOR}" -eq 1 ]]; then- if [[ "${CONSUMER_NO_END}" -gt "${CONSUMER_NO_BEG}" ]]; then- echo "Starting go ingestor..."+if [[ "${ENABLE_INGESTOR}" -eq 1 ]]; then+ echo "Starting ${INGESTOR_NUMBER} ingestor worker(s)..."+ for (( i=0; i<INGESTOR_NUMBER; i++ ))+ dorun_with_restart "ingestor" bin/ragflow_server --ingestor &- else- # Otherwise, start a fixed number of workers- echo "Starting ${WORKERS} task executor(s) on host '${HOST_ID}'..."- for (( i=0; i<WORKERS; i++ ))- do- echo "Starting go ingestor..."- run_with_restart "ingestor" bin/ragflow_server --ingestor &- done- fi+ donefiwait