Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Unify MySQL configuration (#12644)

longbingljw4c4d434bc1ef
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 0025295181..da7867d3f1 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -164,7 +164,7 @@ jobs:
INFINITY_THRIFT_PORT=$((23817 + RUNNER_NUM * 10))
INFINITY_HTTP_PORT=$((23820 + RUNNER_NUM * 10))
INFINITY_PSQL_PORT=$((5432 + RUNNER_NUM * 10))
- MYSQL_PORT=$((5455 + RUNNER_NUM * 10))
+ EXPOSE_MYSQL_PORT=$((5455 + RUNNER_NUM * 10))
MINIO_PORT=$((9000 + RUNNER_NUM * 10))
MINIO_CONSOLE_PORT=$((9001 + RUNNER_NUM * 10))
REDIS_PORT=$((6379 + RUNNER_NUM * 10))
@@ -184,7 +184,7 @@ jobs:
echo -e "INFINITY_THRIFT_PORT=${INFINITY_THRIFT_PORT}" >> docker/.env
echo -e "INFINITY_HTTP_PORT=${INFINITY_HTTP_PORT}" >> docker/.env
echo -e "INFINITY_PSQL_PORT=${INFINITY_PSQL_PORT}" >> docker/.env
- echo -e "MYSQL_PORT=${MYSQL_PORT}" >> docker/.env
+ echo -e "EXPOSE_MYSQL_PORT=${EXPOSE_MYSQL_PORT}" >> docker/.env
echo -e "MINIO_PORT=${MINIO_PORT}" >> docker/.env
echo -e "MINIO_CONSOLE_PORT=${MINIO_CONSOLE_PORT}" >> docker/.env
echo -e "REDIS_PORT=${REDIS_PORT}" >> docker/.env
diff --git a/docker/.env b/docker/.env
index 791650e046..0ba5f8c905 100644
--- a/docker/.env
+++ b/docker/.env
@@ -113,9 +113,12 @@ MYSQL_PASSWORD=infini_rag_flow
MYSQL_HOST=mysql
# The database of the MySQL service to use
MYSQL_DBNAME=rag_flow
+# The port used to connect to MySQL from RAGFlow container.
+# Change this if you use external MySQL.
+MYSQL_PORT=3306
# 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
+EXPOSE_MYSQL_PORT=5455
# The maximum size of communication packets sent to the MySQL server
MYSQL_MAX_PACKET=1073741824
diff --git a/docker/README.md b/docker/README.md
index f2f59cdf63..4c2eb71f19 100644
--- a/docker/README.md
+++ b/docker/README.md
@@ -52,6 +52,8 @@ The [.env](./.env) file contains important environment variables for Docker.
- `MYSQL_PASSWORD`
The password for MySQL.
- `MYSQL_PORT`
+ The port to connect to MySQL from RAGFlow container. Defaults to `3306`. Change this if you use an external MySQL.
+- `EXPOSE_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`.
### MinIO
diff --git a/docker/docker-compose-base.yml b/docker/docker-compose-base.yml
index 8c4916943d..374fc30e15 100644
--- a/docker/docker-compose-base.yml
+++ b/docker/docker-compose-base.yml
@@ -188,7 +188,7 @@ services:
--init-file /data/application/init.sql
--binlog_expire_logs_seconds=604800
ports:
- - ${MYSQL_PORT}:3306
+ - ${EXPOSE_MYSQL_PORT}:3306
volumes:
- mysql_data:/var/lib/mysql
- ./init.sql:/data/application/init.sql
diff --git a/docker/service_conf.yaml.template b/docker/service_conf.yaml.template
index c03eaf2a98..2b6f661da7 100644
--- a/docker/service_conf.yaml.template
+++ b/docker/service_conf.yaml.template
@@ -9,7 +9,7 @@ mysql:
user: '${MYSQL_USER:-root}'
password: '${MYSQL_PASSWORD:-infini_rag_flow}'
host: '${MYSQL_HOST:-mysql}'
- port: 3306
+ port: ${MYSQL_PORT:-3306}
max_connections: 900
stale_timeout: 300
max_allowed_packet: ${MYSQL_MAX_PACKET:-1073741824}
diff --git a/docs/configurations.md b/docs/configurations.md
index a993061e3e..e935c9405a 100644
--- a/docs/configurations.md
+++ b/docs/configurations.md
@@ -72,6 +72,8 @@ The [.env](https://github.com/infiniflow/ragflow/blob/main/docker/.env) file con
- `MYSQL_PASSWORD`
The password for MySQL.
- `MYSQL_PORT`
+ The port to connect to MySQL from RAGFlow container. Defaults to `3306`. Change this if you use an external MySQL.
+- `EXPOSE_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`.
### MinIO