Moonlit commited on
Commit
5aa2501
·
1 Parent(s): 8e109c7

docs: Add instructions for launching service from source (#619)

Browse files

This commit includes detailed steps for setting up and launching the
service directly from the source code. It covers cloning the repository,
setting up a virtual environment, configuring environment variables, and
starting the service using Docker. This update ensures that developers
have clear guidance on how to get the service running in a development
environment.

### What problem does this PR solve?

_Briefly describe what this PR aims to solve. Include background context
that will help reviewers understand the purpose of the PR._

### Type of change
- [x] Documentation Update

Files changed (3) hide show
  1. README.md +60 -0
  2. README_ja.md +60 -0
  3. README_zh.md +60 -0
README.md CHANGED
@@ -186,6 +186,66 @@ $ chmod +x ./entrypoint.sh
186
  $ docker compose up -d
187
  ```
188
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
  ## 📚 Documentation
190
 
191
  - [FAQ](./docs/faq.md)
 
186
  $ docker compose up -d
187
  ```
188
 
189
+ ## 🛠️ Launch Service from Source
190
+
191
+ To launch the service from source, please follow these steps:
192
+
193
+ 1. Clone the repository
194
+ ```bash
195
+ $ git clone https://github.com/infiniflow/ragflow.git
196
+ $ cd ragflow/
197
+ ```
198
+
199
+ 2. Create a virtual environment (ensure Anaconda or Miniconda is installed)
200
+ ```bash
201
+ $ conda create -n ragflow python=3.11.0
202
+ $ conda activate ragflow
203
+ $ pip install -r requirements.txt
204
+ ```
205
+ If CUDA version is greater than 12.0, execute the following additional commands:
206
+ ```bash
207
+ $ pip uninstall -y onnxruntime-gpu
208
+ $ pip install onnxruntime-gpu --extra-index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-12/pypi/simple/
209
+ ```
210
+
211
+ 3. Copy the entry script and configure environment variables
212
+ ```bash
213
+ $ cp docker/entrypoint.sh .
214
+ $ vi entrypoint.sh
215
+ ```
216
+ Use the following commands to obtain the Python path and the ragflow project path:
217
+ ```bash
218
+ $ which python
219
+ $ pwd
220
+ ```
221
+
222
+ Set the output of `which python` as the value for `PY` and the output of `pwd` as the value for `PYTHONPATH`.
223
+
224
+ If `LD_LIBRARY_PATH` is already configured, it can be commented out.
225
+
226
+ ```bash
227
+ # Adjust configurations according to your actual situation; the two export commands are newly added.
228
+ PY=${PY}
229
+ export PYTHONPATH=${PYTHONPATH}
230
+ # Optional: Add Hugging Face mirror
231
+ export HF_ENDPOINT=https://hf-mirror.com
232
+ ```
233
+
234
+ 4. Start the base services
235
+ ```bash
236
+ $ cd docker
237
+ $ docker compose -f docker-compose-base.yml up -d
238
+ ```
239
+
240
+ 5. Check the configuration files
241
+ 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.
242
+
243
+ 6. Launch the service
244
+ ```bash
245
+ $ chmod +x ./entrypoint.sh
246
+ $ bash ./entrypoint.sh
247
+ ```
248
+
249
  ## 📚 Documentation
250
 
251
  - [FAQ](./docs/faq.md)
README_ja.md CHANGED
@@ -186,6 +186,66 @@ $ chmod +x ./entrypoint.sh
186
  $ docker compose up -d
187
  ```
188
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
  ## 📚 ドキュメンテーション
190
 
191
  - [FAQ](./docs/faq.md)
 
186
  $ docker compose up -d
187
  ```
188
 
189
+ ## 🛠️ ソースコードからサービスを起動する方法
190
+
191
+ ソースコードからサービスを起動する場合は、以下の手順に従ってください:
192
+
193
+ 1. リポジトリをクローンします
194
+ ```bash
195
+ $ git clone https://github.com/infiniflow/ragflow.git
196
+ $ cd ragflow/
197
+ ```
198
+
199
+ 2. 仮想環境を作成します(AnacondaまたはMinicondaがインストールされていることを確認してください)
200
+ ```bash
201
+ $ conda create -n ragflow python=3.11.0
202
+ $ conda activate ragflow
203
+ $ pip install -r requirements.txt
204
+ ```
205
+ CUDAのバージョンが12.0以上の場合、以下の追加コマンドを実行してください:
206
+ ```bash
207
+ $ pip uninstall -y onnxruntime-gpu
208
+ $ pip install onnxruntime-gpu --extra-index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-12/pypi/simple/
209
+ ```
210
+
211
+ 3. エントリースクリプトをコピーし、環境変数を設定します
212
+ ```bash
213
+ $ cp docker/entrypoint.sh .
214
+ $ vi entrypoint.sh
215
+ ```
216
+ 以下のコマンドでPythonのパスとragflowプロジェクトのパスを取得します:
217
+ ```bash
218
+ $ which python
219
+ $ pwd
220
+ ```
221
+
222
+ `which python`の出力を`PY`の値として、`pwd`の出力を`PYTHONPATH`の値として設定します。
223
+
224
+ `LD_LIBRARY_PATH`が既に設定されている場合は、コメントアウトできます。
225
+
226
+ ```bash
227
+ # 実際の状況に応じて設定を調整してください。以下の二つのexportは新たに追加された設定です
228
+ PY=${PY}
229
+ export PYTHONPATH=${PYTHONPATH}
230
+ # オプション:Hugging Faceミラーを追加
231
+ export HF_ENDPOINT=https://hf-mirror.com
232
+ ```
233
+
234
+ 4. 基本サービスを起動します
235
+ ```bash
236
+ $ cd docker
237
+ $ docker compose -f docker-compose-base.yml up -d
238
+ ```
239
+
240
+ 5. 設定ファイルを確認します
241
+ **docker/.env**内の設定が**conf/service_conf.yaml**内の設定と一致していることを確認してください。**service_conf.yaml**内の関連サービスのIPアドレスとポートは、ローカルマシンのIPアドレスとコンテナが公開するポートに変更する必要があります。
242
+
243
+ 6. サービスを起動します
244
+ ```bash
245
+ $ chmod +x ./entrypoint.sh
246
+ $ bash ./entrypoint.sh
247
+ ```
248
+
249
  ## 📚 ドキュメンテーション
250
 
251
  - [FAQ](./docs/faq.md)
README_zh.md CHANGED
@@ -186,6 +186,66 @@ $ chmod +x ./entrypoint.sh
186
  $ docker compose up -d
187
  ```
188
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
  ## 📚 技术文档
190
 
191
  - [FAQ](./docs/faq.md)
 
186
  $ docker compose up -d
187
  ```
188
 
189
+ ## 🛠️ 源码启动服务
190
+
191
+ 如需从源码启动服务,请参考以下步骤:
192
+
193
+ 1. 克隆仓库
194
+ ```bash
195
+ $ git clone https://github.com/infiniflow/ragflow.git
196
+ $ cd ragflow/
197
+ ```
198
+
199
+ 2. 创建虚拟环境(确保已安装 Anaconda 或 Miniconda)
200
+ ```bash
201
+ $ conda create -n ragflow python=3.11.0
202
+ $ conda activate ragflow
203
+ $ pip install -r requirements.txt
204
+ ```
205
+ 如果cuda > 12.0,需额外执行以下命令:
206
+ ```bash
207
+ $ pip uninstall -y onnxruntime-gpu
208
+ $ pip install onnxruntime-gpu --extra-index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-12/pypi/simple/
209
+ ```
210
+
211
+ 3. 拷贝入口脚本并配置环境变量
212
+ ```bash
213
+ $ cp docker/entrypoint.sh .
214
+ $ vi entrypoint.sh
215
+ ```
216
+ 使用以下命令获取python路径及ragflow项目路径:
217
+ ```bash
218
+ $ which python
219
+ $ pwd
220
+ ```
221
+
222
+ 将上述`which python`的输出作为`PY`的值,将`pwd`的输出作为`PYTHONPATH`的值。
223
+
224
+ `LD_LIBRARY_PATH`如果环境已经配置好,可以注释掉。
225
+
226
+ ```bash
227
+ # 此处配置需要按照实际情况调整,两个export为新增配置
228
+ PY=${PY}
229
+ export PYTHONPATH=${PYTHONPATH}
230
+ # 可选:添加Hugging Face镜像
231
+ export HF_ENDPOINT=https://hf-mirror.com
232
+ ```
233
+
234
+ 4. 启动基础服务
235
+ ```bash
236
+ $ cd docker
237
+ $ docker compose -f docker-compose-base.yml up -d
238
+ ```
239
+
240
+ 5. 检查配置文件
241
+ 确保**docker/.env**中的配置与**conf/service_conf.yaml**中配置一致, **service_conf.yaml**中相关服务的IP地址与端口应该改成本机IP地址及容器映射出来的端口。
242
+
243
+ 6. 启动服务
244
+ ```bash
245
+ $ chmod +x ./entrypoint.sh
246
+ $ bash ./entrypoint.sh
247
+ ```
248
+
249
  ## 📚 技术文档
250
 
251
  - [FAQ](./docs/faq.md)