ragflow icon indicating copy to clipboard operation
ragflow copied to clipboard

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

Open gschmutz opened this issue 1 year ago • 5 comments

Is there an existing issue for the same feature request?

  • [X] I have checked the existing issues.

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

gschmutz avatar Nov 10 '24 21:11 gschmutz

Waiting for that good PR... Appreciate it.

KevinHuSh avatar Nov 11 '24 02:11 KevinHuSh

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 avatar Nov 11 '24 20:11 gschmutz

@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).

gschmutz avatar Nov 11 '24 20:11 gschmutz

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

yuzhichang avatar Nov 12 '24 15:11 yuzhichang

@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.

gschmutz avatar Nov 14 '24 13:11 gschmutz

Done.

yuzhichang avatar Dec 17 '24 08:12 yuzhichang