feat(infrastructure): 添加 RAGFlow 应用的 Docker 部署文件
- 新增 .env 文件,包含 Docker 部署所需的环境变量 - 新增 README.md 文件,提供 Docker 部署的说明和配置指南 - 新增 docker-compose-base.yml 和 docker-compose.yml 文件,定义 RAGFlow 应用的 Docker 服务 - 新增 entrypoint-parser.sh 和 entrypoint.sh 脚本
This commit is contained in:
parent
d0c57644c1
commit
59d958ba5e
|
@ -0,0 +1,140 @@
|
|||
# The type of doc engine to use.
|
||||
# Available options:
|
||||
# - `elasticsearch` (default)
|
||||
# - `infinity` (https://github.com/infiniflow/infinity)
|
||||
DOC_ENGINE=${DOC_ENGINE:-elasticsearch}
|
||||
|
||||
# ------------------------------
|
||||
# docker env var for specifying vector db type at startup
|
||||
# (based on the vector db type, the corresponding docker
|
||||
# compose profile will be used)
|
||||
# ------------------------------
|
||||
COMPOSE_PROFILES=${DOC_ENGINE}
|
||||
|
||||
# The version of Elasticsearch.
|
||||
STACK_VERSION=8.11.3
|
||||
|
||||
# The hostname where the Elasticsearch service is exposed
|
||||
ES_HOST=es01
|
||||
|
||||
# The port used to expose the Elasticsearch service to the host machine,
|
||||
# allowing EXTERNAL access to the service running inside the Docker container.
|
||||
ES_PORT=1200
|
||||
|
||||
# The password for Elasticsearch.
|
||||
ELASTIC_PASSWORD=infini_rag_flow
|
||||
|
||||
# The port used to expose the Kibana service to the host machine,
|
||||
# allowing EXTERNAL access to the service running inside the Docker container.
|
||||
KIBANA_PORT=6601
|
||||
KIBANA_USER=rag_flow
|
||||
KIBANA_PASSWORD=infini_rag_flow
|
||||
|
||||
# The maximum amount of the memory, in bytes, that a specific Docker container can use while running.
|
||||
# Update it according to the available memory in the host machine.
|
||||
MEM_LIMIT=8073741824
|
||||
|
||||
# The hostname where the Infinity service is exposed
|
||||
INFINITY_HOST=infinity
|
||||
|
||||
# Port to expose Infinity API to the host
|
||||
INFINITY_THRIFT_PORT=23817
|
||||
INFINITY_HTTP_PORT=23820
|
||||
INFINITY_PSQL_PORT=5432
|
||||
|
||||
# The password for MySQL.
|
||||
MYSQL_PASSWORD=infini_rag_flow
|
||||
# The hostname where the MySQL service is exposed
|
||||
MYSQL_HOST=mysql
|
||||
# The database of the MySQL service to use
|
||||
MYSQL_DBNAME=rag_flow
|
||||
# The port used to expose the MySQL service to the host machine,
|
||||
# allowing EXTERNAL access to the MySQL database running inside the Docker container.
|
||||
MYSQL_PORT=5455
|
||||
|
||||
# The hostname where the MinIO service is exposed
|
||||
MINIO_HOST=minio
|
||||
# The port used to expose the MinIO console interface to the host machine,
|
||||
# allowing EXTERNAL access to the web-based console running inside the Docker container.
|
||||
MINIO_CONSOLE_PORT=9001
|
||||
# The port used to expose the MinIO API service to the host machine,
|
||||
# allowing EXTERNAL access to the MinIO object storage service running inside the Docker container.
|
||||
MINIO_PORT=9000
|
||||
# The username for MinIO.
|
||||
# When updated, you must revise the `minio.user` entry in service_conf.yaml accordingly.
|
||||
MINIO_USER=rag_flow
|
||||
# The password for MinIO.
|
||||
# When updated, you must revise the `minio.password` entry in service_conf.yaml accordingly.
|
||||
MINIO_PASSWORD=infini_rag_flow
|
||||
|
||||
# The hostname where the Redis service is exposed
|
||||
REDIS_HOST=redis
|
||||
# The port used to expose the Redis service to the host machine,
|
||||
# allowing EXTERNAL access to the Redis service running inside the Docker container.
|
||||
REDIS_PORT=6379
|
||||
# The password for Redis.
|
||||
REDIS_PASSWORD=infini_rag_flow
|
||||
|
||||
# The port used to expose RAGFlow's HTTP API service to the host machine,
|
||||
# allowing EXTERNAL access to the service running inside the Docker container.
|
||||
SVR_HTTP_PORT=9380
|
||||
|
||||
# The RAGFlow Docker image to download.
|
||||
# Defaults to the v0.16.0-slim edition, which is the RAGFlow Docker image without embedding models.
|
||||
# RAGFLOW_IMAGE=infiniflow/ragflow:v0.16.0-slim
|
||||
#
|
||||
# To download the RAGFlow Docker image with embedding models, uncomment the following line instead:
|
||||
RAGFLOW_IMAGE=infiniflow/ragflow:v0.16.0
|
||||
#
|
||||
# The Docker image of the v0.16.0 edition includes:
|
||||
# - Built-in embedding models:
|
||||
# - BAAI/bge-large-zh-v1.5
|
||||
# - BAAI/bge-reranker-v2-m3
|
||||
# - maidalun1020/bce-embedding-base_v1
|
||||
# - maidalun1020/bce-reranker-base_v1
|
||||
# - Embedding models that will be downloaded once you select them in the RAGFlow UI:
|
||||
# - BAAI/bge-base-en-v1.5
|
||||
# - BAAI/bge-large-en-v1.5
|
||||
# - BAAI/bge-small-en-v1.5
|
||||
# - BAAI/bge-small-zh-v1.5
|
||||
# - jinaai/jina-embeddings-v2-base-en
|
||||
# - jinaai/jina-embeddings-v2-small-en
|
||||
# - nomic-ai/nomic-embed-text-v1.5
|
||||
# - sentence-transformers/all-MiniLM-L6-v2
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
# If you cannot download the RAGFlow Docker image:
|
||||
#
|
||||
# - For the `nightly-slim` edition, uncomment either of the following:
|
||||
# RAGFLOW_IMAGE=swr.cn-north-4.myhuaweicloud.com/infiniflow/ragflow:nightly-slim
|
||||
# RAGFLOW_IMAGE=registry.cn-hangzhou.aliyuncs.com/infiniflow/ragflow:nightly-slim
|
||||
#
|
||||
# - For the `nightly` edition, uncomment either of the following:
|
||||
# RAGFLOW_IMAGE=swr.cn-north-4.myhuaweicloud.com/infiniflow/ragflow:nightly
|
||||
# RAGFLOW_IMAGE=registry.cn-hangzhou.aliyuncs.com/infiniflow/ragflow:nightly
|
||||
|
||||
# The local time zone.
|
||||
TIMEZONE='Asia/Shanghai'
|
||||
|
||||
# Uncomment the following line if you have limited access to huggingface.co:
|
||||
# HF_ENDPOINT=https://hf-mirror.com
|
||||
|
||||
# Optimizations for MacOS
|
||||
# Uncomment the following line if your OS is MacOS:
|
||||
# MACOS=1
|
||||
|
||||
# The maximum file size for each uploaded file, in bytes.
|
||||
# You can uncomment this line and update the value if you wish to change the 128M file size limit
|
||||
# MAX_CONTENT_LENGTH=134217728
|
||||
# After making the change, ensure you update `client_max_body_size` in nginx/nginx.conf correspondingly.
|
||||
|
||||
# The log level for the RAGFlow's owned packages and imported packages.
|
||||
# Available level:
|
||||
# - `DEBUG`
|
||||
# - `INFO` (default)
|
||||
# - `WARNING`
|
||||
# - `ERROR`
|
||||
# For example, following line changes the log level of `ragflow.es_conn` to `DEBUG`:
|
||||
# LOG_LEVELS=ragflow.es_conn=DEBUG
|
|
@ -0,0 +1,165 @@
|
|||
# README
|
||||
|
||||
<details open>
|
||||
<summary></b>📗 Table of Contents</b></summary>
|
||||
|
||||
- 🐳 [Docker Compose](#-docker-compose)
|
||||
- 🐬 [Docker environment variables](#-docker-environment-variables)
|
||||
- 🐋 [Service configuration](#-service-configuration)
|
||||
|
||||
</details>
|
||||
|
||||
## 🐳 Docker Compose
|
||||
|
||||
- **docker-compose.yml**
|
||||
Sets up environment for RAGFlow and its dependencies.
|
||||
- **docker-compose-base.yml**
|
||||
Sets up environment for RAGFlow's dependencies: Elasticsearch/[Infinity](https://github.com/infiniflow/infinity), MySQL, MinIO, and Redis.
|
||||
|
||||
> [!CAUTION]
|
||||
> We do not actively maintain **docker-compose-CN-oc9.yml**, **docker-compose-gpu-CN-oc9.yml**, or **docker-compose-gpu.yml**, so use them at your own risk. However, you are welcome to file a pull request to improve any of them.
|
||||
|
||||
## 🐬 Docker environment variables
|
||||
|
||||
The [.env](./.env) file contains important environment variables for Docker.
|
||||
|
||||
### Elasticsearch
|
||||
|
||||
- `STACK_VERSION`
|
||||
The version of Elasticsearch. Defaults to `8.11.3`
|
||||
- `ES_PORT`
|
||||
The port used to expose the Elasticsearch service to the host machine, allowing **external** access to the service running inside the Docker container. Defaults to `1200`.
|
||||
- `ELASTIC_PASSWORD`
|
||||
The password for Elasticsearch.
|
||||
|
||||
### Kibana
|
||||
|
||||
- `KIBANA_PORT`
|
||||
The port used to expose the Kibana service to the host machine, allowing **external** access to the service running inside the Docker container. Defaults to `6601`.
|
||||
- `KIBANA_USER`
|
||||
The username for Kibana. Defaults to `rag_flow`.
|
||||
- `KIBANA_PASSWORD`
|
||||
The password for Kibana. Defaults to `infini_rag_flow`.
|
||||
|
||||
### Resource management
|
||||
|
||||
- `MEM_LIMIT`
|
||||
The maximum amount of the memory, in bytes, that *a specific* Docker container can use while running. Defaults to `8073741824`.
|
||||
|
||||
### MySQL
|
||||
|
||||
- `MYSQL_PASSWORD`
|
||||
The password for MySQL.
|
||||
- `MYSQL_PORT`
|
||||
The port used to expose the MySQL service to the host machine, allowing **external** access to the MySQL database running inside the Docker container. Defaults to `5455`.
|
||||
|
||||
### MinIO
|
||||
|
||||
- `MINIO_CONSOLE_PORT`
|
||||
The port used to expose the MinIO console interface to the host machine, allowing **external** access to the web-based console running inside the Docker container. Defaults to `9001`
|
||||
- `MINIO_PORT`
|
||||
The port used to expose the MinIO API service to the host machine, allowing **external** access to the MinIO object storage service running inside the Docker container. Defaults to `9000`.
|
||||
- `MINIO_USER`
|
||||
The username for MinIO.
|
||||
- `MINIO_PASSWORD`
|
||||
The password for MinIO.
|
||||
|
||||
### Redis
|
||||
|
||||
- `REDIS_PORT`
|
||||
The port used to expose the Redis service to the host machine, allowing **external** access to the Redis service running inside the Docker container. Defaults to `6379`.
|
||||
- `REDIS_PASSWORD`
|
||||
The password for Redis.
|
||||
|
||||
### RAGFlow
|
||||
|
||||
- `SVR_HTTP_PORT`
|
||||
The port used to expose RAGFlow's HTTP API service to the host machine, allowing **external** access to the service running inside the Docker container. Defaults to `9380`.
|
||||
- `RAGFLOW-IMAGE`
|
||||
The Docker image edition. Available editions:
|
||||
|
||||
- `infiniflow/ragflow:v0.16.0-slim` (default): The RAGFlow Docker image without embedding models.
|
||||
- `infiniflow/ragflow:v0.16.0`: The RAGFlow Docker image with embedding models including:
|
||||
- Built-in embedding models:
|
||||
- `BAAI/bge-large-zh-v1.5`
|
||||
- `BAAI/bge-reranker-v2-m3`
|
||||
- `maidalun1020/bce-embedding-base_v1`
|
||||
- `maidalun1020/bce-reranker-base_v1`
|
||||
- Embedding models that will be downloaded once you select them in the RAGFlow UI:
|
||||
- `BAAI/bge-base-en-v1.5`
|
||||
- `BAAI/bge-large-en-v1.5`
|
||||
- `BAAI/bge-small-en-v1.5`
|
||||
- `BAAI/bge-small-zh-v1.5`
|
||||
- `jinaai/jina-embeddings-v2-base-en`
|
||||
- `jinaai/jina-embeddings-v2-small-en`
|
||||
- `nomic-ai/nomic-embed-text-v1.5`
|
||||
- `sentence-transformers/all-MiniLM-L6-v2`
|
||||
|
||||
> [!TIP]
|
||||
> If you cannot download the RAGFlow Docker image, try the following mirrors.
|
||||
>
|
||||
> - For the `nightly-slim` edition:
|
||||
> - `RAGFLOW_IMAGE=swr.cn-north-4.myhuaweicloud.com/infiniflow/ragflow:nightly-slim` or,
|
||||
> - `RAGFLOW_IMAGE=registry.cn-hangzhou.aliyuncs.com/infiniflow/ragflow:nightly-slim`.
|
||||
> - For the `nightly` edition:
|
||||
> - `RAGFLOW_IMAGE=swr.cn-north-4.myhuaweicloud.com/infiniflow/ragflow:nightly` or,
|
||||
> - `RAGFLOW_IMAGE=registry.cn-hangzhou.aliyuncs.com/infiniflow/ragflow:nightly`.
|
||||
|
||||
### Timezone
|
||||
|
||||
- `TIMEZONE`
|
||||
The local time zone. Defaults to `'Asia/Shanghai'`.
|
||||
|
||||
### Hugging Face mirror site
|
||||
|
||||
- `HF_ENDPOINT`
|
||||
The mirror site for huggingface.co. It is disabled by default. You can uncomment this line if you have limited access to the primary Hugging Face domain.
|
||||
|
||||
### MacOS
|
||||
|
||||
- `MACOS`
|
||||
Optimizations for macOS. It is disabled by default. You can uncomment this line if your OS is macOS.
|
||||
|
||||
### Maximum file size
|
||||
|
||||
- `MAX_CONTENT_LENGTH`
|
||||
The maximum file size for each uploaded file, in bytes. You can uncomment this line if you wish to change the 128M file size limit. After making the change, ensure you update `client_max_body_size` in nginx/nginx.conf correspondingly.
|
||||
|
||||
## 🐋 Service configuration
|
||||
|
||||
[service_conf.yaml](./service_conf.yaml) specifies the system-level configuration for RAGFlow and is used by its API server and task executor. In a dockerized setup, this file is automatically created based on the [service_conf.yaml.template](./service_conf.yaml.template) file (replacing all environment variables by their values).
|
||||
|
||||
- `ragflow`
|
||||
- `host`: The API server's IP address inside the Docker container. Defaults to `0.0.0.0`.
|
||||
- `port`: The API server's serving port inside the Docker container. Defaults to `9380`.
|
||||
|
||||
- `mysql`
|
||||
- `name`: The MySQL database name. Defaults to `rag_flow`.
|
||||
- `user`: The username for MySQL.
|
||||
- `password`: The password for MySQL.
|
||||
- `port`: The MySQL serving port inside the Docker container. Defaults to `3306`.
|
||||
- `max_connections`: The maximum number of concurrent connections to the MySQL database. Defaults to `100`.
|
||||
- `stale_timeout`: Timeout in seconds.
|
||||
|
||||
- `minio`
|
||||
- `user`: The username for MinIO.
|
||||
- `password`: The password for MinIO.
|
||||
- `host`: The MinIO serving IP *and* port inside the Docker container. Defaults to `minio:9000`.
|
||||
|
||||
- `oauth`
|
||||
The OAuth configuration for signing up or signing in to RAGFlow using a third-party account. It is disabled by default. To enable this feature, uncomment the corresponding lines in **service_conf.yaml.template**.
|
||||
- `github`: The GitHub authentication settings for your application. Visit the [Github Developer Settings page](https://github.com/settings/developers) to obtain your client_id and secret_key.
|
||||
|
||||
- `user_default_llm`
|
||||
The default LLM to use for a new RAGFlow user. It is disabled by default. To enable this feature, uncomment the corresponding lines in **service_conf.yaml.template**.
|
||||
- `factory`: The LLM supplier. Available options:
|
||||
- `"OpenAI"`
|
||||
- `"DeepSeek"`
|
||||
- `"Moonshot"`
|
||||
- `"Tongyi-Qianwen"`
|
||||
- `"VolcEngine"`
|
||||
- `"ZHIPU-AI"`
|
||||
- `api_key`: The API key for the specified LLM. You will need to apply for your model API key online.
|
||||
|
||||
> [!TIP]
|
||||
> If you do not set the default LLM here, configure the default LLM on the **Settings** page in the RAGFlow UI.
|
|
@ -0,0 +1,146 @@
|
|||
services:
|
||||
es01:
|
||||
container_name: ragflow-es-01
|
||||
profiles:
|
||||
- elasticsearch
|
||||
image: elasticsearch:${STACK_VERSION}
|
||||
volumes:
|
||||
- esdata01:/usr/share/elasticsearch/data
|
||||
ports:
|
||||
- ${ES_PORT}:9200
|
||||
env_file: .env
|
||||
environment:
|
||||
- node.name=es01
|
||||
- ELASTIC_PASSWORD=${ELASTIC_PASSWORD}
|
||||
- bootstrap.memory_lock=false
|
||||
- discovery.type=single-node
|
||||
- xpack.security.enabled=true
|
||||
- xpack.security.http.ssl.enabled=false
|
||||
- xpack.security.transport.ssl.enabled=false
|
||||
- cluster.routing.allocation.disk.watermark.low=5gb
|
||||
- cluster.routing.allocation.disk.watermark.high=3gb
|
||||
- cluster.routing.allocation.disk.watermark.flood_stage=2gb
|
||||
- TZ=${TIMEZONE}
|
||||
mem_limit: ${MEM_LIMIT}
|
||||
ulimits:
|
||||
memlock:
|
||||
soft: -1
|
||||
hard: -1
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl http://localhost:9200"]
|
||||
interval: 10s
|
||||
timeout: 10s
|
||||
retries: 120
|
||||
networks:
|
||||
- ragflow
|
||||
restart: on-failure
|
||||
|
||||
infinity:
|
||||
container_name: ragflow-infinity
|
||||
profiles:
|
||||
- infinity
|
||||
image: infiniflow/infinity:v0.6.0-dev3
|
||||
volumes:
|
||||
- infinity_data:/var/infinity
|
||||
- ./infinity_conf.toml:/infinity_conf.toml
|
||||
command: ["-f", "/infinity_conf.toml"]
|
||||
ports:
|
||||
- ${INFINITY_THRIFT_PORT}:23817
|
||||
- ${INFINITY_HTTP_PORT}:23820
|
||||
- ${INFINITY_PSQL_PORT}:5432
|
||||
env_file: .env
|
||||
environment:
|
||||
- TZ=${TIMEZONE}
|
||||
mem_limit: ${MEM_LIMIT}
|
||||
ulimits:
|
||||
nofile:
|
||||
soft: 500000
|
||||
hard: 500000
|
||||
networks:
|
||||
- ragflow
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "http://localhost:23820/admin/node/current"]
|
||||
interval: 10s
|
||||
timeout: 10s
|
||||
retries: 120
|
||||
restart: on-failure
|
||||
|
||||
|
||||
mysql:
|
||||
# mysql:5.7 linux/arm64 image is unavailable.
|
||||
image: mysql:8.0.39
|
||||
container_name: ragflow-mysql
|
||||
env_file: .env
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=${MYSQL_PASSWORD}
|
||||
- TZ=${TIMEZONE}
|
||||
command:
|
||||
--max_connections=1000
|
||||
--character-set-server=utf8mb4
|
||||
--collation-server=utf8mb4_unicode_ci
|
||||
--default-authentication-plugin=mysql_native_password
|
||||
--tls_version="TLSv1.2,TLSv1.3"
|
||||
--init-file /data/application/init.sql
|
||||
ports:
|
||||
- ${MYSQL_PORT}:3306
|
||||
volumes:
|
||||
- mysql_data:/var/lib/mysql
|
||||
- ./init.sql:/data/application/init.sql
|
||||
networks:
|
||||
- ragflow
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin" ,"ping", "-uroot", "-p${MYSQL_PASSWORD}"]
|
||||
interval: 10s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
restart: on-failure
|
||||
|
||||
minio:
|
||||
image: quay.io/minio/minio:RELEASE.2023-12-20T01-00-02Z
|
||||
container_name: ragflow-minio
|
||||
command: server --console-address ":9001" /data
|
||||
ports:
|
||||
- ${MINIO_PORT}:9000
|
||||
- ${MINIO_CONSOLE_PORT}:9001
|
||||
env_file: .env
|
||||
environment:
|
||||
- MINIO_ROOT_USER=${MINIO_USER}
|
||||
- MINIO_ROOT_PASSWORD=${MINIO_PASSWORD}
|
||||
- TZ=${TIMEZONE}
|
||||
volumes:
|
||||
- minio_data:/data
|
||||
networks:
|
||||
- ragflow
|
||||
restart: on-failure
|
||||
|
||||
redis:
|
||||
# swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/valkey/valkey:8
|
||||
image: valkey/valkey:8
|
||||
container_name: ragflow-redis
|
||||
command: redis-server --requirepass ${REDIS_PASSWORD} --maxmemory 128mb --maxmemory-policy allkeys-lru
|
||||
env_file: .env
|
||||
ports:
|
||||
- ${REDIS_PORT}:6379
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
networks:
|
||||
- ragflow
|
||||
restart: on-failure
|
||||
|
||||
|
||||
|
||||
volumes:
|
||||
esdata01:
|
||||
driver: local
|
||||
infinity_data:
|
||||
driver: local
|
||||
mysql_data:
|
||||
driver: local
|
||||
minio_data:
|
||||
driver: local
|
||||
redis_data:
|
||||
driver: local
|
||||
|
||||
networks:
|
||||
ragflow:
|
||||
driver: bridge
|
|
@ -0,0 +1,53 @@
|
|||
include:
|
||||
- ./docker-compose-base.yml
|
||||
|
||||
services:
|
||||
ragflow:
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
image: ${RAGFLOW_IMAGE}
|
||||
container_name: ragflow-server
|
||||
ports:
|
||||
- ${SVR_HTTP_PORT}:9380
|
||||
- 80:80
|
||||
- 443:443
|
||||
volumes:
|
||||
- ./ragflow-logs:/ragflow/logs
|
||||
- ./nginx/ragflow.conf:/etc/nginx/conf.d/ragflow.conf
|
||||
- ./nginx/proxy.conf:/etc/nginx/proxy.conf
|
||||
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
|
||||
env_file: .env
|
||||
environment:
|
||||
- TZ=${TIMEZONE}
|
||||
- HF_ENDPOINT=${HF_ENDPOINT}
|
||||
- MACOS=${MACOS}
|
||||
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"
|
||||
# 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,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;
|
|
@ -0,0 +1,34 @@
|
|||
#!/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
|
||||
|
||||
/usr/sbin/nginx
|
||||
|
||||
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/
|
||||
|
||||
PY=python3
|
||||
if [[ -z "$WS" || $WS -lt 1 ]]; then
|
||||
WS=1
|
||||
fi
|
||||
|
||||
function task_exe(){
|
||||
while [ 1 -eq 1 ];do
|
||||
$PY rag/svr/task_executor.py $1;
|
||||
done
|
||||
}
|
||||
|
||||
for ((i=0;i<WS;i++))
|
||||
do
|
||||
task_exe $i &
|
||||
done
|
||||
|
||||
while [ 1 -eq 1 ];do
|
||||
$PY api/ragflow_server.py
|
||||
done
|
||||
|
||||
wait;
|
|
@ -0,0 +1,66 @@
|
|||
[general]
|
||||
version = "0.6.0"
|
||||
time_zone = "utc-8"
|
||||
|
||||
[network]
|
||||
server_address = "0.0.0.0"
|
||||
postgres_port = 5432
|
||||
http_port = 23820
|
||||
client_port = 23817
|
||||
connection_pool_size = 128
|
||||
|
||||
[log]
|
||||
log_filename = "infinity.log"
|
||||
log_dir = "/var/infinity/log"
|
||||
log_to_stdout = true
|
||||
log_file_max_size = "100MB"
|
||||
log_file_rotate_count = 10
|
||||
|
||||
# trace/debug/info/warning/error/critical 6 log levels, default: info
|
||||
log_level = "info"
|
||||
|
||||
[storage]
|
||||
persistence_dir = "/var/infinity/persistence"
|
||||
data_dir = "/var/infinity/data"
|
||||
# periodically activates garbage collection:
|
||||
# 0 means real-time,
|
||||
# s means seconds, for example "60s", 60 seconds
|
||||
# m means minutes, for example "60m", 60 minutes
|
||||
# h means hours, for example "1h", 1 hour
|
||||
optimize_interval = "10s"
|
||||
cleanup_interval = "60s"
|
||||
compact_interval = "120s"
|
||||
storage_type = "local"
|
||||
|
||||
# dump memory index entry when it reachs the capacity
|
||||
mem_index_capacity = 65536
|
||||
|
||||
# S3 storage config example:
|
||||
# [storage.object_storage]
|
||||
# url = "127.0.0.1:9000"
|
||||
# bucket_name = "infinity"
|
||||
# access_key = "minioadmin"
|
||||
# secret_key = "minioadmin"
|
||||
# enable_https = false
|
||||
|
||||
[buffer]
|
||||
buffer_manager_size = "8GB"
|
||||
lru_num = 7
|
||||
temp_dir = "/var/infinity/tmp"
|
||||
result_cache = "off"
|
||||
memindex_memory_quota = "4GB"
|
||||
|
||||
[wal]
|
||||
wal_dir = "/var/infinity/wal"
|
||||
full_checkpoint_interval = "30s"
|
||||
delta_checkpoint_interval = "5s"
|
||||
# delta_checkpoint_threshold = 1000000000
|
||||
wal_compact_threshold = "1GB"
|
||||
|
||||
# flush_at_once: write and flush log each commit
|
||||
# only_write: write log, OS control when to flush the log, default
|
||||
# flush_per_second: logs are written after each commit and flushed to disk per second.
|
||||
wal_flush = "only_write"
|
||||
|
||||
[resource]
|
||||
resource_dir = "/var/infinity/resource"
|
|
@ -0,0 +1,2 @@
|
|||
CREATE DATABASE IF NOT EXISTS rag_flow;
|
||||
USE rag_flow;
|
|
@ -0,0 +1,103 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Exit immediately if a command exits with a non-zero status
|
||||
set -e
|
||||
|
||||
# Unset HTTP proxies that might be set by Docker daemon
|
||||
export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY=""
|
||||
|
||||
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/
|
||||
|
||||
PY=python3
|
||||
|
||||
# Set default number of workers if WS is not set or less than 1
|
||||
if [[ -z "$WS" || $WS -lt 1 ]]; then
|
||||
WS=1
|
||||
fi
|
||||
|
||||
# Maximum number of retries for each task executor and server
|
||||
MAX_RETRIES=5
|
||||
|
||||
# Flag to control termination
|
||||
STOP=false
|
||||
|
||||
# Array to keep track of child PIDs
|
||||
PIDS=()
|
||||
|
||||
# Function to handle termination signals
|
||||
cleanup() {
|
||||
echo "Termination signal received. Shutting down..."
|
||||
STOP=true
|
||||
# Terminate all child processes
|
||||
for pid in "${PIDS[@]}"; do
|
||||
if kill -0 "$pid" 2>/dev/null; then
|
||||
echo "Killing process $pid"
|
||||
kill "$pid"
|
||||
fi
|
||||
done
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Trap SIGINT and SIGTERM to invoke cleanup
|
||||
trap cleanup SIGINT SIGTERM
|
||||
|
||||
# Function to execute task_executor with retry logic
|
||||
task_exe(){
|
||||
local task_id=$1
|
||||
local retry_count=0
|
||||
while ! $STOP && [ $retry_count -lt $MAX_RETRIES ]; do
|
||||
echo "Starting task_executor.py for task $task_id (Attempt $((retry_count+1)))"
|
||||
$PY rag/svr/task_executor.py "$task_id"
|
||||
EXIT_CODE=$?
|
||||
if [ $EXIT_CODE -eq 0 ]; then
|
||||
echo "task_executor.py for task $task_id exited successfully."
|
||||
break
|
||||
else
|
||||
echo "task_executor.py for task $task_id failed with exit code $EXIT_CODE. Retrying..." >&2
|
||||
retry_count=$((retry_count + 1))
|
||||
sleep 2
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $retry_count -ge $MAX_RETRIES ]; then
|
||||
echo "task_executor.py for task $task_id failed after $MAX_RETRIES attempts. Exiting..." >&2
|
||||
cleanup
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to execute ragflow_server with retry logic
|
||||
run_server(){
|
||||
local retry_count=0
|
||||
while ! $STOP && [ $retry_count -lt $MAX_RETRIES ]; do
|
||||
echo "Starting ragflow_server.py (Attempt $((retry_count+1)))"
|
||||
$PY api/ragflow_server.py
|
||||
EXIT_CODE=$?
|
||||
if [ $EXIT_CODE -eq 0 ]; then
|
||||
echo "ragflow_server.py exited successfully."
|
||||
break
|
||||
else
|
||||
echo "ragflow_server.py failed with exit code $EXIT_CODE. Retrying..." >&2
|
||||
retry_count=$((retry_count + 1))
|
||||
sleep 2
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $retry_count -ge $MAX_RETRIES ]; then
|
||||
echo "ragflow_server.py failed after $MAX_RETRIES attempts. Exiting..." >&2
|
||||
cleanup
|
||||
fi
|
||||
}
|
||||
|
||||
# Start task executors
|
||||
for ((i=0;i<WS;i++))
|
||||
do
|
||||
task_exe "$i" &
|
||||
PIDS+=($!)
|
||||
done
|
||||
|
||||
# Start the main server
|
||||
run_server &
|
||||
PIDS+=($!)
|
||||
|
||||
# Wait for all background processes to finish
|
||||
wait
|
|
@ -0,0 +1,33 @@
|
|||
user root;
|
||||
worker_processes auto;
|
||||
|
||||
error_log /var/log/nginx/error.log notice;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
#gzip on;
|
||||
client_max_body_size 128M;
|
||||
|
||||
include /etc/nginx/conf.d/ragflow.conf;
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "";
|
||||
proxy_buffering off;
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 3600s;
|
|
@ -0,0 +1,29 @@
|
|||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
root /ragflow/web/dist;
|
||||
|
||||
gzip on;
|
||||
gzip_min_length 1k;
|
||||
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_vary on;
|
||||
gzip_disable "MSIE [1-6]\.";
|
||||
|
||||
location ~ ^/(v1|api) {
|
||||
proxy_pass http://ragflow:9380;
|
||||
include proxy.conf;
|
||||
}
|
||||
|
||||
|
||||
location / {
|
||||
index index.html;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# Cache-Control: max-age~@~AExpires
|
||||
location ~ ^/static/(css|js|media)/ {
|
||||
expires 10y;
|
||||
access_log off;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
ragflow:
|
||||
host: ${RAGFLOW_HOST:-0.0.0.0}
|
||||
http_port: 9380
|
||||
mysql:
|
||||
name: '${MYSQL_DBNAME:-rag_flow}'
|
||||
user: '${MYSQL_USER:-root}'
|
||||
password: '${MYSQL_PASSWORD:-infini_rag_flow}'
|
||||
host: '${MYSQL_HOST:-mysql}'
|
||||
port: 3306
|
||||
max_connections: 100
|
||||
stale_timeout: 30
|
||||
minio:
|
||||
user: '${MINIO_USER:-rag_flow}'
|
||||
password: '${MINIO_PASSWORD:-infini_rag_flow}'
|
||||
host: '${MINIO_HOST:-minio}:9000'
|
||||
es:
|
||||
hosts: 'http://${ES_HOST:-es01}:9200'
|
||||
username: '${ES_USER:-elastic}'
|
||||
password: '${ELASTIC_PASSWORD:-infini_rag_flow}'
|
||||
infinity:
|
||||
uri: '${INFINITY_HOST:-infinity}:23817'
|
||||
db_name: 'default_db'
|
||||
redis:
|
||||
db: 1
|
||||
password: '${REDIS_PASSWORD:-infini_rag_flow}'
|
||||
host: '${REDIS_HOST:-redis}:6379'
|
||||
|
||||
# postgres:
|
||||
# name: '${POSTGRES_DBNAME:-rag_flow}'
|
||||
# user: '${POSTGRES_USER:-rag_flow}'
|
||||
# password: '${POSTGRES_PASSWORD:-infini_rag_flow}'
|
||||
# host: '${POSTGRES_HOST:-postgres}'
|
||||
# port: 5432
|
||||
# max_connections: 100
|
||||
# stale_timeout: 30
|
||||
# s3:
|
||||
# access_key: 'access_key'
|
||||
# secret_key: 'secret_key'
|
||||
# region: 'region'
|
||||
# azure:
|
||||
# auth_type: 'sas'
|
||||
# container_url: 'container_url'
|
||||
# sas_token: 'sas_token'
|
||||
# azure:
|
||||
# auth_type: 'spn'
|
||||
# account_url: 'account_url'
|
||||
# client_id: 'client_id'
|
||||
# secret: 'secret'
|
||||
# tenant_id: 'tenant_id'
|
||||
# container_name: 'container_name'
|
||||
# user_default_llm:
|
||||
# factory: 'Tongyi-Qianwen'
|
||||
# api_key: 'sk-xxxxxxxxxxxxx'
|
||||
# base_url: ''
|
||||
# oauth:
|
||||
# github:
|
||||
# client_id: xxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
# secret_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
# url: https://github.com/login/oauth/access_token
|
||||
# feishu:
|
||||
# app_id: cli_xxxxxxxxxxxxxxxxxxx
|
||||
# app_secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
# app_access_token_url: https://open.feishu.cn/open-apis/auth/v3/app_access_token/internal
|
||||
# user_access_token_url: https://open.feishu.cn/open-apis/authen/v1/oidc/access_token
|
||||
# grant_type: 'authorization_code'
|
||||
# authentication:
|
||||
# client:
|
||||
# switch: false
|
||||
# http_app_key:
|
||||
# http_secret_key:
|
||||
# site:
|
||||
# switch: false
|
||||
# permission:
|
||||
# switch: false
|
||||
# component: false
|
||||
# dataset: false
|
|
@ -0,0 +1,20 @@
|
|||
# 使用说明
|
||||
|
||||
## 服务地址
|
||||
|
||||
* 访问地址:[http://IP:3005/searxng](http://ip:3005/searxng)
|
||||
* 无需用户名和密码(默认情况下,SearXNG是公开可用的,除非进行了额外的访问限制配置)
|
||||
|
||||
# SearXNG
|
||||
|
||||
`SearXNG 是一个开源的、去中心化的搜索引擎,旨在提供隐私保护和无广告的搜索体验。`## SearXNG 的关键特性
|
||||
|
||||
* **隐私保护:** 不记录用户的搜索历史和个人信息,确保用户的隐私安全。不依赖于任何单一的商业搜索引擎,避免数据被集中收集。
|
||||
* **去中心化:** 支持分布式部署,用户可以自行搭建和运行SearXNG实例,减少对中心化搜索引擎的依赖。
|
||||
* **高度可定制:** 提供丰富的配置选项,用户可以根据自己的需求调整搜索结果的来源、外观和功能。支持添加或移除特定的搜索引擎插件。
|
||||
* **多语言支持:** 支持多种语言的搜索和界面显示,满足不同地区用户的需求。
|
||||
* **无广告:** 搜索结果页面完全无广告,提供更纯净的搜索体验。
|
||||
* **开源:** 基于开源许可,用户可以自由查看、修改和分发代码,促进社区的共同开发和改进。
|
||||
* **轻量级:** 对服务器资源要求较低,易于部署和维护,适合个人和小型团队使用。
|
||||
* **服务治理:** 支持结果过滤和排序,可以根据用户偏好进行定制化搜索。支持RSS订阅功能,方便用户获取最新信息。 以上介绍提供了SearXNG的基本信息,包括服务地址、关键特性和特色,帮助用户快速了解SearXNG的主要功能和优势。
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
name: SearXNG
|
||||
tags:
|
||||
- 中间件
|
||||
title: 隐私保护的开源元搜索引擎
|
||||
description: 一个注重隐私保护的开源元搜索引擎,能够聚合多个搜索引擎的结果,为用户提供无追踪的搜索体验。它是SearX项目的升级版,遵循自由开源许可,致力于保护用户隐私和提供更丰富的搜索功能。
|
||||
additionalProperties:
|
||||
key: searxng
|
||||
name: SearXNG
|
||||
tags:
|
||||
- Middleware
|
||||
shortDescZh: 隐私保护的开源元搜索引擎
|
||||
shortDescEn: Privacy-focused open-source meta search engine
|
||||
type: tool
|
||||
crossVersionUpdate: false
|
||||
limit: 1
|
||||
recommend: 0
|
||||
website: https://searxng.org
|
||||
github: https://github.com/searxng/searxng
|
||||
document: https://docs.searxng.org/
|
Binary file not shown.
After Width: | Height: | Size: 9.3 KiB |
Loading…
Reference in New Issue