-
Notifications
You must be signed in to change notification settings - Fork 45
Trendz integration #84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
This reverts commit d3c627f.
# Conflicts: # .env
smatvienko-tb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! You can find my comments below:
| export JAVA_OPTS="$JAVA_OPTS -XX:+CMSEdenChunksRecordAlways -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly" | ||
|
|
||
| export JAVA_OPTS="$JAVA_OPTS -Xms512m -Xmx512m" | ||
| export JAVA_OPTS="$JAVA_OPTS -Xss1m" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I never saw such a small stack . are you really sure that is up and running ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed stack settigns from .conf file.
| export LOADER_PATH=/usr/share/python-executor/conf | ||
|
|
||
| export JAVA_OPTS="$JAVA_OPTS -Dplatform=deb" | ||
| export JAVA_OPTS="$JAVA_OPTS -Xlog:gc=debug:file=/var/log/python-executor/gc.log -XX:+IgnoreUnrecognizedVMOptions -XX:+PrintGCDateStamps" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you can drop all those tunings with such a small heap size.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kept simular tuning as ThingsBoard services
trendz/conf/logback.xml
Outdated
| <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | ||
| <encoder> | ||
| <Pattern> | ||
| %green(%d{yyyy-MM-dd} | %d{HH:mm:ss.SSS}) | %highlight(%-5level) [%cyan(%-40thread)] %-60yellow(%C{1}): %msg %n%throwable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please, stick to the ThingsBoard log format. It should be standard for log sinking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sticked to the ThingsBoard log format.
trendz/conf/logback.xml
Outdated
| </appender> | ||
|
|
||
| <logger name="org.thingsboard.trendz" level="INFO" /> | ||
| <logger name="org.thingsboard.trendz.service.task.TaskRuntimeService" level="DEBUG" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no debug in production!!! comment out all debug by default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented DEBUG logs
advanced/docker-compose.trendz.yml
Outdated
| - ../trendz-python-executor/data:/data | ||
| trendz-postgres: | ||
| restart: always | ||
| image: "postgres:16" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the latest is 17
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We set postgres 16, because this version used in docker-compose.postgres.yml. But we can use the latest version if that's necessary
basic/docker-compose.trendz.yml
Outdated
| - ../trendz-python-executor/conf:/python-executor-config-files | ||
| - ../trendz-python-executor/log:/var/log/python-executor | ||
| - ../trendz-python-executor/data:/data | ||
| trendz-postgres: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thingsboard postgresql is already deployed. Why we need a dedicated postgresql instance for Trendz. It might be enough to add another database within the same postgres. backups and restores might be easier. Isolation is fine for me, but as you even use a postgres/postgres credentials I consider your docker compose requires tuning before production
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced trendz-postgres with postgres service. Added trendz-db-init service to be able create Trendz database in the same postgres service as ThingsBoard database.
trendz/conf/trendz.conf
Outdated
| export JAVA_OPTS="$JAVA_OPTS -XX:+CMSEdenChunksRecordAlways -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly" | ||
|
|
||
| export JAVA_OPTS="$JAVA_OPTS -Xms2000m -Xmx2000m" | ||
| export JAVA_OPTS="$JAVA_OPTS -Xss1m" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1m for stack for reactive Java Trendz ? Are you really run the app with this settings or it appears only in this PR at first time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed all memory settings from .conf file
trendz/conf/trendz.conf
Outdated
| export JAVA_OPTS="$JAVA_OPTS -Xss1m" | ||
| export JAVA_OPTS="$JAVA_OPTS -XX:MaxMetaspaceSize=256m" | ||
| export JAVA_OPTS="$JAVA_OPTS -XX:MaxDirectMemorySize=256m" | ||
| export JAVA_OPTS="$JAVA_OPTS -XX:+HeapDumpOnOutOfMemoryError" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no location specified
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specified folders for heap dump
trendz/conf/trendz.conf
Outdated
| export JAVA_OPTS="$JAVA_OPTS -Dplatform=deb -Dinstall.data_dir=/usr/share/trendz/data" | ||
| export JAVA_OPTS="$JAVA_OPTS -Xlog:gc=debug:file=/var/log/trendz/gc.log -XX:+IgnoreUnrecognizedVMOptions -XX:+PrintGCDateStamps" | ||
| export JAVA_OPTS="$JAVA_OPTS -XX:+PrintHeapAtGC -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10" | ||
| export JAVA_OPTS="$JAVA_OPTS -XX:GCLogFileSize=10M -XX:-UseBiasedLocking -XX:+UseTLAB -XX:+ResizeTLAB -XX:+PerfDisableSharedMem -XX:+UseCondCardMark" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UseBiasedLocking are likely deprecated /removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed UseBiasedLocking from .conf files
.env
Outdated
| EDQS_ENABLED=false | ||
|
|
||
| TB_VERSION=4.2.1.1PE | ||
| TRENDZ_VERSION=1.14.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the version is not the latest, please, update if required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to 1.15.0.2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR integrates Trendz Analytics as an optional add-on to the ThingsBoard deployment system. Trendz is a data analytics platform that works alongside ThingsBoard, consisting of two services: the main Trendz application and a Python executor for script execution.
Changes:
- Added Trendz and Trendz Python Executor service configurations and Docker Compose files for all deployment types (basic, monolith, advanced)
- Integrated Trendz routing into HAProxy configurations across all deployments
- Updated all deployment management scripts to support conditional Trendz deployment via TRENDZ_ENABLED flag
- Added database initialization script and Docker Compose configuration for Trendz
Reviewed changes
Copilot reviewed 28 out of 29 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| trendz/conf/trendz.conf | Java runtime configuration for Trendz service |
| trendz/conf/logback.xml | Logging configuration for Trendz service |
| trendz.env | Environment variables for Trendz service |
| trendz-python-executor/conf/python-executor.conf | Java runtime configuration for Python executor |
| trendz-python-executor/conf/logback.xml | Logging configuration for Python executor |
| trendz-python-executor.env | Environment variables for Python executor |
| trendz-db-init.sh | Database initialization script for Trendz |
| tb-node.trendz.env | ThingsBoard configuration when Trendz is enabled |
| monolith/haproxy/config/haproxy.cfg | HAProxy routing rules for Trendz endpoints |
| monolith/docker-compose.trendz.yml | Docker Compose for Trendz in monolith deployment |
| monolith/docker-compose.trendz.db-init.yml | Database init for Trendz in monolith deployment |
| basic/haproxy/config/haproxy.cfg | HAProxy routing rules for Trendz in basic deployment |
| basic/docker-compose.trendz.yml | Docker Compose for Trendz in basic deployment |
| basic/docker-compose.trendz.db-init.yml | Database init for Trendz in basic deployment |
| advanced/haproxy/config/haproxy.cfg | HAProxy routing rules for Trendz in advanced deployment |
| advanced/docker-compose.trendz.yml | Docker Compose for Trendz in advanced deployment |
| advanced/docker-compose.trendz.volumes.yml | External volume configuration for Trendz |
| advanced/docker-compose.trendz.db-init.yml | Database init for Trendz in advanced deployment |
| docker-upgrade-trendz.sh | Script to upgrade Trendz service |
| docker-install-trendz.sh | Script to install and initialize Trendz |
| docker-upgrade-tb.sh | Updated to include Trendz compose args |
| docker-update-service.sh | Updated to include Trendz compose args |
| docker-stop-services.sh | Updated to include Trendz compose args |
| docker-start-services.sh | Updated to include Trendz compose args |
| docker-remove-services.sh | Updated to include Trendz compose args |
| docker-install-tb.sh | Updated to include Trendz compose args |
| compose-utils.sh | Added Trendz helper functions and permissions |
| .gitignore | Added Trendz and Python executor directories |
| .env | Added Trendz configuration variables |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| env_file: | ||
| - ../trendz-python-executor.env | ||
| volumes: | ||
| - ../trendz-python-executor/conf:/python-executor-config-files |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing log volume mount: the trendz-python-executor service is missing the log volume mount. This is inconsistent with the monolith deployment (monolith/docker-compose.trendz.yml:63) which includes '../trendz-python-executor/log:/var/log/python-executor'. This will cause logs to be written to the container's filesystem instead of the host.
| - ../trendz-python-executor/conf:/python-executor-config-files | |
| - ../trendz-python-executor/conf:/python-executor-config-files | |
| - ../trendz-python-executor/log:/var/log/python-executor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed /trendz-python-executor/log
|
|
||
| if [ "$TRENDZ_ENABLED" = true ]; then | ||
| PERMISSION_LIST="$PERMISSION_LIST | ||
| 799 799 trendz/log |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing permission entry for trendz-python-executor/log: The permission list includes 'trendz/log' but does not include 'trendz-python-executor/log'. Based on the docker-compose files that mount '../trendz-python-executor/log:/var/log/python-executor', this directory should also have permissions set. Consider adding '799 799 trendz-python-executor/log' to maintain consistency with other service log directories.
| 799 799 trendz/log | |
| 799 799 trendz/log | |
| 799 799 trendz-python-executor/log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed /trendz-python-executor/log
trendz.env
Outdated
| SCRIPT_ENGINE_DOCKER_PROVIDER_URL=trendz-python-executor:8181 | ||
| SCRIPT_ENGINE_TIMEOUT=30000 | ||
|
|
||
| TB_API_URL: http://haproxy:80 |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Environment variable syntax error: this line uses a colon instead of an equals sign. Environment variable assignments should use '=' not ':'. This should be 'TB_API_URL=http://haproxy:80'.
| TB_API_URL: http://haproxy:80 | |
| TB_API_URL=http://haproxy:80 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
trendz.env
Outdated
| @@ -0,0 +1,10 @@ | |||
| # Python executor service configuration | |||
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Misleading comment: The comment states "Python executor service configuration", but this file (trendz.env) contains configuration for the Trendz service itself, not just the Python executor. The comment should be updated to reflect that this is the main Trendz service configuration.
| # Python executor service configuration | |
| # Trendz service configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 28 out of 29 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
docker-upgrade-trendz.sh
Outdated
| # | ||
| # ThingsBoard, Inc. ("COMPANY") CONFIDENTIAL | ||
| # | ||
| # Copyright © 2016-2022 ThingsBoard, Inc. All Rights Reserved. |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The copyright year in docker-upgrade-trendz.sh is inconsistent with the newly added files. Other new Trendz files use "Copyright © 2016-2026" while this file uses "Copyright © 2016-2022". This should be updated to match the other new Trendz-related files for consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed license header
| - ../trendz/data:/data | ||
| depends_on: | ||
| - postgres | ||
| - tb-monolith |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The trendz service is configured with SCRIPT_ENGINE_DOCKER_PROVIDER_URL pointing to trendz-python-executor:8181, but trendz-python-executor is not listed in the depends_on section. For consistency with the rest of the codebase (e.g., tb-core depends on tb-js-executor), and to ensure proper startup ordering, consider adding trendz-python-executor to the depends_on list of the trendz service. This applies to all three deployment configurations (basic, monolith, and advanced).
| - tb-monolith | |
| - tb-monolith | |
| - trendz-python-executor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added to depends_on
| - ../trendz/data:/data | ||
| depends_on: | ||
| - postgres | ||
| - tb-monolith |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The trendz service is configured with SCRIPT_ENGINE_DOCKER_PROVIDER_URL pointing to trendz-python-executor:8181, but trendz-python-executor is not listed in the depends_on section. For consistency with the rest of the codebase (e.g., tb-core depends on tb-js-executor), and to ensure proper startup ordering, consider adding trendz-python-executor to the depends_on list of the trendz service. This applies to all three deployment configurations (basic, monolith, and advanced).
| - tb-monolith | |
| - tb-monolith | |
| - trendz-python-executor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added to depends_on
| depends_on: | ||
| - postgres | ||
| - tb-core1 | ||
| - tb-core2 |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The trendz service is configured with SCRIPT_ENGINE_DOCKER_PROVIDER_URL pointing to trendz-python-executor:8181, but trendz-python-executor is not listed in the depends_on section. For consistency with the rest of the codebase (e.g., tb-core depends on tb-js-executor), and to ensure proper startup ordering, consider adding trendz-python-executor to the depends_on list of the trendz service. This applies to all three deployment configurations (basic, monolith, and advanced).
| - tb-core2 | |
| - tb-core2 | |
| - trendz-python-executor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added to depends_on
🔍 Vulnerabilities of
|
| digest | sha256:39a3a32d087a998632ccef6d834da587e10a24f9072a258551cc34c3e9ceae1b |
| vulnerabilities | |
| platform | linux/arm64 |
| size | 674 MB |
| packages | 419 |
Description
Description
|
This code chages allow to run Trendz in the same docker compose cluster as ThingsBoard.
To enable Trendz, it's necessary:
Trendz Database will be created.