Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Added entrypoint for task executor (#4551)

Zhichang Yudb803764276b
diff --git a/Dockerfile b/Dockerfile
index 6b519073be..ba274ddbb3 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -183,8 +183,8 @@ COPY graphrag graphrag
COPY pyproject.toml uv.lock ./
COPY docker/service_conf.yaml.template ./conf/service_conf.yaml.template
-COPY docker/entrypoint.sh ./entrypoint.sh
-RUN chmod +x ./entrypoint.sh
+COPY docker/entrypoint.sh docker/entrypoint_task_executor.sh ./
+RUN chmod +x ./entrypoint*.sh
# Copy compiled web pages
COPY --from=builder /ragflow/web/dist /ragflow/web/dist
diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
index 00901ddc7c..676f167d6c 100644
--- a/docker/docker-compose.yml
+++ b/docker/docker-compose.yml
@@ -26,6 +26,28 @@ services:
- ragflow
restart: on-failure
# https://docs.docker.com/engine/daemon/prometheus/#create-a-prometheus-configuration
- # If you're using Docker Desktop, the --add-host flag is optional. This flag makes sure that the host's internal IP gets exposed to the Prometheus container.
+ # If you're using Docker Desktop, the --add-host flag is optional. This flag makes sure that the host's internal IP gets exposed to the Prometheus container.
extra_hosts:
- "host.docker.internal:host-gateway"
+ # executor:
+ # depends_on:
+ # mysql:
+ # condition: service_healthy
+ # image: ${RAGFLOW_IMAGE}
+ # container_name: ragflow-executor
+ # volumes:
+ # - ./ragflow-logs:/ragflow/logs
+ # - ./nginx/ragflow.conf:/etc/nginx/conf.d/ragflow.conf
+ # env_file: .env
+ # environment:
+ # - TZ=${TIMEZONE}
+ # - HF_ENDPOINT=${HF_ENDPOINT}
+ # - MACOS=${MACOS}
+ # entrypoint: "/ragflow/entrypoint_task_executor.sh 1 3"
+ # networks:
+ # - ragflow
+ # restart: on-failure
+ # # https://docs.docker.com/engine/daemon/prometheus/#create-a-prometheus-configuration
+ # # If you're using Docker Desktop, the --add-host flag is optional. This flag makes sure that the host's internal IP gets exposed to the Prometheus container.
+ # extra_hosts:
+ # - "host.docker.internal:host-gateway"
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh
index 792bbca7a6..3881029601 100755
--- a/docker/entrypoint.sh
+++ b/docker/entrypoint.sh
@@ -7,9 +7,6 @@ while IFS= read -r line || [[ -n "$line" ]]; do
eval "echo \"$line\"" >> /ragflow/conf/service_conf.yaml
done < /ragflow/conf/service_conf.yaml.template
-# unset http proxy which maybe set by docker daemon
-export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY=""
-
/usr/sbin/nginx
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/
diff --git a/docker/entrypoint_task_executor.sh b/docker/entrypoint_task_executor.sh
new file mode 100755
index 0000000000..899f16f8fb
--- /dev/null
+++ b/docker/entrypoint_task_executor.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# replace env variables in the service_conf.yaml file
+rm -rf /ragflow/conf/service_conf.yaml
+while IFS= read -r line || [[ -n "$line" ]]; do
+ # Use eval to interpret the variable with default values
+ eval "echo \"$line\"" >> /ragflow/conf/service_conf.yaml
+done < /ragflow/conf/service_conf.yaml.template
+
+export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/
+
+PY=python3
+
+CONSUMER_NO_BEG=$1
+CONSUMER_NO_END=$2
+
+function task_exe(){
+ while [ 1 -eq 1 ]; do
+ $PY rag/svr/task_executor.py $1;
+ done
+}
+
+for ((i=CONSUMER_NO_BEG; i<CONSUMER_NO_END; i++))
+do
+ task_exe $i &
+done
+
+wait;