Updated README on debugging web and python (#2544)

### What problem does this PR solve?

Updated README on debugging web and python

### Type of change

- [x] Documentation Update
This commit is contained in:
Zhichang Yu 2024-09-24 11:46:03 +08:00 committed by GitHub
parent 100c60017f
commit 90644246d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 79 additions and 157 deletions

View File

@ -42,8 +42,8 @@
- 🔎 [System Architecture](#-system-architecture) - 🔎 [System Architecture](#-system-architecture)
- 🎬 [Get Started](#-get-started) - 🎬 [Get Started](#-get-started)
- 🔧 [Configurations](#-configurations) - 🔧 [Configurations](#-configurations)
- 🛠️ [Build from source](#-build-from-source) - 🛠️ [Build RAGFlow image](#-build-ragflow-image)
- 🛠️ [Launch service from source](#-launch-service-from-source) - 🛠️ [Launch service from source for development](#-launch-service-from-source-for-development)
- 📚 [Documentation](#-documentation) - 📚 [Documentation](#-documentation)
- 📜 [Roadmap](#-roadmap) - 📜 [Roadmap](#-roadmap)
- 🏄 [Community](#-community) - 🏄 [Community](#-community)
@ -150,15 +150,12 @@ Try our demo at [https://demo.ragflow.io](https://demo.ragflow.io).
``` ```
3. Build the pre-built Docker images and start up the server: 3. Build the pre-built Docker images and start up the server:
> 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. > 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.
```bash ```bash
$ cd ragflow/docker $ cd ragflow/docker
$ chmod +x ./entrypoint.sh
$ docker compose up -d $ docker compose up -d
``` ```
> The core image is about 9 GB in size and may take a while to load. > The core image is about 9 GB in size and may take a while to load.
@ -207,26 +204,23 @@ You must ensure that changes to the [.env](./docker/.env) file are in line with
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`. 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`.
> Updates to all system configurations require a system reboot to take effect: Updates to the above configurations require a reboot of all containers to take effect:
>
> ```bash > ```bash
> $ docker-compose up -d > $ docker-compose -f docker/docker-compose.yml up -d
> ``` > ```
## 🛠️ Build from source ## 🛠️ Build RAGFlow image
To build the Docker images from source: To build the Docker images from source:
```bash ```bash
$ git clone https://github.com/infiniflow/ragflow.git $ git clone https://github.com/infiniflow/ragflow.git
$ cd ragflow/ $ cd ragflow/
$ docker build -t infiniflow/ragflow:dev . $ docker build -f Dockerfile.scratch -t infiniflow/ragflow:dev .
$ cd ragflow/docker
$ chmod +x ./entrypoint.sh
$ docker compose up -d
``` ```
## 🛠️ Launch service from source ## 🛠️ Launch service from source for development
To launch the service from source: To launch the service from source:
@ -237,88 +231,57 @@ To launch the service from source:
$ cd ragflow/ $ cd ragflow/
``` ```
2. Create a virtual environment, ensuring that Anaconda or Miniconda is installed: 2. Install all python dependencies in a newly created virtual environment named `.venv`:
```bash ```bash
$ conda create -n ragflow python=3.11.0 $ curl -sSL https://install.python-poetry.org | python3 -
$ conda activate ragflow $ $HOME/.local/bin/poetry install --sync --no-root
$ pip install -r requirements.txt
```
```bash
# If your CUDA version is higher than 12.0, run the following additional commands:
$ pip uninstall -y onnxruntime-gpu
$ pip install onnxruntime-gpu --extra-index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-12/pypi/simple/
``` ```
3. Copy the entry script and configure environment variables: 3. Copy the entry script and configure environment variables:
```bash
# Get the Python path:
$ which python
# Get the ragflow project path:
$ pwd
```
```bash
$ cp docker/entrypoint.sh .
$ vi entrypoint.sh
```
```bash ```bash
# Adjust configurations according to your actual situation (the following two export commands are newly added): # Adjust configurations according to your actual situation (the following two export commands are newly added):
# - Assign the result of `which python` to `PY`.
# - Assign the result of `pwd` to `PYTHONPATH`.
# - Comment out `LD_LIBRARY_PATH`, if it is configured. # - Comment out `LD_LIBRARY_PATH`, if it is configured.
# - Optional: Add Hugging Face mirror. # - Optional: Add Hugging Face mirror.
PY=${PY} source ~/.venv/bin/activate
export PYTHONPATH=${PYTHONPATH} export PYTHONPATH=$(pwd)
export HF_ENDPOINT=https://hf-mirror.com export HF_ENDPOINT=https://hf-mirror.com
``` ```
4. Launch the third-party services (MinIO, Elasticsearch, Redis, and MySQL): 4. Launch the third-party services (MinIO, Elasticsearch, Redis, and MySQL):
```bash ```bash
$ cd docker $ docker compose -f docker/docker-compose-base.yml up -d
$ docker compose -f docker-compose-base.yml up -d
``` ```
5. Check the configuration files, ensuring that: 5. Adjust configurations
Add the following line to `/etc/hosts` to resolve all hosts in `docker/service_conf.yaml` to `127.0.0.1`:
- The settings in **docker/.env** match those in **conf/service_conf.yaml**. ```
- The IP addresses and ports for related services in **service_conf.yaml** match the local machine IP and ports exposed by the container. 127.0.0.1 es01 mysql minio redis
```
Edit `docker/service_conf.yaml` to change mysql port to `5455` and es port to `1200`, as specified in `docker/.env`.
6. Launch the RAGFlow backend service: 6. Launch the RAGFlow backend service:
Comment out the `nginx` line in `docker/entrypoint.sh` and run the script:
```bash ```bash
$ chmod +x ./entrypoint.sh $ bash docker/entrypoint.sh
$ bash ./entrypoint.sh
``` ```
7. Launch the frontend service: 7. Launch the frontend service:
```bash ```bash
$ cd web $ cd web
$ npm install --registry=https://registry.npmmirror.com --force $ npm install --force
$ vim .umirc.ts $ vim .umirc.ts
# Update proxy.target to http://127.0.0.1:9380 # Update proxy.target to http://127.0.0.1:9380
$ npm run dev $ npm run dev
``` ```
8. Deploy the frontend service: 8. In your web browser, enter `http://127.0.0.1/`.
```bash
$ cd web
$ npm install --registry=https://registry.npmmirror.com --force
$ umi build
$ mkdir -p /ragflow/web
$ cp -r dist /ragflow/web
$ apt install nginx -y
$ cp ../docker/nginx/proxy.conf /etc/nginx
$ cp ../docker/nginx/nginx.conf /etc/nginx
$ cp ../docker/nginx/ragflow.conf /etc/nginx/conf.d
$ systemctl start nginx
```
## 📚 Documentation ## 📚 Documentation

View File

@ -1,73 +0,0 @@
ragflow:
host: 0.0.0.0
http_port: 9380
mysql:
name: 'rag_flow'
user: 'root'
password: 'infini_rag_flow'
host: 'mysql'
port: 3306
max_connections: 100
stale_timeout: 30
postgres:
name: 'rag_flow'
user: 'rag_flow'
password: 'infini_rag_flow'
host: 'postgres'
port: 5432
max_connections: 100
stale_timeout: 30
minio:
user: 'rag_flow'
password: 'infini_rag_flow'
host: 'minio:9000'
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'
s3:
endpoint: 'endpoint'
access_key: 'access_key'
secret_key: 'secret_key'
region: 'region'
es:
hosts: 'http://es01:9200'
username: 'elastic'
password: 'infini_rag_flow'
redis:
db: 1
password: 'infini_rag_flow'
host: 'redis:6379'
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

1
conf/service_conf.yaml Symbolic link
View File

@ -0,0 +1 @@
docker/service_conf.yaml

View File

@ -33,7 +33,7 @@ REDIS_PASSWORD=infini_rag_flow
SVR_HTTP_PORT=9380 SVR_HTTP_PORT=9380
RAGFLOW_VERSION=poetry RAGFLOW_VERSION=dev
TIMEZONE='Asia/Shanghai' TIMEZONE='Asia/Shanghai'

View File

@ -21,23 +21,54 @@ redis:
db: 1 db: 1
password: 'infini_rag_flow' password: 'infini_rag_flow'
host: 'redis:6379' host: 'redis:6379'
user_default_llm:
factory: 'Tongyi-Qianwen' # postgres:
api_key: 'sk-xxxxxxxxxxxxx' # name: 'rag_flow'
base_url: '' # user: 'rag_flow'
oauth: # password: 'infini_rag_flow'
github: # host: 'postgres'
client_id: xxxxxxxxxxxxxxxxxxxxxxxxx # port: 5432
secret_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxx # max_connections: 100
url: https://github.com/login/oauth/access_token # stale_timeout: 30
authentication: # s3:
client: # endpoint: 'endpoint'
switch: false # access_key: 'access_key'
http_app_key: # secret_key: 'secret_key'
http_secret_key: # region: 'region'
site: # azure:
switch: false # auth_type: 'sas'
permission: # container_url: 'container_url'
switch: false # sas_token: 'sas_token'
component: false # azure:
dataset: false # 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

View File

@ -30,7 +30,7 @@ export default defineConfig({
copy: ['src/conf.json'], copy: ['src/conf.json'],
proxy: { proxy: {
'/v1': { '/v1': {
target: 'http://127.0.0.1:9456/', target: 'http://127.0.0.1:9380/',
changeOrigin: true, changeOrigin: true,
ws: true, ws: true,
logger: console, logger: console,