You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

launch_ragflow_from_source.md 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. ---
  2. sidebar_position: 2
  3. slug: /launch_ragflow_from_source
  4. ---
  5. # Launch the RAGFlow Service from Source
  6. A guide explaining how to set up a RAGFlow service from its source code. By following this guide, you'll be able to debug using the source code.
  7. ## Target Audience
  8. Developers who have added new features or modified existing code and wish to debug using the source code, *provided that* their machine has the target deployment environment set up.
  9. ## Prerequisites
  10. - CPU ≥ 4 cores
  11. - RAM ≥ 16 GB
  12. - Disk ≥ 50 GB
  13. - Docker ≥ 24.0.0 & Docker Compose ≥ v2.26.1
  14. :::tip NOTE
  15. If you have not installed Docker on your local machine (Windows, Mac, or Linux), see the [Install Docker Engine](https://docs.docker.com/engine/install/) guide.
  16. :::
  17. ## Launch the Service from Source
  18. To launch the RAGFlow service from source code:
  19. ### Clone the RAGFlow Repository
  20. ```bash
  21. git clone https://github.com/infiniflow/ragflow.git
  22. cd ragflow/
  23. ```
  24. ### Install Python dependencies
  25. 1. Install Poetry:
  26. ```bash
  27. curl -sSL https://install.python-poetry.org | python3 -
  28. ```
  29. 2. Configure Poetry:
  30. ```bash
  31. export POETRY_VIRTUALENVS_CREATE=true POETRY_VIRTUALENVS_IN_PROJECT=true
  32. ```
  33. 3. Install Python dependencies:
  34. ```bash
  35. ~/.local/bin/poetry install --sync --no-root
  36. ```
  37. *A virtual environment named `.venv` is created, and all Python dependencies are installed into the new environment.*
  38. ### Launch Third-party Services
  39. The following command launches the 'base' services (MinIO, Elasticsearch, Redis, and MySQL) using Docker Compose:
  40. ```bash
  41. docker compose -f docker/docker-compose-base.yml up -d
  42. ```
  43. ### Update `host` and `port` Settings for Third-party Services
  44. 1. Add the following line to `/etc/hosts` to resolve all hosts specified in **docker/service_conf.yaml** to `127.0.0.1`:
  45. ```
  46. 127.0.0.1 es01 mysql minio redis
  47. ```
  48. 2. In **docker/service_conf.yaml**, update mysql port to `5455` and es port to `1200`, as specified in **docker/.env**.
  49. ### Launch the RAGFlow Backend Service
  50. 1. Comment out the `nginx` line in **docker/entrypoint.sh**.
  51. ```
  52. # /usr/sbin/nginx
  53. ```
  54. 2. Activate the Python virtual environment:
  55. ```bash
  56. source .venv/bin/activate
  57. export PYTHONPATH=$(pwd)
  58. ```
  59. 3. **Optional:** If you cannot access HuggingFace, set the HF_ENDPOINT environment variable to use a mirror site:
  60. ```bash
  61. export HF_ENDPOINT=https://hf-mirror.com
  62. ```
  63. 4. Run the **entrypoint.sh** script to launch the backend service:
  64. ```
  65. bash docker/entrypoint.sh
  66. ```
  67. ### Launch the RAGFlow frontend service
  68. 1. Navigate to the `web` directory and install the frontend dependencies:
  69. ```bash
  70. cd web
  71. npm install --force
  72. ```
  73. 2. Update `proxy.target` in **.umirc.ts** to `http://127.0.0.1:9380`:
  74. ```bash
  75. vim .umirc.ts
  76. ```
  77. 3. Start up the RAGFlow frontend service:
  78. ```bash
  79. npm run dev
  80. ```
  81. *The following message appears, showing the IP address and port number of your frontend service:*
  82. ![](https://github.com/user-attachments/assets/0daf462c-a24d-4496-a66f-92533534e187)
  83. ### Access the RAGFlow service
  84. In your web browser, enter `http://127.0.0.1:<PORT>/`, ensuring the port number matches that shown in the screenshot above.