Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Add instructions for launching service from source #619

Merged
merged 1 commit into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,66 @@ $ chmod +x ./entrypoint.sh
$ docker compose up -d
```

## 🛠️ Launch Service from Source

To launch the service from source, please follow these steps:

1. Clone the repository
```bash
$ git clone https://github.com/infiniflow/ragflow.git
$ cd ragflow/
```

2. Create a virtual environment (ensure Anaconda or Miniconda is installed)
```bash
$ conda create -n ragflow python=3.11.0
$ conda activate ragflow
$ pip install -r requirements.txt
```
If CUDA version is greater than 12.0, execute the following additional commands:
```bash
$ 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
```bash
$ cp docker/entrypoint.sh .
$ vi entrypoint.sh
```
Use the following commands to obtain the Python path and the ragflow project path:
```bash
$ which python
$ pwd
```

Set the output of `which python` as the value for `PY` and the output of `pwd` as the value for `PYTHONPATH`.

If `LD_LIBRARY_PATH` is already configured, it can be commented out.

```bash
# Adjust configurations according to your actual situation; the two export commands are newly added.
PY=${PY}
export PYTHONPATH=${PYTHONPATH}
# Optional: Add Hugging Face mirror
export HF_ENDPOINT=https://hf-mirror.com
```

4. Start the base services
```bash
$ cd docker
$ docker compose -f docker-compose-base.yml up -d
```

5. Check the configuration files
Ensure that the settings in **docker/.env** match those in **conf/service_conf.yaml**. The IP addresses and ports for related services in **service_conf.yaml** should be changed to the local machine IP and ports exposed by the container.

6. Launch the service
```bash
$ chmod +x ./entrypoint.sh
$ bash ./entrypoint.sh
```

## 📚 Documentation

- [FAQ](./docs/faq.md)
Expand Down
60 changes: 60 additions & 0 deletions README_ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,66 @@ $ chmod +x ./entrypoint.sh
$ docker compose up -d
```

## 🛠️ ソースコードからサービスを起動する方法

ソースコードからサービスを起動する場合は、以下の手順に従ってください:

1. リポジトリをクローンします
```bash
$ git clone https://github.com/infiniflow/ragflow.git
$ cd ragflow/
```

2. 仮想環境を作成します(AnacondaまたはMinicondaがインストールされていることを確認してください)
```bash
$ conda create -n ragflow python=3.11.0
$ conda activate ragflow
$ pip install -r requirements.txt
```
CUDAのバージョンが12.0以上の場合、以下の追加コマンドを実行してください:
```bash
$ 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. エントリースクリプトをコピーし、環境変数を設定します
```bash
$ cp docker/entrypoint.sh .
$ vi entrypoint.sh
```
以下のコマンドでPythonのパスとragflowプロジェクトのパスを取得します:
```bash
$ which python
$ pwd
```

`which python`の出力を`PY`の値として、`pwd`の出力を`PYTHONPATH`の値として設定します。

`LD_LIBRARY_PATH`が既に設定されている場合は、コメントアウトできます。

```bash
# 実際の状況に応じて設定を調整してください。以下の二つのexportは新たに追加された設定です
PY=${PY}
export PYTHONPATH=${PYTHONPATH}
# オプション:Hugging Faceミラーを追加
export HF_ENDPOINT=https://hf-mirror.com
```

4. 基本サービスを起動します
```bash
$ cd docker
$ docker compose -f docker-compose-base.yml up -d
```

5. 設定ファイルを確認します
**docker/.env**内の設定が**conf/service_conf.yaml**内の設定と一致していることを確認してください。**service_conf.yaml**内の関連サービスのIPアドレスとポートは、ローカルマシンのIPアドレスとコンテナが公開するポートに変更する必要があります。

6. サービスを起動します
```bash
$ chmod +x ./entrypoint.sh
$ bash ./entrypoint.sh
```

## 📚 ドキュメンテーション

- [FAQ](./docs/faq.md)
Expand Down
60 changes: 60 additions & 0 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,66 @@ $ chmod +x ./entrypoint.sh
$ docker compose up -d
```

## 🛠️ 源码启动服务

如需从源码启动服务,请参考以下步骤:

1. 克隆仓库
```bash
$ git clone https://github.com/infiniflow/ragflow.git
$ cd ragflow/
```

2. 创建虚拟环境(确保已安装 Anaconda 或 Miniconda)
```bash
$ conda create -n ragflow python=3.11.0
$ conda activate ragflow
$ pip install -r requirements.txt
```
如果cuda > 12.0,需额外执行以下命令:
```bash
$ 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. 拷贝入口脚本并配置环境变量
```bash
$ cp docker/entrypoint.sh .
$ vi entrypoint.sh
```
使用以下命令获取python路径及ragflow项目路径:
```bash
$ which python
$ pwd
```

将上述`which python`的输出作为`PY`的值,将`pwd`的输出作为`PYTHONPATH`的值。

`LD_LIBRARY_PATH`如果环境已经配置好,可以注释掉。

```bash
# 此处配置需要按照实际情况调整,两个export为新增配置
PY=${PY}
export PYTHONPATH=${PYTHONPATH}
# 可选:添加Hugging Face镜像
export HF_ENDPOINT=https://hf-mirror.com
```

4. 启动基础服务
```bash
$ cd docker
$ docker compose -f docker-compose-base.yml up -d
```

5. 检查配置文件
确保**docker/.env**中的配置与**conf/service_conf.yaml**中配置一致, **service_conf.yaml**中相关服务的IP地址与端口应该改成本机IP地址及容器映射出来的端口。

6. 启动服务
```bash
$ chmod +x ./entrypoint.sh
$ bash ./entrypoint.sh
```

## 📚 技术文档

- [FAQ](./docs/faq.md)
Expand Down