mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
docker debugging modification (#82)
This commit is contained in:
16
Dockerfile
16
Dockerfile
@ -1,14 +1,20 @@
|
|||||||
FROM infiniflow/ragflow-base:v1.0
|
FROM infiniflow/ragflow-base:v1.0
|
||||||
|
USER root
|
||||||
|
|
||||||
WORKDIR /ragflow
|
WORKDIR /ragflow
|
||||||
|
|
||||||
COPY . ./
|
ADD ./web ./web
|
||||||
RUN cd ./web && npm i && npm build
|
RUN cd ./web && npm i && npm run build
|
||||||
|
|
||||||
ENV PYTHONPATH=/ragflow
|
ADD ./api ./api
|
||||||
|
ADD ./conf ./conf
|
||||||
|
ADD ./deepdoc ./deepdoc
|
||||||
|
ADD ./rag ./rag
|
||||||
|
|
||||||
|
ENV PYTHONPATH=/ragflow/
|
||||||
ENV HF_ENDPOINT=https://hf-mirror.com
|
ENV HF_ENDPOINT=https://hf-mirror.com
|
||||||
|
|
||||||
COPY docker/entrypoint.sh ./
|
ADD docker/entrypoint.sh ./entrypoint.sh
|
||||||
RUN chmod +x ./entrypoint.sh
|
RUN chmod +x ./entrypoint.sh
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/bash", "./entrypoint.sh"]
|
ENTRYPOINT ["./entrypoint.sh"]
|
||||||
|
|||||||
@ -66,7 +66,7 @@ def init_superuser():
|
|||||||
chat_mdl = LLMBundle(tenant["id"], LLMType.CHAT, tenant["llm_id"])
|
chat_mdl = LLMBundle(tenant["id"], LLMType.CHAT, tenant["llm_id"])
|
||||||
msg = chat_mdl.chat(system="", history=[{"role": "user", "content": "Hello!"}], gen_conf={})
|
msg = chat_mdl.chat(system="", history=[{"role": "user", "content": "Hello!"}], gen_conf={})
|
||||||
if msg.find("ERROR: ") == 0:
|
if msg.find("ERROR: ") == 0:
|
||||||
print("\33[91m【ERROR】\33[0m: ", "'{}' dosen't work. {}".format(tenant["llm_id"]), msg)
|
print("\33[91m【ERROR】\33[0m: ", "'{}' dosen't work. {}".format(tenant["llm_id"], msg))
|
||||||
embd_mdl = LLMBundle(tenant["id"], LLMType.EMBEDDING, tenant["embd_id"])
|
embd_mdl = LLMBundle(tenant["id"], LLMType.EMBEDDING, tenant["embd_id"])
|
||||||
v, c = embd_mdl.encode(["Hello!"])
|
v, c = embd_mdl.encode(["Hello!"])
|
||||||
if c == 0:
|
if c == 0:
|
||||||
|
|||||||
@ -19,13 +19,19 @@ services:
|
|||||||
memlock:
|
memlock:
|
||||||
soft: -1
|
soft: -1
|
||||||
hard: -1
|
hard: -1
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "curl http://localhost:9200"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 120
|
||||||
networks:
|
networks:
|
||||||
- ragflow
|
- ragflow
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
kibana:
|
kibana:
|
||||||
depends_on:
|
depends_on:
|
||||||
- es01
|
es01:
|
||||||
|
condition: service_healthy
|
||||||
image: docker.elastic.co/kibana/kibana:${STACK_VERSION}
|
image: docker.elastic.co/kibana/kibana:${STACK_VERSION}
|
||||||
container_name: ragflow-kibana
|
container_name: ragflow-kibana
|
||||||
volumes:
|
volumes:
|
||||||
@ -60,10 +66,10 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- ragflow
|
- ragflow
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: [ "CMD-SHELL", "curl --silent localhost:3306 >/dev/null || exit 1" ]
|
test: ["CMD", "mysqladmin" ,"ping", "-uroot", "-p${MYSQL_PASSWORD}"]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
retries: 3
|
retries: 3
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
|
|
||||||
@ -86,17 +92,20 @@ services:
|
|||||||
|
|
||||||
ragflow:
|
ragflow:
|
||||||
depends_on:
|
depends_on:
|
||||||
- es01
|
mysql:
|
||||||
- mysql
|
condition: service_healthy
|
||||||
- minio
|
es01:
|
||||||
|
condition: service_healthy
|
||||||
image: infiniflow/ragflow:v1.0
|
image: infiniflow/ragflow:v1.0
|
||||||
container_name: ragflow-server
|
container_name: ragflow-server
|
||||||
ports:
|
ports:
|
||||||
- ${SVR_HTTP_PORT}:9380
|
- ${SVR_HTTP_PORT}:9380
|
||||||
|
- 80:80
|
||||||
|
- 443:443
|
||||||
volumes:
|
volumes:
|
||||||
- ./service_conf.yaml:/ragflow/conf/service_conf.yaml
|
- ./service_conf.yaml:/ragflow/conf/service_conf.yaml
|
||||||
- ./nginx.conf:/etc/nginx/nginx.conf
|
|
||||||
- ./ragflow-logs:/ragflow/logs
|
- ./ragflow-logs:/ragflow/logs
|
||||||
|
- ./nginx.conf:/etc/nginx/conf.d/ragflow.conf
|
||||||
networks:
|
networks:
|
||||||
- ragflow
|
- ragflow
|
||||||
restart: always
|
restart: always
|
||||||
|
|||||||
@ -1,24 +1,34 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
python rag/svr/task_broker.py &
|
/usr/sbin/nginx
|
||||||
|
|
||||||
|
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/
|
||||||
|
|
||||||
|
PY=/root/miniconda3/envs/py11/bin/python
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function task_exe(){
|
function task_exe(){
|
||||||
while [ 1 -eq 1 ];do mpirun -n 2 python rag/svr/task_executor.py ; done
|
sleep 60;
|
||||||
|
while [ 1 -eq 1 ];do mpirun -n 2 --allow-run-as-root $PY rag/svr/task_executor.py ; done
|
||||||
}
|
}
|
||||||
|
|
||||||
function watch_broker(){
|
function watch_broker(){
|
||||||
while [ 1 -eq 1];do
|
while [ 1 -eq 1 ];do
|
||||||
C=`ps aux|grep "task_broker.py"|grep -v grep|wc -l`;
|
C=`ps aux|grep "task_broker.py"|grep -v grep|wc -l`;
|
||||||
if [ $C -lt 1 ];then
|
if [ $C -lt 1 ];then
|
||||||
python rag/svr/task_broker.py &
|
$PY rag/svr/task_broker.py &
|
||||||
fi
|
fi
|
||||||
sleep 5;
|
sleep 5;
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function task_bro(){
|
||||||
|
sleep 60;
|
||||||
|
watch_broker;
|
||||||
|
}
|
||||||
|
|
||||||
|
task_bro &
|
||||||
task_exe &
|
task_exe &
|
||||||
sleep 10;
|
|
||||||
watch_broker &
|
|
||||||
|
|
||||||
python api/ragflow_server.py
|
$PY api/ragflow_server.py
|
||||||
@ -1,46 +1,46 @@
|
|||||||
upstream api_service {
|
upstream api_service {
|
||||||
server 127.0.0.1:9380;
|
server ragflow:9380;
|
||||||
keepalive 2000;
|
keepalive 2000;
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 5101;
|
listen 80;
|
||||||
# server_name xxx.com;
|
server_name ragflow.io;
|
||||||
|
|
||||||
# gzip config
|
# gzip config
|
||||||
gzip on;
|
gzip on;
|
||||||
gzip_min_length 1k;
|
gzip_min_length 1k;
|
||||||
gzip_comp_level 9;
|
gzip_comp_level 9;
|
||||||
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
|
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
|
||||||
gzip_vary on;
|
gzip_vary on;
|
||||||
gzip_disable "MSIE [1-6]\.";
|
gzip_disable "MSIE [1-6]\.";
|
||||||
|
|
||||||
|
|
||||||
# remove api server header
|
# remove api server header
|
||||||
proxy_hide_header Access-Control-Allow-Origin;
|
proxy_hide_header Access-Control-Allow-Origin;
|
||||||
proxy_hide_header Access-Control-Allow-Methods;
|
proxy_hide_header Access-Control-Allow-Methods;
|
||||||
proxy_hide_header Access-Control-Allow-Headers;
|
proxy_hide_header Access-Control-Allow-Headers;
|
||||||
|
|
||||||
root /ragflow/web/dist;
|
root /ragflow/web/dist;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
index index.html;
|
index index.html;
|
||||||
try_files $uri $uri/ /index.html;
|
try_files $uri $uri/ /index.html;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Cache-Control: max-age、Expires
|
# Cache-Control: max-age、Expires
|
||||||
location ~ ^/static/(css|js|media)/ {
|
location ~ ^/static/(css|js|media)/ {
|
||||||
expires 10y;
|
expires 10y;
|
||||||
access_log off;
|
access_log off;
|
||||||
}
|
}
|
||||||
|
|
||||||
# api proxy
|
# api proxy
|
||||||
location ^~/v1 {
|
location ^~/v1 {
|
||||||
rewrite ^/v1/(.*)$ /$1 break;
|
rewrite ^/v1/(.*)$ /$1 break;
|
||||||
proxy_pass http://api_service/;
|
proxy_pass http://api_service/;
|
||||||
proxy_set_header Host $http_host;
|
proxy_set_header Host $http_host;
|
||||||
proxy_set_header Connection close;
|
proxy_set_header Connection close;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-Server $host;
|
proxy_set_header X-Forwarded-Server $host;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,16 +5,16 @@ mysql:
|
|||||||
name: 'rag_flow'
|
name: 'rag_flow'
|
||||||
user: 'root'
|
user: 'root'
|
||||||
password: 'infini_rag_flow'
|
password: 'infini_rag_flow'
|
||||||
host: '127.0.0.1'
|
host: 'mysql'
|
||||||
port: 5455
|
port: 3306
|
||||||
max_connections: 100
|
max_connections: 100
|
||||||
stale_timeout: 30
|
stale_timeout: 30
|
||||||
minio:
|
minio:
|
||||||
user: 'rag_flow'
|
user: 'rag_flow'
|
||||||
password: 'infini_rag_flow'
|
password: 'infini_rag_flow'
|
||||||
host: '127.0.0.1:9000'
|
host: 'minio:9000'
|
||||||
es:
|
es:
|
||||||
hosts: 'http://127.0.0.1:1200'
|
hosts: 'http://es01:9200'
|
||||||
user_default_llm:
|
user_default_llm:
|
||||||
factory: '通义千问'
|
factory: '通义千问'
|
||||||
api_key: 'sk-xxxxxxxxxxxxx'
|
api_key: 'sk-xxxxxxxxxxxxx'
|
||||||
|
|||||||
@ -48,7 +48,7 @@ from api.utils.file_utils import get_project_base_directory
|
|||||||
BATCH_SIZE = 64
|
BATCH_SIZE = 64
|
||||||
|
|
||||||
FACTORY = {
|
FACTORY = {
|
||||||
ParserType.GENERAL.value: manual,
|
ParserType.GENERAL.value: laws,
|
||||||
ParserType.PAPER.value: paper,
|
ParserType.PAPER.value: paper,
|
||||||
ParserType.BOOK.value: book,
|
ParserType.BOOK.value: book,
|
||||||
ParserType.PRESENTATION.value: presentation,
|
ParserType.PRESENTATION.value: presentation,
|
||||||
|
|||||||
Reference in New Issue
Block a user