[Bug Report] one-click: CubeTemplateCenter keeps the bundled MySQL endpoint when an external database is configured

Author: yurin-kamiCreated Sep 23, 2026Updated Sep 24, 2026
Labelsbugarea/CubeMasterneeds-triagebug-report-fixes-under-review

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-click installer, 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:

bash
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'
done

Expected 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_deps already patches TemplateCenter's Redis endpoint (one_click_patch_conf_redis_endpoint "${tc_cfg}" ...); only the database side is missing for tc_cfg.
  • Possible fix: apply the same patch_cubemaster_instance_db_config call to CubeTemplateCenter/conf.yaml, including the driver: line insertion done for CubeMaster and ssl_mode for 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