Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,4 @@ release:
pe_dart_client_ver: 4.0.0
broker_full_ver: 2.2.0
broker_branch: release-2.2.0
trendz_ver: 1.13.2
trendz_ver: 1.14.0
6 changes: 6 additions & 0 deletions _data/trendz/installation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ toc:
path: /docs/trendz/install/trndz-upgrade-instructions/
- title: Kubernetes
path: /docs/trendz/install/trndz-upgrade-instructions-kubernetes/
- title: Python Executor Configuration
section:
- title: Windows
path: /docs/trendz/install/python-executor-configuration-windows/
- title: Linux or Mac OS
path: /docs/trendz/install/python-executor-configuration-linux/
- title: Connect Trendz to Thingsboard
path: /docs/trendz/connect-thingsboard/
- title: Configuration properties
Expand Down
12 changes: 9 additions & 3 deletions docs/trendz/install/docker-windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ services:
SPRING_DATASOURCE_USERNAME: postgres
SPRING_DATASOURCE_PASSWORD: postgres
SCRIPT_ENGINE_PROVIDER: DOCKER_CONTAINER
SCRIPT_ENGINE_DOCKER_PROVIDER_URL: mypyexecutor:8080
SCRIPT_ENGINE_DOCKER_PROVIDER_URL: mypyexecutor:8181
SCRIPT_ENGINE_TIMEOUT: 30000
volumes:
- mytrendz-data:/data
Expand All @@ -73,6 +73,8 @@ services:
THROTTLING_QUEUE_CAPACITY: 10
THROTTLING_THREAD_POOL_SIZE: 6
NETWORK_BUFFER_SIZE: 10485760
volumes:
- mytrendz-data/python-executor:/python-executor
postgres:
restart: always
image: "postgres:15"
Expand All @@ -88,6 +90,8 @@ volumes:
external: true
mytrendz-logs:
external: true
mytrendz-data-python-executor:
external: true
mytrendz-data-db:
external: true
```
Expand All @@ -106,7 +110,8 @@ Where:
- `thingsboard/trendz:{{ site.release.trendz_ver }}` - Trendz docker image
- `thingsboard/trendz-python-executor:{{ site.release.trendz_ver }}` - Trendz python script executor docker image
- `SCRIPT_ENGINE_RUNTIME_TIMEOUT` - Python script execution timeout

- `mytrendz-data/python-executor:/python-executor` - mounts the volume `mytrendz-data/python-executor` to Trendz Python Executor additional data directory

### Setup Docker volumes

Windows users should use docker managed volume for Trendz DataBase. Create docker volume (for ex. `mytrendz-data`) before
Expand All @@ -115,11 +120,12 @@ executing docker run command: Open “Docker Quickstart Terminal”. Execute the
```yml
docker volume create mytrendz-data
docker volume create mytrendz-data-db
docker volume create mytrendz-data-python-executor
docker volume create mytrendz-logs
```
{: .copy-code}

**NOTE**: replace directory ~/.mytrendz-data and ~/.mytrendz-logs with directories you’re planning to used in docker-compose.yml.
**NOTE**: replace directory mytrendz-data and mytrendz-logs with directories you’re planning to used in docker-compose.yml.

### Running service

Expand Down
68 changes: 9 additions & 59 deletions docs/trendz/install/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ services:
THROTTLING_QUEUE_CAPACITY: 10
THROTTLING_THREAD_POOL_SIZE: 6
NETWORK_BUFFER_SIZE: 5242880
volumes:
- ~/.mytrendz-data/python-executor:/python-executor
postgres:
restart: always
image: "postgres:15"
Expand All @@ -101,6 +103,7 @@ Where:
- `thingsboard/trendz:{{ site.release.trendz_ver }}` - Trendz docker image
- `thingsboard/trendz-python-executor:{{ site.release.trendz_ver }}` - Trendz python script executor docker image
- `SCRIPT_ENGINE_RUNTIME_TIMEOUT` - Python script execution timeout
- `~/.mytrendz-data/python-executor:/python-executor` - mounts the volume `~/.mytrendz-data/python-executor` to Trendz Python Executor additional data directory


Run following commands, before starting docker container(s), to create folders for storing data and logs.
Expand All @@ -109,6 +112,7 @@ To do this (to change user) **chown** command is used, and this command requires

```bash
mkdir -p ~/.mytrendz-data && sudo chown -R 799:799 ~/.mytrendz-data
mkdir -p ~/.mytrendz-data/python-executor && sudo chown -R 799:799 ~/.mytrendz-data/python-executor
mkdir -p ~/.mytrendz-logs && sudo chown -R 799:799 ~/.mytrendz-logs
```
{: .copy-code}
Expand All @@ -131,6 +135,7 @@ Trendz uses ThingsBoard as an authentication service. During first sign in Thing
to validate credentials.

## Post-installation steps

It is essential to follow these [instructions](/docs/trendz/post-installation-steps) to fully use all features, such as saving telemetry to ThingsBoard and adding Trendz views to dashboards.

## Detaching, stop and start commands
Expand All @@ -141,7 +146,7 @@ It is essential to follow these [instructions](/docs/trendz/post-installation-st

## Upgrade Trendz Service

Below is example on how to upgrade from 1.13.1 to {{ site.release.trendz_ver }}
Below is example on how to upgrade from 1.13.2 to {{ site.release.trendz_ver }}

* Create a dump of your database:

Expand All @@ -159,17 +164,17 @@ If you still rely on Docker Compose as docker-compose (with a hyphen) execute ne
* Set upgradeversion variable to your **previous** Trendz version.

```bash
docker compose exec mytrendz sh -c "echo '1.13.1' > /data/.upgradeversion"
docker compose exec mytrendz sh -c "echo '1.13.2' > /data/.upgradeversion"
```
{: .copy-code}

{% capture dockerComposeStandalone %}
If you still rely on Docker Compose as docker-compose (with a hyphen) execute next command:
<br>**docker-compose exec mytrendz sh -c "echo '1.13.1' > /data/.upgradeversion"**
<br>**docker-compose exec mytrendz sh -c "echo '1.13.2' > /data/.upgradeversion"**
{% endcapture %}
{% include templates/info-banner.md content=dockerComposeStandalone %}

* After this you need to update docker-compose.yml as in [Step 2](#docker-compose-setup) but with {{ site.release.trendz_ver }} instead of 1.13.1:
* After this you need to update docker-compose.yml as in [Step 2](#docker-compose-setup) but with {{ site.release.trendz_ver }} instead of 1.13.3:

* Restart Trendz container

Expand All @@ -188,61 +193,6 @@ If you still rely on Docker Compose as docker-compose (with a hyphen) here is th

To upgrade Trendz to the latest version those steps should be done **for each intermediate version**.

## Standalone Python executor service
You can use following docker compose file in case when you want to start Trendz python executor as a separate service.
It is useful when your Trendz service is installed in monolith mode, and you want to logically separate Trendz from service that executes Python scripts for prediction models.
Using same configuration you can scale Python executors independently of Trendz service.

Create docker compose file:

```text
sudo nano docker-compose.yml
```
{: .copy-code}

Add following configuration:

```yml
version: '3.0'
services:
mypyexecutor:
restart: always
image: "thingsboard/trendz-python-executor:{{ site.release.trendz_ver }}"
ports:
- "8181:8181"
environment:
SCRIPT_ENGINE_RUNTIME_TIMEOUT: 30000
EXECUTOR_MANAGER: 1
EXECUTOR_SCRIPT_ENGINE: 6
THROTTLING_QUEUE_CAPACITY: 10
THROTTLING_THREAD_POOL_SIZE: 6
NETWORK_BUFFER_SIZE: 10485760
```
{: .copy-code}

Where:

- `8080` - Python executor port for communication with Trendz service
- `--restart always` - automatically start Trendz in case of system reboot and restart in case of failure.
- `thingsboard/trendz-python-executor:{{ site.release.trendz_ver }}` - Trendz python script executor docker image
- `SCRIPT_ENGINE_RUNTIME_TIMEOUT` - Python script execution timeout

```text
docker compose up -d
docker compose logs -f mypyexecutor
```

* Final step is to tell Trendz service how to communicate with Python executor service. You can do that by changing following environment variables in `/usr/share/trendz/conf/trendz.conf` file:

```bash
export SCRIPT_ENGINE_TIMEOUT=30000
export SCRIPT_ENGINE_PROVIDER=DOCKER_CONTAINER
export SCRIPT_ENGINE_DOCKER_PROVIDER_URL=PYTHON_EXECUTOR_HOST:PYTHON_EXECUTOR_PORT
```
{: .copy-code}

Note: you need to replace `PYTHON_EXECUTOR_HOST` and `PYTHON_EXECUTOR_PORT` with actual values of your Python executor service and ensure that Trendz is able to send network traffic to that destination.

## Troubleshooting

### DNS issues
Expand Down
Loading