Updated README on debugging web and python (#2544)
Browse files### What problem does this PR solve?
Updated README on debugging web and python
### Type of change
- [x] Documentation Update
- README.md +25 -62
- conf/service_conf.yaml +0 -73
- conf/service_conf.yaml +1 -0
- docker/.env +1 -1
- docker/service_conf.yaml +51 -20
- web/.umirc.ts +1 -1
README.md
CHANGED
|
@@ -42,8 +42,8 @@
|
|
| 42 |
- π [System Architecture](#-system-architecture)
|
| 43 |
- π¬ [Get Started](#-get-started)
|
| 44 |
- π§ [Configurations](#-configurations)
|
| 45 |
-
- π οΈ [Build
|
| 46 |
-
- π οΈ [Launch service from source](#-launch-service-from-source)
|
| 47 |
- π [Documentation](#-documentation)
|
| 48 |
- π [Roadmap](#-roadmap)
|
| 49 |
- π [Community](#-community)
|
|
@@ -150,15 +150,12 @@ Try our demo at [https://demo.ragflow.io](https://demo.ragflow.io).
|
|
| 150 |
```
|
| 151 |
|
| 152 |
3. Build the pre-built Docker images and start up the server:
|
| 153 |
-
|
| 154 |
> Running the following commands automatically downloads the *dev* version RAGFlow Docker image. To download and run a specified Docker version, update `RAGFLOW_VERSION` in **docker/.env** to the intended version, for example `RAGFLOW_VERSION=v0.11.0`, before running the following commands.
|
| 155 |
|
| 156 |
```bash
|
| 157 |
$ cd ragflow/docker
|
| 158 |
-
$ chmod +x ./entrypoint.sh
|
| 159 |
$ docker compose up -d
|
| 160 |
```
|
| 161 |
-
|
| 162 |
|
| 163 |
> The core image is about 9 GB in size and may take a while to load.
|
| 164 |
|
|
@@ -207,26 +204,23 @@ You must ensure that changes to the [.env](./docker/.env) file are in line with
|
|
| 207 |
|
| 208 |
To update the default HTTP serving port (80), go to [docker-compose.yml](./docker/docker-compose.yml) and change `80:80` to `<YOUR_SERVING_PORT>:80`.
|
| 209 |
|
| 210 |
-
|
| 211 |
-
|
| 212 |
> ```bash
|
| 213 |
-
> $ docker-compose up -d
|
| 214 |
> ```
|
| 215 |
|
| 216 |
-
## π οΈ Build
|
| 217 |
|
| 218 |
To build the Docker images from source:
|
| 219 |
|
| 220 |
```bash
|
| 221 |
$ git clone https://github.com/infiniflow/ragflow.git
|
| 222 |
$ cd ragflow/
|
| 223 |
-
$ docker build -t infiniflow/ragflow:dev .
|
| 224 |
-
$ cd ragflow/docker
|
| 225 |
-
$ chmod +x ./entrypoint.sh
|
| 226 |
-
$ docker compose up -d
|
| 227 |
```
|
| 228 |
|
| 229 |
-
## π οΈ Launch service from source
|
| 230 |
|
| 231 |
To launch the service from source:
|
| 232 |
|
|
@@ -237,88 +231,57 @@ To launch the service from source:
|
|
| 237 |
$ cd ragflow/
|
| 238 |
```
|
| 239 |
|
| 240 |
-
2.
|
| 241 |
|
| 242 |
```bash
|
| 243 |
-
$
|
| 244 |
-
$
|
| 245 |
-
$ pip install -r requirements.txt
|
| 246 |
-
```
|
| 247 |
-
|
| 248 |
-
```bash
|
| 249 |
-
# If your CUDA version is higher than 12.0, run the following additional commands:
|
| 250 |
-
$ pip uninstall -y onnxruntime-gpu
|
| 251 |
-
$ pip install onnxruntime-gpu --extra-index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-12/pypi/simple/
|
| 252 |
```
|
| 253 |
|
| 254 |
3. Copy the entry script and configure environment variables:
|
| 255 |
-
|
| 256 |
-
```bash
|
| 257 |
-
# Get the Python path:
|
| 258 |
-
$ which python
|
| 259 |
-
# Get the ragflow project path:
|
| 260 |
-
$ pwd
|
| 261 |
-
```
|
| 262 |
|
| 263 |
-
```bash
|
| 264 |
-
$ cp docker/entrypoint.sh .
|
| 265 |
-
$ vi entrypoint.sh
|
| 266 |
-
```
|
| 267 |
-
|
| 268 |
```bash
|
| 269 |
# Adjust configurations according to your actual situation (the following two export commands are newly added):
|
| 270 |
-
# - Assign the result of `which python` to `PY`.
|
| 271 |
-
# - Assign the result of `pwd` to `PYTHONPATH`.
|
| 272 |
# - Comment out `LD_LIBRARY_PATH`, if it is configured.
|
| 273 |
# - Optional: Add Hugging Face mirror.
|
| 274 |
-
|
| 275 |
-
export PYTHONPATH=$
|
| 276 |
export HF_ENDPOINT=https://hf-mirror.com
|
| 277 |
```
|
| 278 |
|
| 279 |
4. Launch the third-party services (MinIO, Elasticsearch, Redis, and MySQL):
|
| 280 |
|
| 281 |
```bash
|
| 282 |
-
$
|
| 283 |
-
$ docker compose -f docker-compose-base.yml up -d
|
| 284 |
```
|
| 285 |
|
| 286 |
-
5.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 287 |
|
| 288 |
-
|
| 289 |
-
- The IP addresses and ports for related services in **service_conf.yaml** match the local machine IP and ports exposed by the container.
|
| 290 |
|
| 291 |
6. Launch the RAGFlow backend service:
|
|
|
|
| 292 |
|
| 293 |
```bash
|
| 294 |
-
$
|
| 295 |
-
$ bash ./entrypoint.sh
|
| 296 |
```
|
| 297 |
|
| 298 |
7. Launch the frontend service:
|
| 299 |
|
| 300 |
```bash
|
| 301 |
$ cd web
|
| 302 |
-
$ npm install --
|
| 303 |
$ vim .umirc.ts
|
| 304 |
# Update proxy.target to http://127.0.0.1:9380
|
| 305 |
$ npm run dev
|
| 306 |
```
|
| 307 |
|
| 308 |
-
8.
|
| 309 |
-
|
| 310 |
-
```bash
|
| 311 |
-
$ cd web
|
| 312 |
-
$ npm install --registry=https://registry.npmmirror.com --force
|
| 313 |
-
$ umi build
|
| 314 |
-
$ mkdir -p /ragflow/web
|
| 315 |
-
$ cp -r dist /ragflow/web
|
| 316 |
-
$ apt install nginx -y
|
| 317 |
-
$ cp ../docker/nginx/proxy.conf /etc/nginx
|
| 318 |
-
$ cp ../docker/nginx/nginx.conf /etc/nginx
|
| 319 |
-
$ cp ../docker/nginx/ragflow.conf /etc/nginx/conf.d
|
| 320 |
-
$ systemctl start nginx
|
| 321 |
-
```
|
| 322 |
|
| 323 |
## π Documentation
|
| 324 |
|
|
|
|
| 42 |
- π [System Architecture](#-system-architecture)
|
| 43 |
- π¬ [Get Started](#-get-started)
|
| 44 |
- π§ [Configurations](#-configurations)
|
| 45 |
+
- π οΈ [Build RAGFlow image](#-build-ragflow-image)
|
| 46 |
+
- π οΈ [Launch service from source for development](#-launch-service-from-source-for-development)
|
| 47 |
- π [Documentation](#-documentation)
|
| 48 |
- π [Roadmap](#-roadmap)
|
| 49 |
- π [Community](#-community)
|
|
|
|
| 150 |
```
|
| 151 |
|
| 152 |
3. Build the pre-built Docker images and start up the server:
|
|
|
|
| 153 |
> Running the following commands automatically downloads the *dev* version RAGFlow Docker image. To download and run a specified Docker version, update `RAGFLOW_VERSION` in **docker/.env** to the intended version, for example `RAGFLOW_VERSION=v0.11.0`, before running the following commands.
|
| 154 |
|
| 155 |
```bash
|
| 156 |
$ cd ragflow/docker
|
|
|
|
| 157 |
$ docker compose up -d
|
| 158 |
```
|
|
|
|
| 159 |
|
| 160 |
> The core image is about 9 GB in size and may take a while to load.
|
| 161 |
|
|
|
|
| 204 |
|
| 205 |
To update the default HTTP serving port (80), go to [docker-compose.yml](./docker/docker-compose.yml) and change `80:80` to `<YOUR_SERVING_PORT>:80`.
|
| 206 |
|
| 207 |
+
Updates to the above configurations require a reboot of all containers to take effect:
|
| 208 |
+
|
| 209 |
> ```bash
|
| 210 |
+
> $ docker-compose -f docker/docker-compose.yml up -d
|
| 211 |
> ```
|
| 212 |
|
| 213 |
+
## π οΈ Build RAGFlow image
|
| 214 |
|
| 215 |
To build the Docker images from source:
|
| 216 |
|
| 217 |
```bash
|
| 218 |
$ git clone https://github.com/infiniflow/ragflow.git
|
| 219 |
$ cd ragflow/
|
| 220 |
+
$ docker build -f Dockerfile.scratch -t infiniflow/ragflow:dev .
|
|
|
|
|
|
|
|
|
|
| 221 |
```
|
| 222 |
|
| 223 |
+
## π οΈ Launch service from source for development
|
| 224 |
|
| 225 |
To launch the service from source:
|
| 226 |
|
|
|
|
| 231 |
$ cd ragflow/
|
| 232 |
```
|
| 233 |
|
| 234 |
+
2. Install all python dependencies in a newly created virtual environment named `.venv`:
|
| 235 |
|
| 236 |
```bash
|
| 237 |
+
$ curl -sSL https://install.python-poetry.org | python3 -
|
| 238 |
+
$ $HOME/.local/bin/poetry install --sync --no-root
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 239 |
```
|
| 240 |
|
| 241 |
3. Copy the entry script and configure environment variables:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 242 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 243 |
```bash
|
| 244 |
# Adjust configurations according to your actual situation (the following two export commands are newly added):
|
|
|
|
|
|
|
| 245 |
# - Comment out `LD_LIBRARY_PATH`, if it is configured.
|
| 246 |
# - Optional: Add Hugging Face mirror.
|
| 247 |
+
source ~/.venv/bin/activate
|
| 248 |
+
export PYTHONPATH=$(pwd)
|
| 249 |
export HF_ENDPOINT=https://hf-mirror.com
|
| 250 |
```
|
| 251 |
|
| 252 |
4. Launch the third-party services (MinIO, Elasticsearch, Redis, and MySQL):
|
| 253 |
|
| 254 |
```bash
|
| 255 |
+
$ docker compose -f docker/docker-compose-base.yml up -d
|
|
|
|
| 256 |
```
|
| 257 |
|
| 258 |
+
5. Adjust configurations
|
| 259 |
+
Add the following line to `/etc/hosts` to resolve all hosts in `docker/service_conf.yaml` to `127.0.0.1`:
|
| 260 |
+
|
| 261 |
+
```
|
| 262 |
+
127.0.0.1 es01 mysql minio redis
|
| 263 |
+
```
|
| 264 |
|
| 265 |
+
Edit `docker/service_conf.yaml` to change mysql port to `5455` and es port to `1200`, as specified in `docker/.env`.
|
|
|
|
| 266 |
|
| 267 |
6. Launch the RAGFlow backend service:
|
| 268 |
+
Comment out the `nginx` line in `docker/entrypoint.sh` and run the script:
|
| 269 |
|
| 270 |
```bash
|
| 271 |
+
$ bash docker/entrypoint.sh
|
|
|
|
| 272 |
```
|
| 273 |
|
| 274 |
7. Launch the frontend service:
|
| 275 |
|
| 276 |
```bash
|
| 277 |
$ cd web
|
| 278 |
+
$ npm install --force
|
| 279 |
$ vim .umirc.ts
|
| 280 |
# Update proxy.target to http://127.0.0.1:9380
|
| 281 |
$ npm run dev
|
| 282 |
```
|
| 283 |
|
| 284 |
+
8. In your web browser, enter `http://127.0.0.1/`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 285 |
|
| 286 |
## π Documentation
|
| 287 |
|
conf/service_conf.yaml
DELETED
|
@@ -1,73 +0,0 @@
|
|
| 1 |
-
ragflow:
|
| 2 |
-
host: 0.0.0.0
|
| 3 |
-
http_port: 9380
|
| 4 |
-
mysql:
|
| 5 |
-
name: 'rag_flow'
|
| 6 |
-
user: 'root'
|
| 7 |
-
password: 'infini_rag_flow'
|
| 8 |
-
host: 'mysql'
|
| 9 |
-
port: 3306
|
| 10 |
-
max_connections: 100
|
| 11 |
-
stale_timeout: 30
|
| 12 |
-
postgres:
|
| 13 |
-
name: 'rag_flow'
|
| 14 |
-
user: 'rag_flow'
|
| 15 |
-
password: 'infini_rag_flow'
|
| 16 |
-
host: 'postgres'
|
| 17 |
-
port: 5432
|
| 18 |
-
max_connections: 100
|
| 19 |
-
stale_timeout: 30
|
| 20 |
-
minio:
|
| 21 |
-
user: 'rag_flow'
|
| 22 |
-
password: 'infini_rag_flow'
|
| 23 |
-
host: 'minio:9000'
|
| 24 |
-
azure:
|
| 25 |
-
auth_type: 'sas'
|
| 26 |
-
container_url: 'container_url'
|
| 27 |
-
sas_token: 'sas_token'
|
| 28 |
-
#azure:
|
| 29 |
-
# auth_type: 'spn'
|
| 30 |
-
# account_url: 'account_url'
|
| 31 |
-
# client_id: 'client_id'
|
| 32 |
-
# secret: 'secret'
|
| 33 |
-
# tenant_id: 'tenant_id'
|
| 34 |
-
# container_name: 'container_name'
|
| 35 |
-
s3:
|
| 36 |
-
endpoint: 'endpoint'
|
| 37 |
-
access_key: 'access_key'
|
| 38 |
-
secret_key: 'secret_key'
|
| 39 |
-
region: 'region'
|
| 40 |
-
es:
|
| 41 |
-
hosts: 'http://es01:9200'
|
| 42 |
-
username: 'elastic'
|
| 43 |
-
password: 'infini_rag_flow'
|
| 44 |
-
redis:
|
| 45 |
-
db: 1
|
| 46 |
-
password: 'infini_rag_flow'
|
| 47 |
-
host: 'redis:6379'
|
| 48 |
-
user_default_llm:
|
| 49 |
-
factory: 'Tongyi-Qianwen'
|
| 50 |
-
api_key: 'sk-xxxxxxxxxxxxx'
|
| 51 |
-
base_url: ''
|
| 52 |
-
oauth:
|
| 53 |
-
github:
|
| 54 |
-
client_id: xxxxxxxxxxxxxxxxxxxxxxxxx
|
| 55 |
-
secret_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
| 56 |
-
url: https://github.com/login/oauth/access_token
|
| 57 |
-
feishu:
|
| 58 |
-
app_id: cli_xxxxxxxxxxxxxxxxxxx
|
| 59 |
-
app_secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
| 60 |
-
app_access_token_url: https://open.feishu.cn/open-apis/auth/v3/app_access_token/internal
|
| 61 |
-
user_access_token_url: https://open.feishu.cn/open-apis/authen/v1/oidc/access_token
|
| 62 |
-
grant_type: 'authorization_code'
|
| 63 |
-
authentication:
|
| 64 |
-
client:
|
| 65 |
-
switch: false
|
| 66 |
-
http_app_key:
|
| 67 |
-
http_secret_key:
|
| 68 |
-
site:
|
| 69 |
-
switch: false
|
| 70 |
-
permission:
|
| 71 |
-
switch: false
|
| 72 |
-
component: false
|
| 73 |
-
dataset: false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
conf/service_conf.yaml
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
docker/service_conf.yaml
|
docker/.env
CHANGED
|
@@ -33,7 +33,7 @@ REDIS_PASSWORD=infini_rag_flow
|
|
| 33 |
|
| 34 |
SVR_HTTP_PORT=9380
|
| 35 |
|
| 36 |
-
RAGFLOW_VERSION=
|
| 37 |
|
| 38 |
TIMEZONE='Asia/Shanghai'
|
| 39 |
|
|
|
|
| 33 |
|
| 34 |
SVR_HTTP_PORT=9380
|
| 35 |
|
| 36 |
+
RAGFLOW_VERSION=dev
|
| 37 |
|
| 38 |
TIMEZONE='Asia/Shanghai'
|
| 39 |
|
docker/service_conf.yaml
CHANGED
|
@@ -21,23 +21,54 @@ redis:
|
|
| 21 |
db: 1
|
| 22 |
password: 'infini_rag_flow'
|
| 23 |
host: 'redis:6379'
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
db: 1
|
| 22 |
password: 'infini_rag_flow'
|
| 23 |
host: 'redis:6379'
|
| 24 |
+
|
| 25 |
+
# postgres:
|
| 26 |
+
# name: 'rag_flow'
|
| 27 |
+
# user: 'rag_flow'
|
| 28 |
+
# password: 'infini_rag_flow'
|
| 29 |
+
# host: 'postgres'
|
| 30 |
+
# port: 5432
|
| 31 |
+
# max_connections: 100
|
| 32 |
+
# stale_timeout: 30
|
| 33 |
+
# s3:
|
| 34 |
+
# endpoint: 'endpoint'
|
| 35 |
+
# access_key: 'access_key'
|
| 36 |
+
# secret_key: 'secret_key'
|
| 37 |
+
# region: 'region'
|
| 38 |
+
# azure:
|
| 39 |
+
# auth_type: 'sas'
|
| 40 |
+
# container_url: 'container_url'
|
| 41 |
+
# sas_token: 'sas_token'
|
| 42 |
+
# azure:
|
| 43 |
+
# auth_type: 'spn'
|
| 44 |
+
# account_url: 'account_url'
|
| 45 |
+
# client_id: 'client_id'
|
| 46 |
+
# secret: 'secret'
|
| 47 |
+
# tenant_id: 'tenant_id'
|
| 48 |
+
# container_name: 'container_name'
|
| 49 |
+
# user_default_llm:
|
| 50 |
+
# factory: 'Tongyi-Qianwen'
|
| 51 |
+
# api_key: 'sk-xxxxxxxxxxxxx'
|
| 52 |
+
# base_url: ''
|
| 53 |
+
# oauth:
|
| 54 |
+
# github:
|
| 55 |
+
# client_id: xxxxxxxxxxxxxxxxxxxxxxxxx
|
| 56 |
+
# secret_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
| 57 |
+
# url: https://github.com/login/oauth/access_token
|
| 58 |
+
# feishu:
|
| 59 |
+
# app_id: cli_xxxxxxxxxxxxxxxxxxx
|
| 60 |
+
# app_secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
| 61 |
+
# app_access_token_url: https://open.feishu.cn/open-apis/auth/v3/app_access_token/internal
|
| 62 |
+
# user_access_token_url: https://open.feishu.cn/open-apis/authen/v1/oidc/access_token
|
| 63 |
+
# grant_type: 'authorization_code'
|
| 64 |
+
# authentication:
|
| 65 |
+
# client:
|
| 66 |
+
# switch: false
|
| 67 |
+
# http_app_key:
|
| 68 |
+
# http_secret_key:
|
| 69 |
+
# site:
|
| 70 |
+
# switch: false
|
| 71 |
+
# permission:
|
| 72 |
+
# switch: false
|
| 73 |
+
# component: false
|
| 74 |
+
# dataset: false
|
web/.umirc.ts
CHANGED
|
@@ -30,7 +30,7 @@ export default defineConfig({
|
|
| 30 |
copy: ['src/conf.json'],
|
| 31 |
proxy: {
|
| 32 |
'/v1': {
|
| 33 |
-
target: 'http://127.0.0.1:
|
| 34 |
changeOrigin: true,
|
| 35 |
ws: true,
|
| 36 |
logger: console,
|
|
|
|
| 30 |
copy: ['src/conf.json'],
|
| 31 |
proxy: {
|
| 32 |
'/v1': {
|
| 33 |
+
target: 'http://127.0.0.1:9380/',
|
| 34 |
changeOrigin: true,
|
| 35 |
ws: true,
|
| 36 |
logger: console,
|