Added entrypoint for task executor (#4551)

### What problem does this PR solve?

Added entrypoint for task executor

### Type of change

- [x] Refactoring
This commit is contained in:
Zhichang Yu 2025-01-20 22:49:46 +08:00 committed by GitHub
parent 99430a7db7
commit db80376427
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 53 additions and 6 deletions

View File

@ -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

View File

@ -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"

View File

@ -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/

View File

@ -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;