### What problem does this PR solve? Added entrypoint for task executor ### Type of change - [x] Refactoringtags/v0.16.0
| COPY pyproject.toml uv.lock ./ | COPY pyproject.toml uv.lock ./ | ||||
| COPY docker/service_conf.yaml.template ./conf/service_conf.yaml.template | 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 compiled web pages | ||||
| COPY --from=builder /ragflow/web/dist /ragflow/web/dist | COPY --from=builder /ragflow/web/dist /ragflow/web/dist |
| - ragflow | - ragflow | ||||
| restart: on-failure | restart: on-failure | ||||
| # https://docs.docker.com/engine/daemon/prometheus/#create-a-prometheus-configuration | # 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: | extra_hosts: | ||||
| - "host.docker.internal:host-gateway" | - "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" |
| eval "echo \"$line\"" >> /ragflow/conf/service_conf.yaml | eval "echo \"$line\"" >> /ragflow/conf/service_conf.yaml | ||||
| done < /ragflow/conf/service_conf.yaml.template | 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 | /usr/sbin/nginx | ||||
| export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/ | export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/ |
| #!/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; |