From 71ddee5d742a64b375fd229b86076ab92fd29974 Mon Sep 17 00:00:00 2001 From: Guido Schmutz Date: Sun, 10 Nov 2024 19:59:59 +0100 Subject: [PATCH 01/12] update entrypoint.sh to replace environment variables in service_conf.yaml using a template file --- docker/.env | 13 +++++- docker/entrypoint.sh | 6 +++ docker/service_conf.yaml.template | 74 +++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 docker/service_conf.yaml.template diff --git a/docker/.env b/docker/.env index eccde03849a..9c4e3c38c07 100644 --- a/docker/.env +++ b/docker/.env @@ -1,9 +1,12 @@ # The version of Elasticsearch. STACK_VERSION=8.11.3 +# The hostname where the Elasticsearch service is exposed +ES_HOST=es01 + # The port used to expose the Elasticsearch service to the host machine, # allowing EXTERNAL access to the service running inside the Docker container. -ES_PORT=1200 +ES_PORT=9200 # The password for Elasticsearch. # When updated, you must revise the `es.password` entry in service_conf.yaml accordingly. @@ -22,10 +25,16 @@ MEM_LIMIT=8073741824 # The password for MySQL. # When updated, you must revise the `mysql.password` entry in service_conf.yaml. MYSQL_PASSWORD=infini_rag_flow +# The hostname where the MySQL service is exposed +MYSQL_HOST=mysql +# The database of the MySQL service to use +MYSQL_DBNAME=rag_flow # The port used to expose the MySQL service to the host machine, # allowing EXTERNAL access to the MySQL database running inside the Docker container. MYSQL_PORT=5455 +# The hostname where the MySQL service is exposed +MINIO_HOST=minio # The port used to expose the MinIO console interface to the host machine, # allowing EXTERNAL access to the web-based console running inside the Docker container. MINIO_CONSOLE_PORT=9001 @@ -39,6 +48,8 @@ MINIO_USER=rag_flow # When updated, you must revise the `minio.password` entry in service_conf.yaml accordingly. MINIO_PASSWORD=infini_rag_flow +# The hostname where the Redis service is exposed +REDIS_HOST=redis # The port used to expose the Redis service to the host machine, # allowing EXTERNAL access to the Redis service running inside the Docker container. REDIS_PORT=6379 diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 1c2c3bc35a2..f1732396823 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -1,5 +1,11 @@ #!/bin/bash +# replace env variables in the service_conf.yaml file +while IFS= read -r line || [[ -n "$line" ]]; do + # Use eval to interpret the variable with default values + eval "echo \"$line\"" >> /ragflow/docker/service_conf.yaml +done < /ragflow/docker/service_conf.yaml.template + # unset http proxy which maybe set by docker daemon export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY="" diff --git a/docker/service_conf.yaml.template b/docker/service_conf.yaml.template new file mode 100644 index 00000000000..782a88a6efa --- /dev/null +++ b/docker/service_conf.yaml.template @@ -0,0 +1,74 @@ +ragflow: + host: ${RAGFLOW_HOST:-0.0.0.0} + http_port: ${RAGFLOW_PORT:-9380} +mysql: + name: '${MYSQL_DBNAME:-rag_flow}' + user: '${MYSQL_USER:-root}' + password: '${MYSQL_PASSWORD:-infini_rag_flow}' + host: '${MYSQL_HOST:-mysql}' + port: 3306 + max_connections: 100 + stale_timeout: 30 +minio: + user: '${MINIO_USER:-rag_flow}' + password: '${MINIO_PASSWORD:-infini_rag_flow}' + host: '${MINIO_HOST:-minio}:${MINIO_PORT:-9000}' +es: + hosts: 'http://${ES_HOST:-es01}:${ES_PORT:-9200}' + username: '${ES_USER:-elastic}' + password: '${ES_PASSWORD:-infini_rag_flow}' +redis: + db: 1 + password: '${REDIS_PASSWORD:-infini_rag_flow}' + host: '${REDIS_HOST:-redis}:${REDIS_PORT:-6379}' + +# postgres: +# name: 'rag_flow' +# user: 'rag_flow' +# password: 'infini_rag_flow' +# host: 'postgres' +# port: 5432 +# max_connections: 100 +# stale_timeout: 30 +# s3: +# endpoint: 'endpoint' +# access_key: 'access_key' +# secret_key: 'secret_key' +# region: 'region' +# azure: +# auth_type: 'sas' +# container_url: 'container_url' +# sas_token: 'sas_token' +# azure: +# auth_type: 'spn' +# account_url: 'account_url' +# client_id: 'client_id' +# secret: 'secret' +# tenant_id: 'tenant_id' +# container_name: 'container_name' +# user_default_llm: +# factory: 'Tongyi-Qianwen' +# api_key: 'sk-xxxxxxxxxxxxx' +# base_url: '' +# oauth: +# github: +# client_id: xxxxxxxxxxxxxxxxxxxxxxxxx +# secret_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxx +# url: https://github.com/login/oauth/access_token +# feishu: +# app_id: cli_xxxxxxxxxxxxxxxxxxx +# app_secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxx +# app_access_token_url: https://open.feishu.cn/open-apis/auth/v3/app_access_token/internal +# user_access_token_url: https://open.feishu.cn/open-apis/authen/v1/oidc/access_token +# grant_type: 'authorization_code' +# authentication: +# client: +# switch: false +# http_app_key: +# http_secret_key: +# site: +# switch: false +# permission: +# switch: false +# component: false +# dataset: false From 7ac07d4f7f319825cccfd5673fa192197150af3c Mon Sep 17 00:00:00 2001 From: Guido Schmutz Date: Sun, 10 Nov 2024 20:50:20 +0100 Subject: [PATCH 02/12] copy service_conf.yaml.template --- Dockerfile.slim | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile.slim b/Dockerfile.slim index f61c68b5f2c..f2671d26870 100644 --- a/Dockerfile.slim +++ b/Dockerfile.slim @@ -112,6 +112,7 @@ ENV PATH="${VIRTUAL_ENV}/bin:${PATH}" ENV PYTHONPATH=/ragflow/ +COPY docker/service_conf.yaml.template ./docker/service_conf.yaml.template COPY docker/entrypoint.sh ./entrypoint.sh RUN chmod +x ./entrypoint.sh From 3ede5b1d6b4679e6230469c2f07c2cdc18eae844 Mon Sep 17 00:00:00 2001 From: Guido Schmutz Date: Sun, 10 Nov 2024 20:50:59 +0100 Subject: [PATCH 03/12] Revert "copy service_conf.yaml.template" This reverts commit 7ac07d4f7f319825cccfd5673fa192197150af3c. --- Dockerfile.slim | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile.slim b/Dockerfile.slim index f2671d26870..f61c68b5f2c 100644 --- a/Dockerfile.slim +++ b/Dockerfile.slim @@ -112,7 +112,6 @@ ENV PATH="${VIRTUAL_ENV}/bin:${PATH}" ENV PYTHONPATH=/ragflow/ -COPY docker/service_conf.yaml.template ./docker/service_conf.yaml.template COPY docker/entrypoint.sh ./entrypoint.sh RUN chmod +x ./entrypoint.sh From d9c80f332b325dfe008f993927865a04323bf987 Mon Sep 17 00:00:00 2001 From: Guido Schmutz Date: Sun, 10 Nov 2024 20:51:39 +0100 Subject: [PATCH 04/12] Reapply "copy service_conf.yaml.template" This reverts commit 3ede5b1d6b4679e6230469c2f07c2cdc18eae844. --- Dockerfile.slim | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile.slim b/Dockerfile.slim index f61c68b5f2c..f2671d26870 100644 --- a/Dockerfile.slim +++ b/Dockerfile.slim @@ -112,6 +112,7 @@ ENV PATH="${VIRTUAL_ENV}/bin:${PATH}" ENV PYTHONPATH=/ragflow/ +COPY docker/service_conf.yaml.template ./docker/service_conf.yaml.template COPY docker/entrypoint.sh ./entrypoint.sh RUN chmod +x ./entrypoint.sh From 37c984e9314f2d85c1038fd5d0bf177b96fcd1b6 Mon Sep 17 00:00:00 2001 From: Guido Schmutz Date: Sun, 10 Nov 2024 20:52:10 +0100 Subject: [PATCH 05/12] Revert "Reapply "copy service_conf.yaml.template"" This reverts commit d9c80f332b325dfe008f993927865a04323bf987. --- Dockerfile.slim | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile.slim b/Dockerfile.slim index f2671d26870..f61c68b5f2c 100644 --- a/Dockerfile.slim +++ b/Dockerfile.slim @@ -112,7 +112,6 @@ ENV PATH="${VIRTUAL_ENV}/bin:${PATH}" ENV PYTHONPATH=/ragflow/ -COPY docker/service_conf.yaml.template ./docker/service_conf.yaml.template COPY docker/entrypoint.sh ./entrypoint.sh RUN chmod +x ./entrypoint.sh From 6099785c97b629d4ba9de8b31d02f1035e22b005 Mon Sep 17 00:00:00 2001 From: Guido Schmutz Date: Sun, 10 Nov 2024 20:57:45 +0100 Subject: [PATCH 06/12] copy service_conf.yaml.template file into docker folder --- Dockerfile.slim | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile.slim b/Dockerfile.slim index f61c68b5f2c..f2671d26870 100644 --- a/Dockerfile.slim +++ b/Dockerfile.slim @@ -112,6 +112,7 @@ ENV PATH="${VIRTUAL_ENV}/bin:${PATH}" ENV PYTHONPATH=/ragflow/ +COPY docker/service_conf.yaml.template ./docker/service_conf.yaml.template COPY docker/entrypoint.sh ./entrypoint.sh RUN chmod +x ./entrypoint.sh From 9fbbb6df6ef4b89d7c77fb2c892d741207b68ca5 Mon Sep 17 00:00:00 2001 From: Guido Schmutz Date: Sun, 10 Nov 2024 21:21:02 +0100 Subject: [PATCH 07/12] revert ES_PORT back to 1200 --- docker/.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/.env b/docker/.env index 9c4e3c38c07..c1c9faf0675 100644 --- a/docker/.env +++ b/docker/.env @@ -6,7 +6,7 @@ ES_HOST=es01 # The port used to expose the Elasticsearch service to the host machine, # allowing EXTERNAL access to the service running inside the Docker container. -ES_PORT=9200 +ES_PORT=1200 # The password for Elasticsearch. # When updated, you must revise the `es.password` entry in service_conf.yaml accordingly. From 354981c64a8e94eb75227eccc8b757032f99f6c7 Mon Sep 17 00:00:00 2001 From: Guido Schmutz Date: Sun, 10 Nov 2024 21:21:22 +0100 Subject: [PATCH 08/12] do not use env variables for the internal ports --- docker/service_conf.yaml.template | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docker/service_conf.yaml.template b/docker/service_conf.yaml.template index 782a88a6efa..c0d3a03eb4f 100644 --- a/docker/service_conf.yaml.template +++ b/docker/service_conf.yaml.template @@ -1,6 +1,6 @@ ragflow: host: ${RAGFLOW_HOST:-0.0.0.0} - http_port: ${RAGFLOW_PORT:-9380} + http_port: 9380 mysql: name: '${MYSQL_DBNAME:-rag_flow}' user: '${MYSQL_USER:-root}' @@ -12,21 +12,21 @@ mysql: minio: user: '${MINIO_USER:-rag_flow}' password: '${MINIO_PASSWORD:-infini_rag_flow}' - host: '${MINIO_HOST:-minio}:${MINIO_PORT:-9000}' + host: '${MINIO_HOST:-minio}:9000' es: - hosts: 'http://${ES_HOST:-es01}:${ES_PORT:-9200}' + hosts: 'http://${ES_HOST:-es01}:9200' username: '${ES_USER:-elastic}' password: '${ES_PASSWORD:-infini_rag_flow}' redis: db: 1 password: '${REDIS_PASSWORD:-infini_rag_flow}' - host: '${REDIS_HOST:-redis}:${REDIS_PORT:-6379}' + host: '${REDIS_HOST:-redis}:6379' # postgres: -# name: 'rag_flow' -# user: 'rag_flow' -# password: 'infini_rag_flow' -# host: 'postgres' +# name: '${POSTGRES_DBNAME:-rag_flow}' +# user: '${POSTGRES_USER:-rag_flow}' +# password: '${POSTGRES_PASSWORD:-infini_rag_flow}' +# host: '${POSTGRES_HOST:-postgres}' # port: 5432 # max_connections: 100 # stale_timeout: 30 From 01c35c37f5e7915a2445788e0c2cb378aef56543 Mon Sep 17 00:00:00 2001 From: Guido Schmutz Date: Mon, 11 Nov 2024 21:14:24 +0100 Subject: [PATCH 09/12] add copying service_conf.yaml.template into the container --- Dockerfile | 1 + Dockerfile.scratch.oc9 | 1 + 2 files changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index b700cca347e..99c8e9ffb91 100644 --- a/Dockerfile +++ b/Dockerfile @@ -119,6 +119,7 @@ ENV PATH="${VIRTUAL_ENV}/bin:${PATH}" ENV PYTHONPATH=/ragflow/ +COPY docker/service_conf.yaml.template ./docker/service_conf.yaml.template COPY docker/entrypoint.sh ./entrypoint.sh RUN chmod +x ./entrypoint.sh diff --git a/Dockerfile.scratch.oc9 b/Dockerfile.scratch.oc9 index 88504117125..ee69652e527 100644 --- a/Dockerfile.scratch.oc9 +++ b/Dockerfile.scratch.oc9 @@ -53,6 +53,7 @@ RUN conda run -n py11 python -m nltk.downloader wordnet ENV PYTHONPATH=/ragflow/ ENV HF_ENDPOINT=https://hf-mirror.com +COPY docker/service_conf.yaml.template ./docker/service_conf.yaml.template ADD docker/entrypoint.sh ./entrypoint.sh RUN chmod +x ./entrypoint.sh From 7282a31fc2c1bf32d28635808f15df3bab70b80a Mon Sep 17 00:00:00 2001 From: Guido Schmutz Date: Mon, 11 Nov 2024 21:14:44 +0100 Subject: [PATCH 10/12] remove volume mapping of service_conf.yaml file --- docker/docker-compose-gpu.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker/docker-compose-gpu.yml b/docker/docker-compose-gpu.yml index fd26869a84c..1f0fe8a4c85 100644 --- a/docker/docker-compose-gpu.yml +++ b/docker/docker-compose-gpu.yml @@ -16,7 +16,6 @@ services: - 80:80 - 443:443 volumes: - - ./service_conf.yaml:/ragflow/conf/service_conf.yaml - ./ragflow-logs:/ragflow/logs - ./nginx/ragflow.conf:/etc/nginx/conf.d/ragflow.conf - ./nginx/proxy.conf:/etc/nginx/proxy.conf From 6c25f088e60d6050151a346bbdf0fba14a636f0c Mon Sep 17 00:00:00 2001 From: Guido Schmutz Date: Mon, 11 Nov 2024 21:14:59 +0100 Subject: [PATCH 11/12] update documentation --- README.md | 17 ++++++---------- docker/README.md | 16 +++++++-------- docs/configurations.md | 20 +++++++++---------- .../develop/launch_ragflow_from_source.md | 4 ++-- docs/guides/llm_api_key_setup.md | 4 ++-- 5 files changed, 27 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index cb054bf0dad..30ea1b470ba 100644 --- a/README.md +++ b/README.md @@ -215,7 +215,7 @@ releases! 🌟 5. In your web browser, enter the IP address of your server and log in to RAGFlow. > With the default settings, you only need to enter `http://IP_OF_YOUR_MACHINE` (**sans** port number) as the default HTTP serving port `80` can be omitted when using the default configurations. -6. In [service_conf.yaml](./docker/service_conf.yaml), select the desired LLM factory in `user_default_llm` and update +6. In [service_conf.yaml.template](./docker/service_conf.yaml.template), select the desired LLM factory in `user_default_llm` and update the `API_KEY` field with the corresponding API key. > See [llm_api_key_setup](https://ragflow.io/docs/dev/llm_api_key_setup) for more information. @@ -228,16 +228,11 @@ When it comes to system configurations, you will need to manage the following fi - [.env](./docker/.env): Keeps the fundamental setups for the system, such as `SVR_HTTP_PORT`, `MYSQL_PASSWORD`, and `MINIO_PASSWORD`. -- [service_conf.yaml](./docker/service_conf.yaml): Configures the back-end services. -- [docker-compose.yml](./docker/docker-compose.yml): The system relies - on [docker-compose.yml](./docker/docker-compose.yml) to start up. - -You must ensure that changes to the [.env](./docker/.env) file are in line with what are in the [service_conf.yaml](./docker/service_conf.yaml) file. +- [service_conf.yaml.template](./docker/service_conf.yaml.template): Configures the back-end services. The environment variables in this file will be automatically populated when the Docker container starts. Any environment variables set within the Docker container will be available for use, allowing you to customize service behavior based on the deployment environment. +- [docker-compose.yml](./docker/docker-compose.yml): The system relies on [docker-compose.yml](./docker/docker-compose.yml) to start up. > The [./docker/README](./docker/README.md) file provides a detailed description of the environment settings and service -> configurations, and you are REQUIRED to ensure that all environment settings listed in -> the [./docker/README](./docker/README.md) file are aligned with the corresponding configurations in -> the [service_conf.yaml](./docker/service_conf.yaml) file. +> configurations which can be used as `${ENV_VARS}` in the [service_conf.yaml.template](./docker/service_conf.yaml.template) file. To update the default HTTP serving port (80), go to [docker-compose.yml](./docker/docker-compose.yml) and change `80:80` to `:80`. @@ -292,11 +287,11 @@ docker build -f Dockerfile -t infiniflow/ragflow:dev . docker compose -f docker/docker-compose-base.yml up -d ``` - Add the following line to `/etc/hosts` to resolve all hosts specified in **docker/service_conf.yaml** to `127.0.0.1`: + Add the following line to `/etc/hosts` to resolve all hosts specified in **docker/.env** to `127.0.0.1`: ``` 127.0.0.1 es01 mysql minio redis ``` - In **docker/service_conf.yaml**, update mysql port to `5455` and es port to `1200`, as specified in **docker/.env**. + In **docker/service_conf.yaml.template**, update mysql port to `5455` and es port to `1200`, as specified in **docker/.env**. 4. If you cannot access HuggingFace, set the `HF_ENDPOINT` environment variable to use a mirror site: diff --git a/docker/README.md b/docker/README.md index ae872654639..8d7b4691a0d 100644 --- a/docker/README.md +++ b/docker/README.md @@ -27,7 +27,7 @@ The [.env](./.env) file contains important environment variables for Docker. - `ES_PORT` The port used to expose the Elasticsearch service to the host machine, allowing **external** access to the service running inside the Docker container. Defaults to `1200`. - `ELASTIC_PASSWORD` - The password for Elasticsearch. When updated, you must revise the `es.password` entry in [service_conf.yaml](./service_conf.yaml) accordingly. + The password for Elasticsearch. ### Kibana @@ -46,7 +46,7 @@ The [.env](./.env) file contains important environment variables for Docker. ### MySQL - `MYSQL_PASSWORD` - The password for MySQL. When updated, you must revise the `mysql.password` entry in [service_conf.yaml](./service_conf.yaml) accordingly. + The password for MySQL. - `MYSQL_PORT` The port used to expose the MySQL service to the host machine, allowing **external** access to the MySQL database running inside the Docker container. Defaults to `5455`. @@ -57,16 +57,16 @@ The [.env](./.env) file contains important environment variables for Docker. - `MINIO_PORT` The port used to expose the MinIO API service to the host machine, allowing **external** access to the MinIO object storage service running inside the Docker container. Defaults to `9000`. - `MINIO_USER` - The username for MinIO. When updated, you must revise the `minio.user` entry in [service_conf.yaml](./service_conf.yaml) accordingly. + The username for MinIO. - `MINIO_PASSWORD` - The password for MinIO. When updated, you must revise the `minio.password` entry in [service_conf.yaml](./service_conf.yaml) accordingly. + The password for MinIO. ### Redis - `REDIS_PORT` The port used to expose the Redis service to the host machine, allowing **external** access to the Redis service running inside the Docker container. Defaults to `6379`. - `REDIS_PASSWORD` - The password for Redis. When updated, you must revise the `redis.password` entry in [service_conf.yaml](./service_conf.yaml) accordingly. + The password for Redis. ### RAGFlow @@ -113,7 +113,7 @@ The [.env](./.env) file contains important environment variables for Docker. ## 🐋 Service configuration -[service_conf.yaml](./service_conf.yaml) specifies the system-level configuration for RAGFlow and is used by its API server and task executor. +[service_conf.yaml](./service_conf.yaml) specifies the system-level configuration for RAGFlow and is used by its API server and task executor. In a dockerized setup, this file is automatically created based on the [service_conf.yaml.template](./service_conf.yaml.template) file (replacing all environment variables by their values). - `ragflow` - `host`: The API server's IP address inside the Docker container. Defaults to `0.0.0.0`. @@ -133,11 +133,11 @@ The [.env](./.env) file contains important environment variables for Docker. - `host`: The MinIO serving IP *and* port inside the Docker container. Defaults to `minio:9000`. - `oauth` - The OAuth configuration for signing up or signing in to RAGFlow using a third-party account. It is disabled by default. To enable this feature, uncomment the corresponding lines in **service_conf.yaml**. + The OAuth configuration for signing up or signing in to RAGFlow using a third-party account. It is disabled by default. To enable this feature, uncomment the corresponding lines in **service_conf.yaml.template**. - `github`: The GitHub authentication settings for your application. Visit the [Github Developer Settings page](https://github.com/settings/developers) to obtain your client_id and secret_key. - `user_default_llm` - The default LLM to use for a new RAGFlow user. It is disabled by default. To enable this feature, uncomment the corresponding lines in **service_conf.yaml**. + The default LLM to use for a new RAGFlow user. It is disabled by default. To enable this feature, uncomment the corresponding lines in **service_conf.yaml.template**. - `factory`: The LLM supplier. Available options: - `"OpenAI"` - `"DeepSeek"` diff --git a/docs/configurations.md b/docs/configurations.md index 7e8b9c9c93a..239d66beec0 100644 --- a/docs/configurations.md +++ b/docs/configurations.md @@ -12,11 +12,9 @@ Configurations for installing RAGFlow via Docker. When it comes to system configurations, you will need to manage the following files: - [.env](https://github.com/infiniflow/ragflow/blob/main/docker/.env): Contains important environment variables for Docker. -- [service_conf.yaml](https://github.com/infiniflow/ragflow/blob/main/docker/service_conf.yaml): Configures the back-end services. It specifies the system-level configuration for RAGFlow and is used by its API server and task executor. +- [service_conf.yaml.template](https://github.com/infiniflow/ragflow/blob/main/docker/service_conf.yaml.template): Configures the back-end services. It specifies the system-level configuration for RAGFlow and is used by its API server and task executor. Upon container startup, the `service_conf.yaml` file will be generated based on this template file. This process replaces any environment variables within the template, allowing for dynamic configuration tailored to the container's environment. - [docker-compose.yml](https://github.com/infiniflow/ragflow/blob/main/docker/docker-compose.yml): The Docker Compose file for starting up the RAGFlow service. -You must ensure that changes to the [.env](https://github.com/infiniflow/ragflow/blob/main/docker/.env) file are in line with what are in the [service_conf.yaml](https://github.com/infiniflow/ragflow/blob/main/docker/service_conf.yaml) file. - To update the default HTTP serving port (80), go to [docker-compose.yml](./docker/docker-compose.yml) and change `80:80` to `:80`. @@ -47,7 +45,7 @@ The [.env](https://github.com/infiniflow/ragflow/blob/main/docker/.env) file con - `ES_PORT` The port used to expose the Elasticsearch service to the host machine, allowing **external** access to the service running inside the Docker container. Defaults to `1200`. - `ELASTIC_PASSWORD` - The password for Elasticsearch. When updated, you must revise the `es.password` entry in [service_conf.yaml](https://github.com/infiniflow/ragflow/blob/main/docker/service_conf.yaml) accordingly. + The password for Elasticsearch. ### Kibana @@ -66,7 +64,7 @@ The [.env](https://github.com/infiniflow/ragflow/blob/main/docker/.env) file con ### MySQL - `MYSQL_PASSWORD` - The password for MySQL. When updated, you must revise the `mysql.password` entry in [service_conf.yaml](https://github.com/infiniflow/ragflow/blob/main/docker/service_conf.yaml) accordingly. + The password for MySQL. - `MYSQL_PORT` The port used to expose the MySQL service to the host machine, allowing **external** access to the MySQL database running inside the Docker container. Defaults to `5455`. @@ -77,16 +75,16 @@ The [.env](https://github.com/infiniflow/ragflow/blob/main/docker/.env) file con - `MINIO_PORT` The port used to expose the MinIO API service to the host machine, allowing **external** access to the MinIO object storage service running inside the Docker container. Defaults to `9000`. - `MINIO_USER` - The username for MinIO. When updated, you must revise the `minio.user` entry in [service_conf.yaml](https://github.com/infiniflow/ragflow/blob/main/docker/service_conf.yaml) accordingly. + The username for MinIO. - `MINIO_PASSWORD` - The password for MinIO. When updated, you must revise the `minio.password` entry in [service_conf.yaml](https://github.com/infiniflow/ragflow/blob/main/docker/service_conf.yaml) accordingly. + The password for MinIO. accordingly. ### Redis - `REDIS_PORT` The port used to expose the Redis service to the host machine, allowing **external** access to the Redis service running inside the Docker container. Defaults to `6379`. - `REDIS_PASSWORD` - The password for Redis. When updated, you must revise the `redis.password` entry in [service_conf.yaml](https://github.com/infiniflow/ragflow/blob/main/docker/service_conf.yaml) accordingly. + The password for Redis. ### RAGFlow @@ -134,7 +132,7 @@ If you cannot download the RAGFlow Docker image, try the following mirrors. ## Service configuration -[service_conf.yaml](https://github.com/infiniflow/ragflow/blob/main/docker/service_conf.yaml) specifies the system-level configuration for RAGFlow and is used by its API server and task executor. +[service_conf.yaml.template](https://github.com/infiniflow/ragflow/blob/main/docker/service_conf.yaml.template) specifies the system-level configuration for RAGFlow and is used by its API server and task executor. - `ragflow` - `host`: The API server's IP address inside the Docker container. Defaults to `0.0.0.0`. @@ -154,11 +152,11 @@ If you cannot download the RAGFlow Docker image, try the following mirrors. - `host`: The MinIO serving IP *and* port inside the Docker container. Defaults to `minio:9000`. - `oauth` - The OAuth configuration for signing up or signing in to RAGFlow using a third-party account. It is disabled by default. To enable this feature, uncomment the corresponding lines in **service_conf.yaml**. + The OAuth configuration for signing up or signing in to RAGFlow using a third-party account. It is disabled by default. To enable this feature, uncomment the corresponding lines in **service_conf.yaml.template**. - `github`: The GitHub authentication settings for your application. Visit the [Github Developer Settings](https://github.com/settings/developers) page to obtain your client_id and secret_key. - `user_default_llm` - The default LLM to use for a new RAGFlow user. It is disabled by default. To enable this feature, uncomment the corresponding lines in **service_conf.yaml**. + The default LLM to use for a new RAGFlow user. It is disabled by default. To enable this feature, uncomment the corresponding lines in **service_conf.yaml.template**. - `factory`: The LLM supplier. Available options: - `"OpenAI"` - `"DeepSeek"` diff --git a/docs/guides/develop/launch_ragflow_from_source.md b/docs/guides/develop/launch_ragflow_from_source.md index 0584aa14a50..27beffcdf47 100644 --- a/docs/guides/develop/launch_ragflow_from_source.md +++ b/docs/guides/develop/launch_ragflow_from_source.md @@ -64,13 +64,13 @@ docker compose -f docker/docker-compose-base.yml up -d ### Update `host` and `port` Settings for Third-party Services -1. Add the following line to `/etc/hosts` to resolve all hosts specified in **docker/service_conf.yaml** to `127.0.0.1`: +1. Add the following line to `/etc/hosts` to resolve all hosts specified in **docker/service_conf.yaml.template** to `127.0.0.1`: ``` 127.0.0.1 es01 mysql minio redis ``` -2. In **docker/service_conf.yaml**, update mysql port to `5455` and es port to `1200`, as specified in **docker/.env**. +2. In **docker/service_conf.yaml.template**, update mysql port to `5455` and es port to `1200`, as specified in **docker/.env**. ### Launch the RAGFlow Backend Service diff --git a/docs/guides/llm_api_key_setup.md b/docs/guides/llm_api_key_setup.md index 2d9c9563acb..89e2dd73ecb 100644 --- a/docs/guides/llm_api_key_setup.md +++ b/docs/guides/llm_api_key_setup.md @@ -19,7 +19,7 @@ If you find your online LLM is not on the list, don't feel disheartened. The lis You have two options for configuring your model API key: -- Configure it in **service_conf.yaml** before starting RAGFlow. +- Configure it in **service_conf.yaml.template** before starting RAGFlow. - Configure it on the **Model Providers** page after logging into RAGFlow. ### Configure model API key before starting up RAGFlow @@ -37,7 +37,7 @@ You have two options for configuring your model API key: ### Configure model API key after logging into RAGFlow :::caution WARNING -After logging into RAGFlow, configuring your model API key through the **service_conf.yaml** file will no longer take effect. +After logging into RAGFlow, configuring your model API key through the **service_conf.yaml.template** file will no longer take effect. ::: After logging into RAGFlow, you can *only* configure API Key on the **Model Providers** page: From bc14c4a36fdde643835aa2a16370ba77bac4c3e6 Mon Sep 17 00:00:00 2001 From: Zhichang Yu Date: Tue, 12 Nov 2024 22:44:15 +0800 Subject: [PATCH 12/12] remove service_conf.yaml at first --- Dockerfile | 2 +- Dockerfile.scratch.oc9 | 2 +- Dockerfile.slim | 2 +- docker/entrypoint.sh | 5 +++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index a695c04c9ab..6e0a1a831c4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -129,7 +129,7 @@ ENV PATH="${VIRTUAL_ENV}/bin:${PATH}" ENV PYTHONPATH=/ragflow/ -COPY docker/service_conf.yaml.template ./docker/service_conf.yaml.template +COPY docker/service_conf.yaml.template ./conf/service_conf.yaml.template COPY docker/entrypoint.sh ./entrypoint.sh RUN chmod +x ./entrypoint.sh diff --git a/Dockerfile.scratch.oc9 b/Dockerfile.scratch.oc9 index ee69652e527..50a93a6a0ab 100644 --- a/Dockerfile.scratch.oc9 +++ b/Dockerfile.scratch.oc9 @@ -53,7 +53,7 @@ RUN conda run -n py11 python -m nltk.downloader wordnet ENV PYTHONPATH=/ragflow/ ENV HF_ENDPOINT=https://hf-mirror.com -COPY docker/service_conf.yaml.template ./docker/service_conf.yaml.template +COPY docker/service_conf.yaml.template ./conf/service_conf.yaml.template ADD docker/entrypoint.sh ./entrypoint.sh RUN chmod +x ./entrypoint.sh diff --git a/Dockerfile.slim b/Dockerfile.slim index d4c7d8d2f00..6b093db8752 100644 --- a/Dockerfile.slim +++ b/Dockerfile.slim @@ -122,7 +122,7 @@ ENV PATH="${VIRTUAL_ENV}/bin:${PATH}" ENV PYTHONPATH=/ragflow/ -COPY docker/service_conf.yaml.template ./docker/service_conf.yaml.template +COPY docker/service_conf.yaml.template ./conf/service_conf.yaml.template COPY docker/entrypoint.sh ./entrypoint.sh RUN chmod +x ./entrypoint.sh diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index f1732396823..792bbca7a60 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -1,10 +1,11 @@ #!/bin/bash # replace env variables in the service_conf.yaml file +rm -rf /ragflow/conf/service_conf.yaml while IFS= read -r line || [[ -n "$line" ]]; do # Use eval to interpret the variable with default values - eval "echo \"$line\"" >> /ragflow/docker/service_conf.yaml -done < /ragflow/docker/service_conf.yaml.template + eval "echo \"$line\"" >> /ragflow/conf/service_conf.yaml +done < /ragflow/conf/service_conf.yaml.template # unset http proxy which maybe set by docker daemon export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY=""