Skip to content

Default new installs to database discovery - #5580

Merged
nobodyiam merged 3 commits into
apolloconfig:masterfrom
nobodyiam:codex/default-db-discovery
Mar 21, 2026
Merged

nobodyiam merged 3 commits into
apolloconfig:masterfrom
nobodyiam:codex/default-db-discovery

Conversation

@nobodyiam

@nobodyiam nobodyiam commented Mar 17, 2026 •

Copy link
Copy Markdown
Member

What's the purpose of this PR

Switch the official open source Config/Admin packaging defaults from built-in Eureka to database-discovery for new installations, while preserving Eureka as an explicit compatibility fallback for upgraded deployments.

This change intentionally does not refactor runtime discovery selection. It only changes the official packaging/install defaults and updates the deployment docs so that:

  • new official builds/installations default to github,database-discovery
  • existing Eureka deployments can keep the old behavior by explicitly setting SPRING_PROFILES_ACTIVE=github, spring.profiles.active=github, or rebuilding with -Dapollo_profile=github

Which issue(s) this PR fixes:

N/A

Brief changelog

  • change scripts/build.sh and scripts/build.bat so Config/Admin packages default to github,database-discovery
  • keep Portal default unchanged as github,auth
  • clarify package comments and Docker hints for explicit legacy Eureka fallback
  • update English and Chinese deployment docs to document database-discovery as supported since 2.1.0 and default since 3.0.0
  • update CHANGES.md with an explicit release-note entry for this default behavior change and the Eureka fallback path

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Read the Contributing Guide before making this pull request.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit tests to verify the code.
  • Run mvn clean test to make sure this pull request doesn't break anything.
  • Run mvn spotless:apply to format your code.
  • Update the CHANGES log.

Verification details

  • ./mvnw spotless:apply
  • ./mvnw clean test
  • ./mvnw -DskipTests package -pl apollo-configservice,apollo-adminservice -am -Dapollo_profile=github,database-discovery '-Dspring_datasource_url=jdbc:mysql://127.0.0.1:3306/ApolloConfigDB?characterEncoding=utf8' -Dspring_datasource_username=apollo -Dspring_datasource_password=apollo
  • verified packaged application.yml defaults to github,database-discovery
  • verified SPRING_PROFILES_ACTIVE=github still activates the legacy Eureka profile path

Summary by CodeRabbit

  • New Features

    • Database-discovery is now enabled by default in official packages for improved service discovery capabilities.
  • Documentation

    • Updated deployment guides with migration guidance for users upgrading from legacy Eureka setups, including rollback steps.
  • Chores

    • Updated build configurations and application properties to reflect new default profiles.
    • Added documentation comments explaining configuration options and legacy behavior alternatives.

@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Mar 17, 2026
@coderabbitai

coderabbitai Bot commented Mar 17, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 680e1251-4c98-4cb2-9d75-514c2376d81c

📥 Commits

Reviewing files that changed from the base of the PR and between d271087 and 8517b55.

📒 Files selected for processing (1)
  • CHANGES.md

📝 Walkthrough

Walkthrough

This PR makes database-discovery enabled by default for apollo-configservice and apollo-adminservice in official builds: build scripts now include the database-discovery profile, configuration files and Dockerfiles add explanatory comments, and deployment docs (EN/ZH) are updated with notes and rollback guidance for legacy Eureka behavior.

Changes

Cohort / File(s) Summary
Changelog & Build Scripts
CHANGES.md, scripts/build.bat, scripts/build.sh
Updated changelog entry and build commands to add database-discovery to the active Maven profiles for config/admin builds.
Config Service Properties
apollo-configservice/src/main/resources/application.properties
Uncommented spring.profiles.group.github = mysql; added explanatory comment lines about default profiles and override options.
Admin Service Properties
apollo-adminservice/src/main/resources/application.properties
Added explanatory comments documenting build/discovery profiles and an extra commented profile entry for database-discovery.
Dockerfiles
apollo-configservice/src/main/docker/Dockerfile, apollo-adminservice/src/main/docker/Dockerfile
Inserted comment lines advising to set SPRING_PROFILES_ACTIVE=github (or docker env) to retain legacy Eureka behavior; no functional changes.
Deployment Docs (English)
docs/en/deployment/distributed-deployment-guide.md
Added and reorganized notes clarifying that official packages/images enable database-discovery by default, instructions to revert to Eureka, and concise notes about Eureka log/retry behavior and port/meta updates.
Deployment Docs (Chinese)
docs/zh/deployment/distributed-deployment-guide.md
Mirrors English doc updates: added notes about default database-discovery in releases/images, how to override or revert, and clarified meta/port handling and Eureka retry messages.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

lgtm

Suggested reviewers

  • hezhangjian
  • Anilople

Poem

🐰 I nibbled docs and build scripts bright,
Switched paths to database-discovery tonight.
A tiny note to keep old ways near,
Hop back to Eureka if you hold it dear. 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Default new installs to database discovery' directly and concisely summarizes the main change: switching default discovery mechanism from Eureka to database-discovery for new installations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (4)
docs/en/deployment/distributed-deployment-guide.md (4)

516-517: Clarify that eureka.service.url only applies to Eureka deployments.

Since database-discovery is now the default, the reference to updating eureka.service.url at the end of this note might confuse users. Consider making it explicit that this part only applies when using Eureka.

✏️ Suggested clarification
-> Note 3: To adjust the listening port of the service, you can modify the `SERVER_PORT` in scripts/startup.sh. In addition, apollo-configservice also assumes the responsibility of meta server. If you want to modify the port, update the meta server information used by apollo-portal and apollo-client as well. For details, see [2.2.1.1.2.4 Configuring the meta service information of apollo-portal](en/deployment/distributed-deployment-guide?id=_221124-configuring-apollo-portal39s-meta-service-information) and [1.2.2 Apollo Meta Server](en/client/java-sdk-user-guide?id=_122-apollo-meta-server). If you still use the built-in Eureka, you also need to update the `eureka.service.url` configuration item in the ApolloConfigDB.ServerConfig table.
+> Note 3: To adjust the listening port of the service, you can modify the `SERVER_PORT` in scripts/startup.sh. In addition, apollo-configservice also assumes the responsibility of meta server. If you want to modify the port, update the meta server information used by apollo-portal and apollo-client as well. For details, see [2.2.1.1.2.4 Configuring the meta service information of apollo-portal](en/deployment/distributed-deployment-guide?id=_221124-configuring-apollo-portal39s-meta-service-information) and [1.2.2 Apollo Meta Server](en/client/java-sdk-user-guide?id=_122-apollo-meta-server).
+>
+> If you still use the built-in Eureka (instead of database-discovery), you also need to update the `eureka.service.url` configuration item in the ApolloConfigDB.ServerConfig table.

Note: This change also addresses the markdownlint warning (MD028) by properly separating the Eureka-specific guidance. Based on the static analysis hint about blank lines in blockquotes.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/en/deployment/distributed-deployment-guide.md` around lines 516 - 517,
Update the note in distributed-deployment-guide.md to explicitly state that the
`eureka.service.url` change only applies when running with Eureka (not the
default database-discovery); mention that `SERVER_PORT` can be changed in
scripts/startup.sh and that apollo-configservice acts as meta server so
apollo-portal and apollo-client must update their meta info, then add a separate
sentence or paragraph for Eureka-specific guidance referencing the
`eureka.service.url` configuration in the ApolloConfigDB.ServerConfig table to
avoid confusion and to satisfy MD028 by separating the Eureka note from the
general port/meta guidance.

480-481: Consider breaking this long note into shorter sentences.

This note covers three important concepts in one sentence: (1) default profiles for new builds, (2) rollback for existing Eureka deployments, and (3) different methods based on deployment type. Breaking it into 2-3 shorter sentences would improve readability.

📝 Suggested restructuring
-> Note: When built with the official `build.sh/build.bat` script, `apollo-configservice` and `apollo-adminservice` default to `github,database-discovery`, while `apollo-portal` defaults to `github,auth`. If you are rebuilding source for an existing Eureka deployment and want to keep the old behavior, change the corresponding Maven command back to `-Dapollo_profile=github`. For already unpacked installation packages or running containers, explicitly set `SPRING_PROFILES_ACTIVE=github`, or configure `spring.profiles.active=github` in `config/application.properties`.
+> Note: When built with the official `build.sh/build.bat` script, `apollo-configservice` and `apollo-adminservice` default to `github,database-discovery`, while `apollo-portal` defaults to `github,auth`.
+>
+> If you are rebuilding source for an existing Eureka deployment and want to keep the old behavior, change the corresponding Maven command back to `-Dapollo_profile=github`.
+>
+> For already unpacked installation packages or running containers, explicitly set `SPRING_PROFILES_ACTIVE=github`, or configure `spring.profiles.active=github` in `config/application.properties`.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/en/deployment/distributed-deployment-guide.md` around lines 480 - 481,
Split the long Note into 2–3 shorter sentences: first state the default profiles
for freshly built services (apollo-configservice and apollo-adminservice →
github,database-discovery; apollo-portal → github,auth), then add a separate
sentence explaining how to preserve the old behavior when rebuilding source (use
the Maven flag -Dapollo_profile=github), and finally a short sentence covering
already unpacked packages or containers and the two ways to set the profile
(environment variable SPRING_PROFILES_ACTIVE=github or set
spring.profiles.active=github in config/application.properties). Keep each
sentence focused and use the exact identifiers (build.sh/build.bat,
-Dapollo_profile=github, SPRING_PROFILES_ACTIVE, config/application.properties,
apollo-configservice, apollo-adminservice, apollo-portal).

500-501: Consider breaking this long note into shorter sentences.

Similar to the note at line 480, this combines multiple concepts in one sentence. Breaking it into separate sentences would improve readability and make the rollback instructions easier to follow.

📝 Suggested restructuring
-> Note: Installation packages for `apollo-configservice` and `apollo-adminservice` generated from the official release packages, Docker images, or `build.sh/build.bat` now enable `database-discovery` by default. If you want an upgraded legacy Eureka deployment to keep the old behavior, explicitly set `SPRING_PROFILES_ACTIVE=github` at runtime, or configure `spring.profiles.active=github` in the unpacked `config/application.properties`.
+> Note: Installation packages for `apollo-configservice` and `apollo-adminservice` generated from the official release packages, Docker images, or `build.sh/build.bat` now enable `database-discovery` by default.
+>
+> If you want an upgraded legacy Eureka deployment to keep the old behavior, explicitly set `SPRING_PROFILES_ACTIVE=github` at runtime, or configure `spring.profiles.active=github` in the unpacked `config/application.properties`.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/en/deployment/distributed-deployment-guide.md` around lines 500 - 501,
Split the long note starting with "Note: Installation packages for
`apollo-configservice`..." into shorter sentences for clarity: state first that
new installation packages and images now enable `database-discovery` by default
for `apollo-configservice` and `apollo-adminservice`, then provide a separate
sentence explaining how to retain legacy Eureka behavior by setting
`SPRING_PROFILES_ACTIVE=github` at runtime or `spring.profiles.active=github` in
the unpacked `config/application.properties`; ensure the `database-discovery`,
`SPRING_PROFILES_ACTIVE`, `spring.profiles.active`,
`config/application.properties`, `apollo-configservice`, and
`apollo-adminservice` tokens are preserved so readers can locate the exact
settings.

756-759: Minor terminology inconsistency.

Lines 757-759 use different phrasing for the rollback scenarios compared to the notes at lines 480-481 and 500-501. While not incorrect, using consistent terminology would improve the documentation quality.

🔄 Suggested consistency improvement

For better consistency with earlier notes, consider aligning the terminology:

 2. If you are upgrading an existing Eureka deployment and want to keep the old behavior, choose the rollback method based on how you deploy:
-   - Unpacked installation packages or containers at runtime: set `SPRING_PROFILES_ACTIVE=github`, or configure `spring.profiles.active=github` in `config/application.properties`
+   - Unpacked installation packages or running containers: explicitly set `SPRING_PROFILES_ACTIVE=github` at runtime, or configure `spring.profiles.active=github` in `config/application.properties`
    - Source rebuilds: change the build command from `-Dapollo_profile=github,database-discovery` back to `-Dapollo_profile=github`

This matches the phrasing used in the notes at lines 480 and 500.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/en/deployment/distributed-deployment-guide.md` around lines 756 - 759,
The two rollback bullets use phrasing that differs from earlier notes; update
the wording to match the terminology and structure used previously by referring
to the same deployment categories and option names (use SPRING_PROFILES_ACTIVE /
spring.profiles.active for unpacked packages/containers and the -Dapollo_profile
build flags for source rebuilds), e.g., rephrase the introductory sentence and
each bullet so they mirror the earlier notes' wording and order while keeping
the exact symbols SPRING_PROFILES_ACTIVE, spring.profiles.active,
-Dapollo_profile=github,database-discovery and -Dapollo_profile=github for
clarity.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/zh/deployment/distributed-deployment-guide.md`:
- Around line 498-500: Remove the stray blank line separating the two blockquote
lines so the two notes remain a contiguous blockquote; locate the lines starting
with "> 注3:" and "> 注4:" in the distributed-deployment-guide.md content and
delete the empty line between them so the blockquote sequence is uninterrupted.

In `@scripts/build.sh`:
- Line 45: The mvn invocation in scripts/build.sh expands unquoted datasource
vars which can break the shell when values contain special characters (e.g. &);
update the mvn command that builds apollo-configservice and apollo-adminservice
to wrap the three datasource -D args in quotes (e.g.
-Dspring_datasource_url="$apollo_config_db_url",
-Dspring_datasource_username="$apollo_config_db_username",
-Dspring_datasource_password="$apollo_config_db_password") so variable expansion
is safe; keep the rest of the mvn options unchanged.

---

Nitpick comments:
In `@docs/en/deployment/distributed-deployment-guide.md`:
- Around line 516-517: Update the note in distributed-deployment-guide.md to
explicitly state that the `eureka.service.url` change only applies when running
with Eureka (not the default database-discovery); mention that `SERVER_PORT` can
be changed in scripts/startup.sh and that apollo-configservice acts as meta
server so apollo-portal and apollo-client must update their meta info, then add
a separate sentence or paragraph for Eureka-specific guidance referencing the
`eureka.service.url` configuration in the ApolloConfigDB.ServerConfig table to
avoid confusion and to satisfy MD028 by separating the Eureka note from the
general port/meta guidance.
- Around line 480-481: Split the long Note into 2–3 shorter sentences: first
state the default profiles for freshly built services (apollo-configservice and
apollo-adminservice → github,database-discovery; apollo-portal → github,auth),
then add a separate sentence explaining how to preserve the old behavior when
rebuilding source (use the Maven flag -Dapollo_profile=github), and finally a
short sentence covering already unpacked packages or containers and the two ways
to set the profile (environment variable SPRING_PROFILES_ACTIVE=github or set
spring.profiles.active=github in config/application.properties). Keep each
sentence focused and use the exact identifiers (build.sh/build.bat,
-Dapollo_profile=github, SPRING_PROFILES_ACTIVE, config/application.properties,
apollo-configservice, apollo-adminservice, apollo-portal).
- Around line 500-501: Split the long note starting with "Note: Installation
packages for `apollo-configservice`..." into shorter sentences for clarity:
state first that new installation packages and images now enable
`database-discovery` by default for `apollo-configservice` and
`apollo-adminservice`, then provide a separate sentence explaining how to retain
legacy Eureka behavior by setting `SPRING_PROFILES_ACTIVE=github` at runtime or
`spring.profiles.active=github` in the unpacked `config/application.properties`;
ensure the `database-discovery`, `SPRING_PROFILES_ACTIVE`,
`spring.profiles.active`, `config/application.properties`,
`apollo-configservice`, and `apollo-adminservice` tokens are preserved so
readers can locate the exact settings.
- Around line 756-759: The two rollback bullets use phrasing that differs from
earlier notes; update the wording to match the terminology and structure used
previously by referring to the same deployment categories and option names (use
SPRING_PROFILES_ACTIVE / spring.profiles.active for unpacked packages/containers
and the -Dapollo_profile build flags for source rebuilds), e.g., rephrase the
introductory sentence and each bullet so they mirror the earlier notes' wording
and order while keeping the exact symbols SPRING_PROFILES_ACTIVE,
spring.profiles.active, -Dapollo_profile=github,database-discovery and
-Dapollo_profile=github for clarity.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e5f9df58-c28e-4a61-9ab8-500368d32cf7

📥 Commits

Reviewing files that changed from the base of the PR and between 4c527a4 and d271087.

📒 Files selected for processing (9)
  • CHANGES.md
  • apollo-adminservice/src/main/docker/Dockerfile
  • apollo-adminservice/src/main/resources/application.properties
  • apollo-configservice/src/main/docker/Dockerfile
  • apollo-configservice/src/main/resources/application.properties
  • docs/en/deployment/distributed-deployment-guide.md
  • docs/zh/deployment/distributed-deployment-guide.md
  • scripts/build.bat
  • scripts/build.sh

Comment on lines +498 to +500
> 注3:如要调整服务的监听端口,可以修改scripts/startup.sh中的`SERVER_PORT`。另外apollo-configservice同时承担meta server职责,如果要修改端口,需要同步更新apollo-portal和apollo-client中的meta server信息,详见:[2.2.1.1.2.4 配置apollo-portal的meta service信息](#_221124-配置apollo-portal的meta-service信息)和[1.2.2 Apollo Meta Server](zh/client/java-sdk-user-guide#_122-apollo-meta-server)。如果当前仍使用内置Eureka,还需要同时更新ApolloConfigDB.ServerConfig表中的`eureka.service.url`配置项。

> 注4:如果ApolloConfigDB.ServerConfig的eureka.service.url只配了当前正在启动的机器的话,在启动apollo-configservice的过程中会在日志中输出eureka注册失败的信息,如`com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused`。需要注意的是,这个是预期的情况,因为apollo-configservice需要向Meta Server(它自己)注册服务,但是因为在启动过程中,自己还没起来,所以会报这个错。后面会进行重试的动作,所以等自己服务起来后就会注册正常了。
> 注4:仅当继续使用内置Eureka时,如果ApolloConfigDB.ServerConfig的`eureka.service.url`只配了当前正在启动的机器,那么在启动apollo-configservice的过程中会在日志中输出eureka注册失败的信息,如`com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused`。这是预期现象,因为apollo-configservice需要向Meta Server(它自己)注册服务,但在启动过程中自己还没有完全起来。后续会自动重试,等服务启动完成后注册就会正常。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Remove the blank line inside this blockquote sequence.

There is a blank line between > 注3 and > 注4, which can trigger markdown lint/render inconsistencies. Keep the blockquote lines contiguous.

✏️ Suggested markdown fix
 > 注3:如要调整服务的监听端口,可以修改scripts/startup.sh中的`SERVER_PORT`。另外apollo-configservice同时承担meta server职责,如果要修改端口,需要同步更新apollo-portal和apollo-client中的meta server信息,详见:[2.2.1.1.2.4 配置apollo-portal的meta service信息](`#_221124-配置apollo-portal的meta-service信息`)和[1.2.2 Apollo Meta Server](zh/client/java-sdk-user-guide#_122-apollo-meta-server)。如果当前仍使用内置Eureka,还需要同时更新ApolloConfigDB.ServerConfig表中的`eureka.service.url`配置项。
-
 > 注4:仅当继续使用内置Eureka时,如果ApolloConfigDB.ServerConfig的`eureka.service.url`只配了当前正在启动的机器,那么在启动apollo-configservice的过程中会在日志中输出eureka注册失败的信息,如`com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused`。这是预期现象,因为apollo-configservice需要向Meta Server(它自己)注册服务,但在启动过程中自己还没有完全起来。后续会自动重试,等服务启动完成后注册就会正常。
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
> 注3:如要调整服务的监听端口,可以修改scripts/startup.sh中的`SERVER_PORT`。另外apollo-configservice同时承担meta server职责,如果要修改端口,需要同步更新apollo-portal和apollo-client中的meta server信息,详见:[2.2.1.1.2.4 配置apollo-portal的meta service信息](#_221124-配置apollo-portal的meta-service信息)和[1.2.2 Apollo Meta Server](zh/client/java-sdk-user-guide#_122-apollo-meta-server)。如果当前仍使用内置Eureka,还需要同时更新ApolloConfigDB.ServerConfig表中的`eureka.service.url`配置项。
> 注4:如果ApolloConfigDB.ServerConfig的eureka.service.url只配了当前正在启动的机器的话,在启动apollo-configservice的过程中会在日志中输出eureka注册失败的信息,如`com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused`。需要注意的是,这个是预期的情况,因为apollo-configservice需要向Meta Server(它自己)注册服务,但是因为在启动过程中,自己还没起来,所以会报这个错。后面会进行重试的动作,所以等自己服务起来后就会注册正常了。
> 注4:仅当继续使用内置Eureka时,如果ApolloConfigDB.ServerConfig的`eureka.service.url`只配了当前正在启动的机器,那么在启动apollo-configservice的过程中会在日志中输出eureka注册失败的信息,如`com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused`。这是预期现象,因为apollo-configservice需要向Meta Server(它自己)注册服务,但在启动过程中自己还没有完全起来。后续会自动重试,等服务启动完成后注册就会正常。
> 注3:如要调整服务的监听端口,可以修改scripts/startup.sh中的`SERVER_PORT`。另外apollo-configservice同时承担meta server职责,如果要修改端口,需要同步更新apollo-portal和apollo-client中的meta server信息,详见:[2.2.1.1.2.4 配置apollo-portal的meta service信息](`#_221124-配置apollo-portal的meta-service信息`)和[1.2.2 Apollo Meta Server](zh/client/java-sdk-user-guide#_122-apollo-meta-server)。如果当前仍使用内置Eureka,还需要同时更新ApolloConfigDB.ServerConfig表中的`eureka.service.url`配置项。
> 注4:仅当继续使用内置Eureka时,如果ApolloConfigDB.ServerConfig的`eureka.service.url`只配了当前正在启动的机器,那么在启动apollo-configservice的过程中会在日志中输出eureka注册失败的信息,如`com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused`。这是预期现象,因为apollo-configservice需要向Meta Server(它自己)注册服务,但在启动过程中自己还没有完全起来。后续会自动重试,等服务启动完成后注册就会正常。
🧰 Tools
🪛 markdownlint-cli2 (0.21.0)

[warning] 498-498: Link fragments should be valid

(MD051, link-fragments)


[warning] 499-499: Blank line inside blockquote

(MD028, no-blanks-blockquote)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/zh/deployment/distributed-deployment-guide.md` around lines 498 - 500,
Remove the stray blank line separating the two blockquote lines so the two notes
remain a contiguous blockquote; locate the lines starting with "> 注3:" and ">
注4:" in the distributed-deployment-guide.md content and delete the empty line
between them so the blockquote sequence is uninterrupted.

Comment thread scripts/build.sh
echo "==== starting to build config-service and admin-service ===="

mvn clean package -DskipTests -pl apollo-configservice,apollo-adminservice -am -Dapollo_profile=github -Dspring_datasource_url=$apollo_config_db_url -Dspring_datasource_username=$apollo_config_db_username -Dspring_datasource_password=$apollo_config_db_password
mvn clean package -DskipTests -pl apollo-configservice,apollo-adminservice -am -Dapollo_profile=github,database-discovery -Dspring_datasource_url=$apollo_config_db_url -Dspring_datasource_username=$apollo_config_db_username -Dspring_datasource_password=$apollo_config_db_password

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify unquoted datasource -D arguments in shell build scripts.
rg -nP --type=sh 'mvn .* -Dspring_datasource_(url|username|password)=\$[A-Za-z_][A-Za-z0-9_]*' scripts/build.sh

Repository: apolloconfig/apollo

Length of output: 606


Quote datasource -D arguments to avoid shell parsing breaks.

The unquoted datasource variable expansions can cause command failures if values contain special characters like &. JDBC URLs commonly include & in query parameters, making this a real risk.

Proposed fix
-mvn clean package -DskipTests -pl apollo-configservice,apollo-adminservice -am -Dapollo_profile=github,database-discovery -Dspring_datasource_url=$apollo_config_db_url -Dspring_datasource_username=$apollo_config_db_username -Dspring_datasource_password=$apollo_config_db_password
+mvn clean package -DskipTests -pl apollo-configservice,apollo-adminservice -am -Dapollo_profile=github,database-discovery "-Dspring_datasource_url=$apollo_config_db_url" "-Dspring_datasource_username=$apollo_config_db_username" "-Dspring_datasource_password=$apollo_config_db_password"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/build.sh` at line 45, The mvn invocation in scripts/build.sh expands
unquoted datasource vars which can break the shell when values contain special
characters (e.g. &); update the mvn command that builds apollo-configservice and
apollo-adminservice to wrap the three datasource -D args in quotes (e.g.
-Dspring_datasource_url="$apollo_config_db_url",
-Dspring_datasource_username="$apollo_config_db_username",
-Dspring_datasource_password="$apollo_config_db_password") so variable expansion
is safe; keep the rest of the mvn options unchanged.

@nobodyiam
nobodyiam merged commit bcd6080 into apolloconfig:master Mar 21, 2026
8 checks passed
@nobodyiam
nobodyiam deleted the codex/default-db-discovery branch March 21, 2026 07:38
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 21, 2026
@nobodyiam nobodyiam added this to the 3.0.0 milestone Jul 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant