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.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. ---
  2. sidebar_position: 2
  3. slug: /launch_ragflow_from_source
  4. ---
  5. # Launch 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 a service from source
  18. To launch a 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 uv:
  26. ```bash
  27. pipx install uv
  28. ```
  29. 2. Install Python dependencies:
  30. - slim:
  31. ```bash
  32. uv sync --python 3.10 # install RAGFlow dependent python modules
  33. ```
  34. - full:
  35. ```bash
  36. uv sync --python 3.10 --all-extras # install RAGFlow dependent python modules
  37. ```
  38. *A virtual environment named `.venv` is created, and all Python dependencies are installed into the new environment.*
  39. ### Launch third-party services
  40. The following command launches the 'base' services (MinIO, Elasticsearch, Redis, and MySQL) using Docker Compose:
  41. ```bash
  42. docker compose -f docker/docker-compose-base.yml up -d
  43. ```
  44. ### Update `host` and `port` Settings for Third-party Services
  45. 1. Add the following line to `/etc/hosts` to resolve all hosts specified in **docker/service_conf.yaml.template** to `127.0.0.1`:
  46. ```
  47. 127.0.0.1 es01 infinity mysql minio redis
  48. ```
  49. 2. In **docker/service_conf.yaml.template**, update mysql port to `5455` and es port to `1200`, as specified in **docker/.env**.
  50. ### Launch the RAGFlow backend service
  51. 1. Comment out the `nginx` line in **docker/entrypoint.sh**.
  52. ```
  53. # /usr/sbin/nginx
  54. ```
  55. 2. Activate the Python virtual environment:
  56. ```bash
  57. source .venv/bin/activate
  58. export PYTHONPATH=$(pwd)
  59. ```
  60. 3. **Optional:** If you cannot access HuggingFace, set the HF_ENDPOINT environment variable to use a mirror site:
  61. ```bash
  62. export HF_ENDPOINT=https://hf-mirror.com
  63. ```
  64. 4. Run the **entrypoint.sh** script to launch the backend service:
  65. ```
  66. bash docker/entrypoint.sh
  67. ```
  68. ### Launch the RAGFlow frontend service
  69. 1. Navigate to the `web` directory and install the frontend dependencies:
  70. ```bash
  71. cd web
  72. npm install
  73. ```
  74. 2. Update `proxy.target` in **.umirc.ts** to `http://127.0.0.1:9380`:
  75. ```bash
  76. vim .umirc.ts
  77. ```
  78. 3. Start up the RAGFlow frontend service:
  79. ```bash
  80. npm run dev
  81. ```
  82. *The following message appears, showing the IP address and port number of your frontend service:*
  83. ![](https://github.com/user-attachments/assets/0daf462c-a24d-4496-a66f-92533534e187)
  84. ### Access the RAGFlow service
  85. In your web browser, enter `http://127.0.0.1:<PORT>/`, ensuring the port number matches that shown in the screenshot above.
  86. ### Stop the RAGFlow service when the development is done
  87. 1. Stop the RAGFlow frontend service:
  88. ```bash
  89. pkill npm
  90. ```
  91. 2. Stop the RAGFlow backend service:
  92. ```bash
  93. pkill -f "docker/entrypoint.sh"
  94. ```