Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. ---
  2. sidebar_position: 2
  3. slug: /launch_ragflow_from_source
  4. ---
  5. # Launch 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. Check the configuration in **conf/service_conf.yaml**, ensuring all hosts and ports are correctly set.
  65. 5. Run the **entrypoint.sh** script to launch the backend service:
  66. ```shell
  67. JEMALLOC_PATH=$(pkg-config --variable=libdir jemalloc)/libjemalloc.so;
  68. LD_PRELOAD=$JEMALLOC_PATH python rag/svr/task_executor.py 1;
  69. ```
  70. ```shell
  71. python api/ragflow_server.py;
  72. ```
  73. ### Launch the RAGFlow frontend service
  74. 1. Navigate to the `web` directory and install the frontend dependencies:
  75. ```bash
  76. cd web
  77. npm install
  78. ```
  79. 2. Update `proxy.target` in **.umirc.ts** to `http://127.0.0.1:9380`:
  80. ```bash
  81. vim .umirc.ts
  82. ```
  83. 3. Start up the RAGFlow frontend service:
  84. ```bash
  85. npm run dev
  86. ```
  87. *The following message appears, showing the IP address and port number of your frontend service:*
  88. ![](https://github.com/user-attachments/assets/0daf462c-a24d-4496-a66f-92533534e187)
  89. ### Access the RAGFlow service
  90. In your web browser, enter `http://127.0.0.1:<PORT>/`, ensuring the port number matches that shown in the screenshot above.
  91. ### Stop the RAGFlow service when the development is done
  92. 1. Stop the RAGFlow frontend service:
  93. ```bash
  94. pkill npm
  95. ```
  96. 2. Stop the RAGFlow backend service:
  97. ```bash
  98. pkill -f "docker/entrypoint.sh"
  99. ```