infiniflow / ragflow

RAGFlow is an open-source RAG (Retrieval-Augmented Generation) engine based on deep document understanding.
https://ragflow.io
Apache License 2.0
22.93k stars 2.25k forks source link

[Feature Request]: Dynamically create the service_conf.yaml file by replacing environment variables from .env #3322

Open gschmutz opened 5 days ago

gschmutz commented 5 days ago

Is there an existing issue for the same feature request?

Is your feature request related to a problem?

Manually editing the service_conf.yaml file and keeping it in sync with the .env file could be avoided by dynamically replacing the values by the environment variables.

Describe the feature you'd like

Instead of manually having to edit the service_conf.yaml file and mapping it into the docker container at runtime, a template file could be used and the values replaced by the environment variables from the .env file.

ragflow:
  host: ${RAGFLOW_HOST:-0.0.0.0}
  http_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
...

This template file needs to be copied into the docker image so that it is available for the replacement.

The replacement of the env vars would be done in the entrypoint.sh file and the mapping of the service_conf.yaml file in the docker-compose.yaml is no longer necessary.

Describe implementation you've considered

see description above.

I have it working locally and could submit a pull request with the changes.

Documentation, adoption, use case

No response

Additional information

No response

KevinHuSh commented 5 days ago

Waiting for that good PR... Appreciate it.

gschmutz commented 4 days ago

Just submitted the PR. Also changed the documentation accordingly. I decided to name the template file service_conf.yaml.template to distinguish it from the service_conf.yaml file, which is generated and used at runtime.

And I was only able to change the EN version of the documentation ;-)

gschmutz commented 4 days ago

@KevinHuSh by the way, the reason why I needed this feature, is the fact that I want to add RAGFlow to the Platys Modern Data Platform stack, a flexible way to generate docker-compose.yml files with various combinations of components (soon including RAGFlow).

yuzhichang commented 4 days ago

@gschmutz ragflow uses one of elasticsearch and infinity as the chunk store. It chould be an issue for Platys to select one.

gschmutz commented 2 days ago

@gschmutz ragflow uses one of elasticsearch and infinity as the chunk store. It chould be an issue for Platys to select one.

Hi @yuzhichang just saw the changes in the docker-compose-base.yaml, will integrate it into Platys, thanks for letting me know. Also wasn't aware of Infinity.