Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

launch_ragflow_from_source.md 3.5KB

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