[Bug Report] one-click: CubeTemplateCenter keeps the bundled MySQL endpoint when an external database is configured
Summary
With an external database (CUBE_EXTERNAL_POSTGRES_HOST or CUBE_EXTERNAL_MYSQL_HOST), the one-click installer rewrites instance_db_config only in CubeMaster's conf.yaml. CubeTemplateCenter's conf.yaml keeps the bundled-MySQL endpoint 127.0.0.1:3306, but the bundled MySQL is not installed in that mode, so TemplateCenter cannot reach the database.
Environment
- CubeSandbox version / commit:
master@3b4772c5 - Host OS and kernel version: not host-specific (installer config generation only); reproduced in a Debian 13 container with GNU sed
- KVM info (
modinfo kvm): n/a - Deployment mode: single-node, one-click, control role
- Relevant component:
deploy/one-clickinstaller, CubeTemplateCenter
Steps to Reproduce
Run the installer's own functions on the shipped templates, in the same order as install.sh (generate_templatecenter_config, then patch_cubemaster_external_deps), from the repository root:
PKG_ROOT=$(mktemp -d); mkdir -p "$PKG_ROOT/CubeMaster" "$PKG_ROOT/CubeTemplateCenter"
cp configs/single-node/cubemaster.yaml "$PKG_ROOT/CubeMaster/conf.yaml"
cp configs/single-node/templatecenter.yaml "$PKG_ROOT/CubeTemplateCenter/conf.yaml"
source deploy/one-click/lib/common.sh
for fn in init_external_dep_defaults generate_templatecenter_config patch_cubemaster_external_deps; do
eval "$(awk "/^${fn}\(\) \{/{f=1} f{print} f&&/^}/{exit}" deploy/one-click/install.sh)"
done
DEPLOY_ROLE=control
CUBE_DATABASE_DRIVER=postgres
CUBE_EXTERNAL_POSTGRES_HOST=pg.example.internal
init_external_dep_defaults
generate_templatecenter_config
patch_cubemaster_external_deps
for c in CubeMaster CubeTemplateCenter; do
echo "--- $c"; sed -n '/^instance_db_config:/,/^[a-z]/p' "$PKG_ROOT/$c/conf.yaml" | grep -E 'driver|addr'
doneExpected Behavior
TemplateCenter's instance_db_config points at the same database as CubeMaster (driver, addr, user, pwd, db_name, plus ssl_mode for PostgreSQL). TemplateCenter opens the same schema and runs the same migrations as CubeMaster (initDatabaseSchema in CubeTemplateCenter/cmd/templatecenter/app/main.go).
Actual Behavior
--- CubeMaster
driver: "postgres"
addr: "pg.example.internal:5432"
--- CubeTemplateCenter
addr: "127.0.0.1:3306"The TemplateCenter template has no driver: line, so dao.Open falls back to mysql (pkgs/cubedb/dao/dao.go), and TemplateCenter targets the bundled MySQL at 127.0.0.1:3306, which one_click_skip_local_mysql has not installed. CUBE_EXTERNAL_MYSQL_HOST=mysql.example.internal gives the same result: CubeMaster uses mysql.example.internal:3306, TemplateCenter uses 127.0.0.1:3306.
Additional Context
patch_cubemaster_external_depsalready patches TemplateCenter's Redis endpoint (one_click_patch_conf_redis_endpoint "${tc_cfg}" ...); only the database side is missing fortc_cfg.- Possible fix: apply the same
patch_cubemaster_instance_db_configcall toCubeTemplateCenter/conf.yaml, including thedriver:line insertion done for CubeMaster andssl_modefor PostgreSQL, with a contract test. - Found while adding managed PostgreSQL/Redis TLS support in #1840. Left out of that PR to keep it scoped to TLS.
Source: TencentCloud/CubeSandbox