Parcourir la source

Added entrypoint for task executor (#4551)

### What problem does this PR solve?

Added entrypoint for task executor

### Type of change

- [x] Refactoring
tags/v0.16.0
Zhichang Yu il y a 9 mois
Parent
révision
db80376427
Aucun compte lié à l'adresse e-mail de l'auteur
4 fichiers modifiés avec 53 ajouts et 6 suppressions
  1. 2
    2
      Dockerfile
  2. 23
    1
      docker/docker-compose.yml
  3. 0
    3
      docker/entrypoint.sh
  4. 28
    0
      docker/entrypoint_task_executor.sh

+ 2
- 2
Dockerfile Voir le fichier

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

+ 23
- 1
docker/docker-compose.yml Voir le fichier

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

+ 0
- 3
docker/entrypoint.sh Voir le fichier

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

+ 28
- 0
docker/entrypoint_task_executor.sh Voir le fichier

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

Chargement…
Annuler
Enregistrer