mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
Dynamically create the service_conf.yaml file by replacing environment variables from .env (#3341)
### What problem does this PR solve? This pull request implements the feature mentioned in #3322. Instead of manually having to edit the `service_conf.yaml` file when changes have been made to `.env` and mapping it into the docker container at runtime, a template file is used and the values replaced by the environment variables from the `.env` file when the container is started. ### Type of change - [X] New Feature (non-breaking change which adds functionality) --------- Co-authored-by: Kevin Hu <kevinhu.sh@gmail.com> Co-authored-by: Zhichang Yu <yuzhichang@gmail.com>
This commit is contained in:
@ -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 `<YOUR_SERVING_PORT>: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
|
||||
|
||||
@ -140,7 +138,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`
|
||||
|
||||
@ -164,13 +162,13 @@ If you cannot download the RAGFlow Docker image, try the following mirrors.
|
||||
|
||||
### `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"`
|
||||
|
||||
@ -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 infinity 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
|
||||
|
||||
|
||||
@ -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:
|
||||
|
||||
Reference in New Issue
Block a user