From 290e5d958d9d81cfa4231d2d1708c0369f80d5ab Mon Sep 17 00:00:00 2001 From: Moonlit <bc.h@foxmail.com> Date: Tue, 30 Apr 2024 18:45:53 +0800 Subject: [PATCH] docs: Add instructions for launching service from source (#619) 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 --- README.md | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++ README_ja.md | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++ README_zh.md | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 180 insertions(+) diff --git a/README.md b/README.md index 7c31860..a050c44 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/README_ja.md b/README_ja.md index 2f0d225..1e69308 100644 --- a/README_ja.md +++ b/README_ja.md @@ -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) diff --git a/README_zh.md b/README_zh.md index 2ca5cb5..cec041f 100644 --- a/README_zh.md +++ b/README_zh.md @@ -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) -- GitLab