fix: add missing env vars and default values of service_conf.yaml (#9289)

### What problem does this PR solve?

Add missing env var `MYSQL_MAX_PACKET` to service_conf.yaml.template,
and add default values to opendal config to fix npe.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
He Wang
2025-08-07 10:41:05 +08:00
committed by GitHub
parent 35539092d0
commit 4fc9e42e74
3 changed files with 5 additions and 2 deletions

View File

@ -62,6 +62,8 @@ MYSQL_DBNAME=rag_flow
# The port used to expose the MySQL service to the host machine, # The port used to expose the MySQL service to the host machine,
# allowing EXTERNAL access to the MySQL database running inside the Docker container. # allowing EXTERNAL access to the MySQL database running inside the Docker container.
MYSQL_PORT=5455 MYSQL_PORT=5455
# The maximum size of communication packets sent to the MySQL server
MYSQL_MAX_PACKET=1073741824
# The hostname where the MinIO service is exposed # The hostname where the MinIO service is exposed
MINIO_HOST=minio MINIO_HOST=minio

View File

@ -9,6 +9,7 @@ mysql:
port: 3306 port: 3306
max_connections: 900 max_connections: 900
stale_timeout: 300 stale_timeout: 300
max_allowed_packet: ${MYSQL_MAX_PACKET:-1073741824}
minio: minio:
user: '${MINIO_USER:-rag_flow}' user: '${MINIO_USER:-rag_flow}'
password: '${MINIO_PASSWORD:-infini_rag_flow}' password: '${MINIO_PASSWORD:-infini_rag_flow}'

View File

@ -23,7 +23,7 @@ SET GLOBAL max_allowed_packet={}
def get_opendal_config(): def get_opendal_config():
try: try:
opendal_config = get_base_config('opendal', {}) opendal_config = get_base_config('opendal', {})
if opendal_config.get("scheme") == 'mysql': if opendal_config.get("scheme", "mysql") == 'mysql':
mysql_config = get_base_config('mysql', {}) mysql_config = get_base_config('mysql', {})
max_packet = mysql_config.get("max_allowed_packet", 134217728) max_packet = mysql_config.get("max_allowed_packet", 134217728)
kwargs = { kwargs = {
@ -33,7 +33,7 @@ def get_opendal_config():
"user": mysql_config.get("user", "root"), "user": mysql_config.get("user", "root"),
"password": mysql_config.get("password", ""), "password": mysql_config.get("password", ""),
"database": mysql_config.get("name", "test_open_dal"), "database": mysql_config.get("name", "test_open_dal"),
"table": opendal_config.get("config").get("oss_table", "opendal_storage"), "table": opendal_config.get("config", {}).get("oss_table", "opendal_storage"),
"max_allowed_packet": str(max_packet) "max_allowed_packet": str(max_packet)
} }
kwargs["connection_string"] = f"mysql://{kwargs['user']}:{quote_plus(kwargs['password'])}@{kwargs['host']}:{kwargs['port']}/{kwargs['database']}?max_allowed_packet={max_packet}" kwargs["connection_string"] = f"mysql://{kwargs['user']}:{quote_plus(kwargs['password'])}@{kwargs['host']}:{kwargs['port']}/{kwargs['database']}?max_allowed_packet={max_packet}"