From 3c0e693c2dfcb76aa6b05c5a4cdbd092d3c870bf Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Fri, 6 Nov 2026 23:50:29 +0100 Subject: [PATCH] fix(thingsboard): keep the package defaults in thingsboard.conf (#18499) The install replaced the file, which dropped JAVA_OPTS with install.data_dir, so creating a tenant failed. The DB settings are now appended, and an update restores the defaults on existing containers. The package upgrade keeps the edited file. Fixes #18483. --- ct/thingsboard.sh | 20 +++++++++++++++++++- install/thingsboard-install.sh | 3 ++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ct/thingsboard.sh b/ct/thingsboard.sh index 880990757..fc57cdd14 100644 --- a/ct/thingsboard.sh +++ b/ct/thingsboard.sh @@ -31,12 +31,30 @@ function update_script() { fi JAVA_VERSION="25" setup_java + + if ! grep -q "install.data_dir" /etc/thingsboard/conf/thingsboard.conf; then + msg_info "Restoring Package Defaults" + cat <<'EOF' >>/etc/thingsboard/conf/thingsboard.conf + +export JAVA_OPTS="$JAVA_OPTS -Dplatform=deb -Dinstall.data_dir=/usr/share/thingsboard/data" +export JAVA_OPTS="$JAVA_OPTS -Xlog:gc*,heap*,age*,safepoint=debug:file=/var/log/thingsboard/gc.log:time,uptime,level,tags:filecount=10,filesize=10M" +export JAVA_OPTS="$JAVA_OPTS -XX:+IgnoreUnrecognizedVMOptions -XX:+HeapDumpOnOutOfMemoryError" +export JAVA_OPTS="$JAVA_OPTS -XX:-UseBiasedLocking -XX:+UseTLAB -XX:+ResizeTLAB -XX:+PerfDisableSharedMem -XX:+UseCondCardMark" +export JAVA_OPTS="$JAVA_OPTS -XX:+UseG1GC -XX:MaxGCPauseMillis=500 -XX:+UseStringDeduplication -XX:+ParallelRefProcEnabled -XX:MaxTenuringThreshold=10" +export LOG_FILENAME=thingsboard.out +export LOADER_PATH=/usr/share/thingsboard/conf,/usr/share/thingsboard/extensions +export SQL_DATA_FOLDER=/usr/share/thingsboard/data/sql +EOF + systemctl restart thingsboard + msg_ok "Restored Package Defaults" + fi + if check_for_gh_release "thingsboard" "thingsboard/thingsboard"; then msg_info "Stopping Service" systemctl stop thingsboard msg_ok "Stopped Service" - fetch_and_deploy_gh_release "thingsboard" "thingsboard/thingsboard" "binary" "latest" "/tmp" "thingsboard-*.deb" + DPKG_FORCE_CONFOLD=1 fetch_and_deploy_gh_release "thingsboard" "thingsboard/thingsboard" "binary" "latest" "/tmp" "thingsboard-*.deb" msg_info "Running Database Upgrade" $STD /usr/share/thingsboard/bin/install/upgrade.sh diff --git a/install/thingsboard-install.sh b/install/thingsboard-install.sh index ad4536617..714ffff60 100644 --- a/install/thingsboard-install.sh +++ b/install/thingsboard-install.sh @@ -26,7 +26,8 @@ PG_DB_NAME="thingsboard_db" PG_DB_USER="thingsboard" setup_postgresql_db fetch_and_deploy_gh_release "thingsboard" "thingsboard/thingsboard" "binary" "latest" "/tmp" "thingsboard-*.deb" msg_info "Configuring ThingsBoard" -cat </etc/thingsboard/conf/thingsboard.conf +cat <>/etc/thingsboard/conf/thingsboard.conf + # DB Configuration export DATABASE_TS_TYPE=sql export SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/${PG_DB_NAME}