zhichyu commited on
Commit
7f935b7
·
1 Parent(s): 4e483d4

Added entrypoint for task executor (#4551)

Browse files

### What problem does this PR solve?

Added entrypoint for task executor

### Type of change

- [x] Refactoring

Dockerfile CHANGED
@@ -183,8 +183,8 @@ COPY graphrag graphrag
183
  COPY pyproject.toml uv.lock ./
184
 
185
  COPY docker/service_conf.yaml.template ./conf/service_conf.yaml.template
186
- COPY docker/entrypoint.sh ./entrypoint.sh
187
- RUN chmod +x ./entrypoint.sh
188
 
189
  # Copy compiled web pages
190
  COPY --from=builder /ragflow/web/dist /ragflow/web/dist
 
183
  COPY pyproject.toml uv.lock ./
184
 
185
  COPY docker/service_conf.yaml.template ./conf/service_conf.yaml.template
186
+ COPY docker/entrypoint.sh docker/entrypoint_task_executor.sh ./
187
+ RUN chmod +x ./entrypoint*.sh
188
 
189
  # Copy compiled web pages
190
  COPY --from=builder /ragflow/web/dist /ragflow/web/dist
docker/docker-compose.yml CHANGED
@@ -26,6 +26,28 @@ services:
26
  - ragflow
27
  restart: on-failure
28
  # https://docs.docker.com/engine/daemon/prometheus/#create-a-prometheus-configuration
29
- # 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.
30
  extra_hosts:
31
  - "host.docker.internal:host-gateway"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  - ragflow
27
  restart: on-failure
28
  # https://docs.docker.com/engine/daemon/prometheus/#create-a-prometheus-configuration
29
+ # 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.
30
  extra_hosts:
31
  - "host.docker.internal:host-gateway"
32
+ # executor:
33
+ # depends_on:
34
+ # mysql:
35
+ # condition: service_healthy
36
+ # image: ${RAGFLOW_IMAGE}
37
+ # container_name: ragflow-executor
38
+ # volumes:
39
+ # - ./ragflow-logs:/ragflow/logs
40
+ # - ./nginx/ragflow.conf:/etc/nginx/conf.d/ragflow.conf
41
+ # env_file: .env
42
+ # environment:
43
+ # - TZ=${TIMEZONE}
44
+ # - HF_ENDPOINT=${HF_ENDPOINT}
45
+ # - MACOS=${MACOS}
46
+ # entrypoint: "/ragflow/entrypoint_task_executor.sh 1 3"
47
+ # networks:
48
+ # - ragflow
49
+ # restart: on-failure
50
+ # # https://docs.docker.com/engine/daemon/prometheus/#create-a-prometheus-configuration
51
+ # # 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.
52
+ # extra_hosts:
53
+ # - "host.docker.internal:host-gateway"
docker/entrypoint.sh CHANGED
@@ -7,9 +7,6 @@ while IFS= read -r line || [[ -n "$line" ]]; do
7
  eval "echo \"$line\"" >> /ragflow/conf/service_conf.yaml
8
  done < /ragflow/conf/service_conf.yaml.template
9
 
10
- # unset http proxy which maybe set by docker daemon
11
- export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY=""
12
-
13
  /usr/sbin/nginx
14
 
15
  export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/
 
7
  eval "echo \"$line\"" >> /ragflow/conf/service_conf.yaml
8
  done < /ragflow/conf/service_conf.yaml.template
9
 
 
 
 
10
  /usr/sbin/nginx
11
 
12
  export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/
docker/entrypoint_task_executor.sh ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # replace env variables in the service_conf.yaml file
4
+ rm -rf /ragflow/conf/service_conf.yaml
5
+ while IFS= read -r line || [[ -n "$line" ]]; do
6
+ # Use eval to interpret the variable with default values
7
+ eval "echo \"$line\"" >> /ragflow/conf/service_conf.yaml
8
+ done < /ragflow/conf/service_conf.yaml.template
9
+
10
+ export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/
11
+
12
+ PY=python3
13
+
14
+ CONSUMER_NO_BEG=$1
15
+ CONSUMER_NO_END=$2
16
+
17
+ function task_exe(){
18
+ while [ 1 -eq 1 ]; do
19
+ $PY rag/svr/task_executor.py $1;
20
+ done
21
+ }
22
+
23
+ for ((i=CONSUMER_NO_BEG; i<CONSUMER_NO_END; i++))
24
+ do
25
+ task_exe $i &
26
+ done
27
+
28
+ wait;