Commit 087d5f829343b18fc325c3c942e2076d7aebefd1

Authored by Igor Kulikov
1 parent 17067442

Kubernetes resources for ThingsBoard Microservices.

  1 +
  2 +# Database used by ThingsBoard, can be either postgres (PostgreSQL) or cassandra (Cassandra).
  3 +# According to the database type corresponding kubernetes resources will be deployed (see postgres.yml, cassandra.yml for details).
  4 +
  5 +DATABASE=postgres
  1 +# Kubernetes resources configuration for ThingsBoard Microservices
  2 +
  3 +This folder containing scripts and Kubernetes resources configurations to run ThingsBoard in Microservices mode.
  4 +
  5 +## Prerequisites
  6 +
  7 +ThingsBoard Microservices are running on Kubernetes cluster.
  8 +You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster.
  9 +If you do not already have a cluster, you can create one by using [Minikube](https://kubernetes.io/docs/setup/minikube),
  10 +or you can choose any other available [Kubernetes cluster deployment solutions](https://kubernetes.io/docs/setup/pick-right-solution/).
  11 +
  12 +## Installation
  13 +
  14 +Before performing initial installation you can configure the type of database to be used with ThingsBoard.
  15 +In order to set database type change the value of `DATABASE` variable in `.env` file to one of the following:
  16 +
  17 +- `postgres` - use PostgreSQL database;
  18 +- `cassandra` - use Cassandra database;
  19 +
  20 +**NOTE**: According to the database type corresponding kubernetes resources will be deployed (see `postgres.yml`, `cassandra.yml` for details).
  21 +
  22 +Execute the following command to run installation:
  23 +
  24 +`
  25 +$ ./k8s-install-tb.sh --loadDemo
  26 +`
  27 +
  28 +Where:
  29 +
  30 +- `--loadDemo` - optional argument. Whether to load additional demo data.
  31 +
  32 +## Running
  33 +
  34 +Execute the following command to deploy resources:
  35 +
  36 +`
  37 +$ ./k8s-deploy-resources.sh
  38 +`
  39 +
  40 +After a while when all resources will be successfully started you can open `http://{your-cluster-ip}` in you browser (for ex. `http://192.168.99.101`).
  41 +You should see ThingsBoard login page.
  42 +
  43 +Use the following default credentials:
  44 +
  45 +- **System Administrator**: sysadmin@thingsboard.org / sysadmin
  46 +
  47 +If you installed DataBase with demo data (using `--loadDemo` flag) you can also use the following credentials:
  48 +
  49 +- **Tenant Administrator**: tenant@thingsboard.org / tenant
  50 +- **Customer User**: customer@thingsboard.org / customer
  51 +
  52 +In case of any issues you can examine service logs for errors.
  53 +For example to see ThingsBoard node logs execute the following commands:
  54 +
  55 +1) Get list of the running tb-node pods:
  56 +
  57 +`
  58 +$ kubectl get pods -l app=tb-node
  59 +`
  60 +
  61 +2) Fetch logs of tb-node pod:
  62 +
  63 +`
  64 +$ kubectl logs -f [tb-node-pod-name]
  65 +`
  66 +
  67 +Where:
  68 +
  69 +- `tb-node-pod-name` - tb-node pod name obtained from the list of the running tb-node pods.
  70 +
  71 +Or use `kubectl get pods` to see the state of all the pods.
  72 +Or use `kubectl get services` to see the state of all the services.
  73 +Or use `kubectl get deployments` to see the state of all the deployments.
  74 +See [kubectl Cheat Sheet](https://kubernetes.io/docs/reference/kubectl/cheatsheet/) command reference for details.
  75 +
  76 +Execute the following command to delete all deployed microservices:
  77 +
  78 +`
  79 +$ ./k8s-delete-resources.sh
  80 +`
  81 +
  82 +Execute the following command to delete all resources (including database):
  83 +
  84 +`
  85 +$ ./k8s-delete-all.sh
  86 +`
  87 +
  88 +## Upgrading
  89 +
  90 +In case when database upgrade is needed, execute the following commands:
  91 +
  92 +```
  93 +$ ./k8s-delete-resources.sh
  94 +$ ./k8s-upgrade-tb.sh --fromVersion=[FROM_VERSION]
  95 +$ ./k8s-deploy-resources.sh
  96 +```
  97 +
  98 +Where:
  99 +
  100 +- `FROM_VERSION` - from which version upgrade should be started. See [Upgrade Instructions](https://thingsboard.io/docs/user-guide/install/upgrade-instructions) for valid `fromVersion` values.
  1 +#
  2 +# Copyright © 2016-2019 The Thingsboard Authors
  3 +#
  4 +# Licensed under the Apache License, Version 2.0 (the "License");
  5 +# you may not use this file except in compliance with the License.
  6 +# You may obtain a copy of the License at
  7 +#
  8 +# http://www.apache.org/licenses/LICENSE-2.0
  9 +#
  10 +# Unless required by applicable law or agreed to in writing, software
  11 +# distributed under the License is distributed on an "AS IS" BASIS,
  12 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 +# See the License for the specific language governing permissions and
  14 +# limitations under the License.
  15 +#
  16 +
  17 +apiVersion: storage.k8s.io/v1
  18 +kind: StorageClass
  19 +metadata:
  20 + name: fast
  21 + namespace: thingsboard
  22 +provisioner: k8s.io/minikube-hostpath
  23 +parameters:
  24 + type: pd-ssd
  25 +---
  26 +apiVersion: v1
  27 +kind: ConfigMap
  28 +metadata:
  29 + name: cassandra-probe-config
  30 + namespace: thingsboard
  31 + labels:
  32 + name: cassandra-probe-config
  33 +data:
  34 + probe: |
  35 + if [[ $(nodetool status | grep $POD_IP) == *"UN"* ]]; then
  36 + if [[ $DEBUG ]]; then
  37 + echo "UN";
  38 + fi
  39 + exit 0;
  40 + else
  41 + if [[ $DEBUG ]]; then
  42 + echo "Not Up";
  43 + fi
  44 + exit 1;
  45 + fi
  46 +---
  47 +apiVersion: apps/v1
  48 +kind: StatefulSet
  49 +metadata:
  50 + name: cassandra
  51 + namespace: thingsboard
  52 + labels:
  53 + app: cassandra
  54 +spec:
  55 + serviceName: cassandra
  56 + replicas: 1
  57 + selector:
  58 + matchLabels:
  59 + app: cassandra
  60 + template:
  61 + metadata:
  62 + labels:
  63 + app: cassandra
  64 + spec:
  65 + volumes:
  66 + - name: cassandra-probe-config
  67 + configMap:
  68 + name: cassandra-probe-config
  69 + items:
  70 + - key: probe
  71 + path: ready-probe.sh
  72 + mode: 0777
  73 + terminationGracePeriodSeconds: 1800
  74 + containers:
  75 + - name: cassandra
  76 + image: cassandra:3.11.3
  77 + imagePullPolicy: Always
  78 + ports:
  79 + - containerPort: 7000
  80 + name: intra-node
  81 + - containerPort: 7001
  82 + name: tls-intra-node
  83 + - containerPort: 7199
  84 + name: jmx
  85 + - containerPort: 9042
  86 + name: cql
  87 + - containerPort: 9160
  88 + name: thrift
  89 + resources:
  90 + limits:
  91 + cpu: "1000m"
  92 + memory: 2Gi
  93 + requests:
  94 + cpu: "1000m"
  95 + memory: 2Gi
  96 + securityContext:
  97 + capabilities:
  98 + add:
  99 + - IPC_LOCK
  100 + lifecycle:
  101 + preStop:
  102 + exec:
  103 + command:
  104 + - /bin/sh
  105 + - -c
  106 + - nodetool drain
  107 + env:
  108 + - name: CASSANDRA_SEEDS
  109 + value: "cassandra-0.cassandra.thingsboard.svc.cluster.local"
  110 + - name: MAX_HEAP_SIZE
  111 + value: 1024M
  112 + - name: HEAP_NEWSIZE
  113 + value: 256M
  114 + - name: CASSANDRA_CLUSTER_NAME
  115 + value: "Thingsboard Cluster"
  116 + - name: CASSANDRA_DC
  117 + value: "DC1-Thingsboard-Cluster"
  118 + - name: CASSANDRA_RACK
  119 + value: "Rack-Thingsboard-Cluster"
  120 + - name: CASSANDRA_AUTO_BOOTSTRAP
  121 + value: "false"
  122 + - name: CASSANDRA_ENDPOINT_SNITCH
  123 + value: GossipingPropertyFileSnitch
  124 + - name: POD_IP
  125 + valueFrom:
  126 + fieldRef:
  127 + fieldPath: status.podIP
  128 + readinessProbe:
  129 + exec:
  130 + command:
  131 + - /bin/bash
  132 + - -c
  133 + - /probe/ready-probe.sh
  134 + initialDelaySeconds: 60
  135 + timeoutSeconds: 5
  136 + volumeMounts:
  137 + - name: cassandra-probe-config
  138 + mountPath: /probe
  139 + - name: cassandra-data
  140 + mountPath: /var/lib/cassandra
  141 + volumeClaimTemplates:
  142 + - metadata:
  143 + name: cassandra-data
  144 + spec:
  145 + accessModes: [ "ReadWriteOnce" ]
  146 + storageClassName: fast
  147 + resources:
  148 + requests:
  149 + storage: 1Gi
  150 +---
  151 +apiVersion: v1
  152 +kind: Service
  153 +metadata:
  154 + labels:
  155 + app: cassandra
  156 + name: cassandra
  157 + namespace: thingsboard
  158 +spec:
  159 + clusterIP: None
  160 + ports:
  161 + - port: 9042
  162 + selector:
  163 + app: cassandra
  164 +---
  1 +#
  2 +# Copyright © 2016-2019 The Thingsboard Authors
  3 +#
  4 +# Licensed under the Apache License, Version 2.0 (the "License");
  5 +# you may not use this file except in compliance with the License.
  6 +# You may obtain a copy of the License at
  7 +#
  8 +# http://www.apache.org/licenses/LICENSE-2.0
  9 +#
  10 +# Unless required by applicable law or agreed to in writing, software
  11 +# distributed under the License is distributed on an "AS IS" BASIS,
  12 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 +# See the License for the specific language governing permissions and
  14 +# limitations under the License.
  15 +#
  16 +
  17 +apiVersion: v1
  18 +kind: Pod
  19 +metadata:
  20 + name: tb-db-setup
  21 + namespace: thingsboard
  22 +spec:
  23 + volumes:
  24 + - name: tb-node-config
  25 + configMap:
  26 + name: tb-node-config
  27 + items:
  28 + - key: conf
  29 + path: thingsboard.conf
  30 + - key: logback
  31 + path: logback.xml
  32 + containers:
  33 + - name: tb-db-setup
  34 + imagePullPolicy: Always
  35 + image: thingsboard/tb-node:latest
  36 + envFrom:
  37 + - configMapRef:
  38 + name: tb-node-db-config
  39 + volumeMounts:
  40 + - mountPath: /config
  41 + name: tb-node-config
  42 + command: ['sh', '-c', 'while [ ! -f /install-finished ]; do sleep 2; done;']
  43 + restartPolicy: Never
  1 +#!/bin/bash
  2 +#
  3 +# Copyright © 2016-2019 The Thingsboard Authors
  4 +#
  5 +# Licensed under the Apache License, Version 2.0 (the "License");
  6 +# you may not use this file except in compliance with the License.
  7 +# You may obtain a copy of the License at
  8 +#
  9 +# http://www.apache.org/licenses/LICENSE-2.0
  10 +#
  11 +# Unless required by applicable law or agreed to in writing, software
  12 +# distributed under the License is distributed on an "AS IS" BASIS,
  13 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14 +# See the License for the specific language governing permissions and
  15 +# limitations under the License.
  16 +#
  17 +
  18 +kubectl -n thingsboard delete svc,sts,deploy,pv,pvc,cm,po,ing --all --include-uninitialized
  1 +#!/bin/bash
  2 +#
  3 +# Copyright © 2016-2019 The Thingsboard Authors
  4 +#
  5 +# Licensed under the Apache License, Version 2.0 (the "License");
  6 +# you may not use this file except in compliance with the License.
  7 +# You may obtain a copy of the License at
  8 +#
  9 +# http://www.apache.org/licenses/LICENSE-2.0
  10 +#
  11 +# Unless required by applicable law or agreed to in writing, software
  12 +# distributed under the License is distributed on an "AS IS" BASIS,
  13 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14 +# See the License for the specific language governing permissions and
  15 +# limitations under the License.
  16 +#
  17 +
  18 +set -e
  19 +
  20 +kubectl config set-context $(kubectl config current-context) --namespace=thingsboard
  21 +kubectl delete -f thingsboard.yml
  1 +#!/bin/bash
  2 +#
  3 +# Copyright © 2016-2019 The Thingsboard Authors
  4 +#
  5 +# Licensed under the Apache License, Version 2.0 (the "License");
  6 +# you may not use this file except in compliance with the License.
  7 +# You may obtain a copy of the License at
  8 +#
  9 +# http://www.apache.org/licenses/LICENSE-2.0
  10 +#
  11 +# Unless required by applicable law or agreed to in writing, software
  12 +# distributed under the License is distributed on an "AS IS" BASIS,
  13 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14 +# See the License for the specific language governing permissions and
  15 +# limitations under the License.
  16 +#
  17 +
  18 +set -e
  19 +
  20 +kubectl apply -f tb-namespace.yml
  21 +kubectl config set-context $(kubectl config current-context) --namespace=thingsboard
  22 +kubectl apply -f tb-node-configmap.yml
  23 +kubectl apply -f tb-mqtt-transport-configmap.yml
  24 +kubectl apply -f tb-http-transport-configmap.yml
  25 +kubectl apply -f tb-coap-transport-configmap.yml
  26 +kubectl apply -f thingsboard.yml
  1 +#!/bin/bash
  2 +#
  3 +# Copyright © 2016-2019 The Thingsboard Authors
  4 +#
  5 +# Licensed under the Apache License, Version 2.0 (the "License");
  6 +# you may not use this file except in compliance with the License.
  7 +# You may obtain a copy of the License at
  8 +#
  9 +# http://www.apache.org/licenses/LICENSE-2.0
  10 +#
  11 +# Unless required by applicable law or agreed to in writing, software
  12 +# distributed under the License is distributed on an "AS IS" BASIS,
  13 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14 +# See the License for the specific language governing permissions and
  15 +# limitations under the License.
  16 +#
  17 +
  18 +function installTb() {
  19 +
  20 + loadDemo=$1
  21 +
  22 + kubectl apply -f tb-node-configmap.yml
  23 + kubectl apply -f database-setup.yml &&
  24 + kubectl wait --for=condition=Ready pod/tb-db-setup --timeout=120s &&
  25 + kubectl exec tb-db-setup -- sh -c 'export INSTALL_TB=true; export LOAD_DEMO='"$loadDemo"'; start-tb-node.sh; touch /install-finished;'
  26 +
  27 + kubectl delete pod tb-db-setup
  28 +
  29 +}
  30 +
  31 +function installPostgres() {
  32 +
  33 + kubectl apply -f postgres.yml
  34 + kubectl apply -f tb-node-postgres-configmap.yml
  35 +
  36 + kubectl rollout status deployment/postgres
  37 +}
  38 +
  39 +function installCassandra() {
  40 +
  41 + kubectl apply -f cassandra.yml
  42 + kubectl apply -f tb-node-cassandra-configmap.yml
  43 +
  44 + kubectl rollout status statefulset/cassandra
  45 +
  46 + kubectl exec -it cassandra-0 -- bash -c "cqlsh -e \
  47 + \"CREATE KEYSPACE IF NOT EXISTS thingsboard \
  48 + WITH replication = { \
  49 + 'class' : 'SimpleStrategy', \
  50 + 'replication_factor' : 1 \
  51 + };\""
  52 +}
  53 +
  54 +while [[ $# -gt 0 ]]
  55 +do
  56 +key="$1"
  57 +
  58 +case $key in
  59 + --loadDemo)
  60 + LOAD_DEMO=true
  61 + shift # past argument
  62 + ;;
  63 + *)
  64 + # unknown option
  65 + ;;
  66 +esac
  67 +shift # past argument or value
  68 +done
  69 +
  70 +if [ "$LOAD_DEMO" == "true" ]; then
  71 + loadDemo=true
  72 +else
  73 + loadDemo=false
  74 +fi
  75 +
  76 +source .env
  77 +
  78 +kubectl apply -f tb-namespace.yml
  79 +kubectl config set-context $(kubectl config current-context) --namespace=thingsboard
  80 +
  81 +case $DATABASE in
  82 + postgres)
  83 + installPostgres
  84 + installTb ${loadDemo}
  85 + ;;
  86 + cassandra)
  87 + installCassandra
  88 + installTb ${loadDemo}
  89 + ;;
  90 + *)
  91 + echo "Unknown DATABASE value specified: '${DATABASE}'. Should be either postgres or cassandra." >&2
  92 + exit 1
  93 +esac
  1 +#!/bin/bash
  2 +#
  3 +# Copyright © 2016-2019 The Thingsboard Authors
  4 +#
  5 +# Licensed under the Apache License, Version 2.0 (the "License");
  6 +# you may not use this file except in compliance with the License.
  7 +# You may obtain a copy of the License at
  8 +#
  9 +# http://www.apache.org/licenses/LICENSE-2.0
  10 +#
  11 +# Unless required by applicable law or agreed to in writing, software
  12 +# distributed under the License is distributed on an "AS IS" BASIS,
  13 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14 +# See the License for the specific language governing permissions and
  15 +# limitations under the License.
  16 +#
  17 +
  18 +for i in "$@"
  19 +do
  20 +case $i in
  21 + --fromVersion=*)
  22 + FROM_VERSION="${i#*=}"
  23 + shift
  24 + ;;
  25 + *)
  26 + # unknown option
  27 + ;;
  28 +esac
  29 +done
  30 +
  31 +if [[ -z "${FROM_VERSION// }" ]]; then
  32 + echo "--fromVersion parameter is invalid or unspecified!"
  33 + echo "Usage: k8s-upgrade-tb.sh --fromVersion={VERSION}"
  34 + exit 1
  35 +else
  36 + fromVersion="${FROM_VERSION// }"
  37 +fi
  38 +
  39 +kubectl apply -f database-setup.yml &&
  40 +kubectl wait --for=condition=Ready pod/tb-db-setup --timeout=120s &&
  41 +kubectl exec tb-db-setup -- sh -c 'export UPGRADE_TB=true; export FROM_VERSION='"$fromVersion"'; start-tb-node.sh; touch /install-finished;'
  42 +
  43 +kubectl delete pod tb-db-setup
  1 +#
  2 +# Copyright © 2016-2019 The Thingsboard Authors
  3 +#
  4 +# Licensed under the Apache License, Version 2.0 (the "License");
  5 +# you may not use this file except in compliance with the License.
  6 +# You may obtain a copy of the License at
  7 +#
  8 +# http://www.apache.org/licenses/LICENSE-2.0
  9 +#
  10 +# Unless required by applicable law or agreed to in writing, software
  11 +# distributed under the License is distributed on an "AS IS" BASIS,
  12 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 +# See the License for the specific language governing permissions and
  14 +# limitations under the License.
  15 +#
  16 +
  17 +apiVersion: v1
  18 +kind: PersistentVolumeClaim
  19 +metadata:
  20 + name: postgres-pv-claim
  21 + namespace: thingsboard
  22 + labels:
  23 + app: postgres
  24 +spec:
  25 + accessModes:
  26 + - ReadWriteOnce
  27 + resources:
  28 + requests:
  29 + storage: 5Gi
  30 +---
  31 +apiVersion: extensions/v1beta1
  32 +kind: Deployment
  33 +metadata:
  34 + name: postgres
  35 + namespace: thingsboard
  36 + labels:
  37 + app: postgres
  38 +spec:
  39 + template:
  40 + metadata:
  41 + labels:
  42 + app: postgres
  43 + spec:
  44 + volumes:
  45 + - name: postgres-data
  46 + persistentVolumeClaim:
  47 + claimName: postgres-pv-claim
  48 + containers:
  49 + - name: postgres
  50 + imagePullPolicy: Always
  51 + image: postgres:9.6
  52 + ports:
  53 + - containerPort: 5432
  54 + name: postgres
  55 + env:
  56 + - name: POSTGRES_DB
  57 + value: "thingsboard"
  58 + volumeMounts:
  59 + - mountPath: /var/lib/postgresql/data
  60 + name: postgres-data
  61 + livenessProbe:
  62 + exec:
  63 + command:
  64 + - pg_isready
  65 + - -h
  66 + - localhost
  67 + - -U
  68 + - postgres
  69 + initialDelaySeconds: 60
  70 + timeoutSeconds: 30
  71 + readinessProbe:
  72 + exec:
  73 + command:
  74 + - pg_isready
  75 + - -h
  76 + - localhost
  77 + - -U
  78 + - postgres
  79 + initialDelaySeconds: 5
  80 + timeoutSeconds: 1
  81 + restartPolicy: Always
  82 +---
  83 +apiVersion: v1
  84 +kind: Service
  85 +metadata:
  86 + name: tb-database
  87 + namespace: thingsboard
  88 +spec:
  89 + type: ClusterIP
  90 + selector:
  91 + app: postgres
  92 + ports:
  93 + - port: 5432
  94 + name: postgres
  95 +---
  1 +#
  2 +# Copyright © 2016-2019 The Thingsboard Authors
  3 +#
  4 +# Licensed under the Apache License, Version 2.0 (the "License");
  5 +# you may not use this file except in compliance with the License.
  6 +# You may obtain a copy of the License at
  7 +#
  8 +# http://www.apache.org/licenses/LICENSE-2.0
  9 +#
  10 +# Unless required by applicable law or agreed to in writing, software
  11 +# distributed under the License is distributed on an "AS IS" BASIS,
  12 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 +# See the License for the specific language governing permissions and
  14 +# limitations under the License.
  15 +#
  16 +
  17 +apiVersion: v1
  18 +kind: ConfigMap
  19 +metadata:
  20 + name: tb-coap-transport-config
  21 + namespace: thingsboard
  22 + labels:
  23 + name: tb-coap-transport-config
  24 +data:
  25 + conf: |
  26 + export JAVA_OPTS="$JAVA_OPTS -Xloggc:/var/log/tb-coap-transport/${TB_HOST}/gc.log -XX:+IgnoreUnrecognizedVMOptions -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/tb-coap-transport/${TB_HOST}/heapdump.bin -XX:+PrintGCDetails -XX:+PrintGCDateStamps"
  27 + export JAVA_OPTS="$JAVA_OPTS -XX:+PrintHeapAtGC -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10"
  28 + export JAVA_OPTS="$JAVA_OPTS -XX:GCLogFileSize=10M -XX:-UseBiasedLocking -XX:+UseTLAB -XX:+ResizeTLAB -XX:+PerfDisableSharedMem -XX:+UseCondCardMark"
  29 + export JAVA_OPTS="$JAVA_OPTS -XX:CMSWaitDuration=10000 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+CMSParallelInitialMarkEnabled"
  30 + export JAVA_OPTS="$JAVA_OPTS -XX:+CMSEdenChunksRecordAlways -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+ExitOnOutOfMemoryError"
  31 + export LOG_FILENAME=tb-coap-transport.out
  32 + export LOADER_PATH=/usr/share/tb-coap-transport/conf
  33 + logback: |
  34 + <!DOCTYPE configuration>
  35 + <configuration scan="true" scanPeriod="10 seconds">
  36 +
  37 + <appender name="fileLogAppender"
  38 + class="ch.qos.logback.core.rolling.RollingFileAppender">
  39 + <file>/var/log/tb-coap-transport/${TB_HOST}/tb-coap-transport.log</file>
  40 + <rollingPolicy
  41 + class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
  42 + <fileNamePattern>/var/log/tb-coap-transport/${TB_HOST}/tb-coap-transport.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
  43 + <maxFileSize>100MB</maxFileSize>
  44 + <maxHistory>30</maxHistory>
  45 + <totalSizeCap>3GB</totalSizeCap>
  46 + </rollingPolicy>
  47 + <encoder>
  48 + <pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern>
  49 + </encoder>
  50 + </appender>
  51 +
  52 + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
  53 + <encoder>
  54 + <pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern>
  55 + </encoder>
  56 + </appender>
  57 +
  58 + <logger name="org.thingsboard.server" level="INFO" />
  59 +
  60 + <root level="INFO">
  61 + <appender-ref ref="fileLogAppender"/>
  62 + <appender-ref ref="STDOUT"/>
  63 + </root>
  64 +
  65 + </configuration>
  1 +#
  2 +# Copyright © 2016-2019 The Thingsboard Authors
  3 +#
  4 +# Licensed under the Apache License, Version 2.0 (the "License");
  5 +# you may not use this file except in compliance with the License.
  6 +# You may obtain a copy of the License at
  7 +#
  8 +# http://www.apache.org/licenses/LICENSE-2.0
  9 +#
  10 +# Unless required by applicable law or agreed to in writing, software
  11 +# distributed under the License is distributed on an "AS IS" BASIS,
  12 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 +# See the License for the specific language governing permissions and
  14 +# limitations under the License.
  15 +#
  16 +
  17 +apiVersion: v1
  18 +kind: ConfigMap
  19 +metadata:
  20 + name: tb-http-transport-config
  21 + namespace: thingsboard
  22 + labels:
  23 + name: tb-http-transport-config
  24 +data:
  25 + conf: |
  26 + export JAVA_OPTS="$JAVA_OPTS -Xloggc:/var/log/tb-http-transport/${TB_HOST}/gc.log -XX:+IgnoreUnrecognizedVMOptions -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/tb-http-transport/${TB_HOST}/heapdump.bin -XX:+PrintGCDetails -XX:+PrintGCDateStamps"
  27 + export JAVA_OPTS="$JAVA_OPTS -XX:+PrintHeapAtGC -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10"
  28 + export JAVA_OPTS="$JAVA_OPTS -XX:GCLogFileSize=10M -XX:-UseBiasedLocking -XX:+UseTLAB -XX:+ResizeTLAB -XX:+PerfDisableSharedMem -XX:+UseCondCardMark"
  29 + export JAVA_OPTS="$JAVA_OPTS -XX:CMSWaitDuration=10000 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+CMSParallelInitialMarkEnabled"
  30 + export JAVA_OPTS="$JAVA_OPTS -XX:+CMSEdenChunksRecordAlways -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+ExitOnOutOfMemoryError"
  31 + export LOG_FILENAME=tb-http-transport.out
  32 + export LOADER_PATH=/usr/share/tb-http-transport/conf
  33 + logback: |
  34 + <!DOCTYPE configuration>
  35 + <configuration scan="true" scanPeriod="10 seconds">
  36 +
  37 + <appender name="fileLogAppender"
  38 + class="ch.qos.logback.core.rolling.RollingFileAppender">
  39 + <file>/var/log/tb-http-transport/${TB_HOST}/tb-http-transport.log</file>
  40 + <rollingPolicy
  41 + class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
  42 + <fileNamePattern>/var/log/tb-http-transport/${TB_HOST}/tb-http-transport.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
  43 + <maxFileSize>100MB</maxFileSize>
  44 + <maxHistory>30</maxHistory>
  45 + <totalSizeCap>3GB</totalSizeCap>
  46 + </rollingPolicy>
  47 + <encoder>
  48 + <pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern>
  49 + </encoder>
  50 + </appender>
  51 +
  52 + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
  53 + <encoder>
  54 + <pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern>
  55 + </encoder>
  56 + </appender>
  57 +
  58 + <logger name="org.thingsboard.server" level="INFO" />
  59 +
  60 + <root level="INFO">
  61 + <appender-ref ref="fileLogAppender"/>
  62 + <appender-ref ref="STDOUT"/>
  63 + </root>
  64 +
  65 + </configuration>
  1 +#
  2 +# Copyright © 2016-2019 The Thingsboard Authors
  3 +#
  4 +# Licensed under the Apache License, Version 2.0 (the "License");
  5 +# you may not use this file except in compliance with the License.
  6 +# You may obtain a copy of the License at
  7 +#
  8 +# http://www.apache.org/licenses/LICENSE-2.0
  9 +#
  10 +# Unless required by applicable law or agreed to in writing, software
  11 +# distributed under the License is distributed on an "AS IS" BASIS,
  12 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 +# See the License for the specific language governing permissions and
  14 +# limitations under the License.
  15 +#
  16 +
  17 +apiVersion: v1
  18 +kind: ConfigMap
  19 +metadata:
  20 + name: tb-mqtt-transport-config
  21 + namespace: thingsboard
  22 + labels:
  23 + name: tb-mqtt-transport-config
  24 +data:
  25 + conf: |
  26 + export JAVA_OPTS="$JAVA_OPTS -Xloggc:/var/log/tb-mqtt-transport/${TB_HOST}/gc.log -XX:+IgnoreUnrecognizedVMOptions -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/tb-mqtt-transport/${TB_HOST}/heapdump.bin -XX:+PrintGCDetails -XX:+PrintGCDateStamps"
  27 + export JAVA_OPTS="$JAVA_OPTS -XX:+PrintHeapAtGC -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10"
  28 + export JAVA_OPTS="$JAVA_OPTS -XX:GCLogFileSize=10M -XX:-UseBiasedLocking -XX:+UseTLAB -XX:+ResizeTLAB -XX:+PerfDisableSharedMem -XX:+UseCondCardMark"
  29 + export JAVA_OPTS="$JAVA_OPTS -XX:CMSWaitDuration=10000 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+CMSParallelInitialMarkEnabled"
  30 + export JAVA_OPTS="$JAVA_OPTS -XX:+CMSEdenChunksRecordAlways -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+ExitOnOutOfMemoryError"
  31 + export LOG_FILENAME=tb-mqtt-transport.out
  32 + export LOADER_PATH=/usr/share/tb-mqtt-transport/conf
  33 + logback: |
  34 + <!DOCTYPE configuration>
  35 + <configuration scan="true" scanPeriod="10 seconds">
  36 +
  37 + <appender name="fileLogAppender"
  38 + class="ch.qos.logback.core.rolling.RollingFileAppender">
  39 + <file>/var/log/tb-mqtt-transport/${TB_HOST}/tb-mqtt-transport.log</file>
  40 + <rollingPolicy
  41 + class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
  42 + <fileNamePattern>/var/log/tb-mqtt-transport/${TB_HOST}/tb-mqtt-transport.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
  43 + <maxFileSize>100MB</maxFileSize>
  44 + <maxHistory>30</maxHistory>
  45 + <totalSizeCap>3GB</totalSizeCap>
  46 + </rollingPolicy>
  47 + <encoder>
  48 + <pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern>
  49 + </encoder>
  50 + </appender>
  51 +
  52 + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
  53 + <encoder>
  54 + <pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern>
  55 + </encoder>
  56 + </appender>
  57 +
  58 + <logger name="org.thingsboard.server" level="INFO" />
  59 +
  60 + <root level="INFO">
  61 + <appender-ref ref="fileLogAppender"/>
  62 + <appender-ref ref="STDOUT"/>
  63 + </root>
  64 +
  65 + </configuration>
  1 +#
  2 +# Copyright © 2016-2019 The Thingsboard Authors
  3 +#
  4 +# Licensed under the Apache License, Version 2.0 (the "License");
  5 +# you may not use this file except in compliance with the License.
  6 +# You may obtain a copy of the License at
  7 +#
  8 +# http://www.apache.org/licenses/LICENSE-2.0
  9 +#
  10 +# Unless required by applicable law or agreed to in writing, software
  11 +# distributed under the License is distributed on an "AS IS" BASIS,
  12 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 +# See the License for the specific language governing permissions and
  14 +# limitations under the License.
  15 +#
  16 +
  17 +apiVersion: v1
  18 +kind: Namespace
  19 +metadata:
  20 + name: thingsboard
  21 + labels:
  22 + name: thingsboard
  1 +#
  2 +# Copyright © 2016-2019 The Thingsboard Authors
  3 +#
  4 +# Licensed under the Apache License, Version 2.0 (the "License");
  5 +# you may not use this file except in compliance with the License.
  6 +# You may obtain a copy of the License at
  7 +#
  8 +# http://www.apache.org/licenses/LICENSE-2.0
  9 +#
  10 +# Unless required by applicable law or agreed to in writing, software
  11 +# distributed under the License is distributed on an "AS IS" BASIS,
  12 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 +# See the License for the specific language governing permissions and
  14 +# limitations under the License.
  15 +#
  16 +
  17 +apiVersion: v1
  18 +kind: ConfigMap
  19 +metadata:
  20 + name: tb-node-db-config
  21 + namespace: thingsboard
  22 + labels:
  23 + name: tb-node-db-config
  24 +data:
  25 + DATABASE_TS_TYPE: cassandra
  26 + DATABASE_ENTITIES_TYPE: cassandra
  27 + CASSANDRA_URL: cassandra:9042
  28 + CASSANDRA_SOCKET_READ_TIMEOUT: "60000"
  1 +#
  2 +# Copyright © 2016-2019 The Thingsboard Authors
  3 +#
  4 +# Licensed under the Apache License, Version 2.0 (the "License");
  5 +# you may not use this file except in compliance with the License.
  6 +# You may obtain a copy of the License at
  7 +#
  8 +# http://www.apache.org/licenses/LICENSE-2.0
  9 +#
  10 +# Unless required by applicable law or agreed to in writing, software
  11 +# distributed under the License is distributed on an "AS IS" BASIS,
  12 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 +# See the License for the specific language governing permissions and
  14 +# limitations under the License.
  15 +#
  16 +
  17 +apiVersion: v1
  18 +kind: ConfigMap
  19 +metadata:
  20 + name: tb-node-config
  21 + namespace: thingsboard
  22 + labels:
  23 + name: tb-node-config
  24 +data:
  25 + conf: |
  26 + export JAVA_OPTS="$JAVA_OPTS -Dplatform=deb -Dinstall.data_dir=/usr/share/thingsboard/data"
  27 + export JAVA_OPTS="$JAVA_OPTS -Xloggc:/var/log/thingsboard/${TB_HOST}/gc.log -XX:+IgnoreUnrecognizedVMOptions -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/thingsboard/${TB_HOST}/heapdump.bin -XX:+PrintGCDetails -XX:+PrintGCDateStamps"
  28 + export JAVA_OPTS="$JAVA_OPTS -XX:+PrintHeapAtGC -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10"
  29 + export JAVA_OPTS="$JAVA_OPTS -XX:GCLogFileSize=10M -XX:-UseBiasedLocking -XX:+UseTLAB -XX:+ResizeTLAB -XX:+PerfDisableSharedMem -XX:+UseCondCardMark"
  30 + export JAVA_OPTS="$JAVA_OPTS -XX:CMSWaitDuration=10000 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+CMSParallelInitialMarkEnabled"
  31 + export JAVA_OPTS="$JAVA_OPTS -XX:+CMSEdenChunksRecordAlways -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+ExitOnOutOfMemoryError"
  32 + export LOG_FILENAME=thingsboard.out
  33 + export LOADER_PATH=/usr/share/thingsboard/conf,/usr/share/thingsboard/extensions
  34 + logback: |
  35 + <!DOCTYPE configuration>
  36 + <configuration scan="true" scanPeriod="10 seconds">
  37 +
  38 + <appender name="fileLogAppender"
  39 + class="ch.qos.logback.core.rolling.RollingFileAppender">
  40 + <file>/var/log/thingsboard/${TB_HOST}/thingsboard.log</file>
  41 + <rollingPolicy
  42 + class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
  43 + <fileNamePattern>/var/log/thingsboard/${TB_HOST}/thingsboard.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
  44 + <maxFileSize>100MB</maxFileSize>
  45 + <maxHistory>30</maxHistory>
  46 + <totalSizeCap>3GB</totalSizeCap>
  47 + </rollingPolicy>
  48 + <encoder>
  49 + <pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern>
  50 + </encoder>
  51 + </appender>
  52 +
  53 + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
  54 + <encoder>
  55 + <pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern>
  56 + </encoder>
  57 + </appender>
  58 +
  59 + <logger name="org.thingsboard.server" level="INFO" />
  60 + <logger name="com.google.common.util.concurrent.AggregateFuture" level="OFF" />
  61 +
  62 + <root level="INFO">
  63 + <appender-ref ref="fileLogAppender"/>
  64 + <appender-ref ref="STDOUT"/>
  65 + </root>
  66 +
  67 + </configuration>
  1 +#
  2 +# Copyright © 2016-2019 The Thingsboard Authors
  3 +#
  4 +# Licensed under the Apache License, Version 2.0 (the "License");
  5 +# you may not use this file except in compliance with the License.
  6 +# You may obtain a copy of the License at
  7 +#
  8 +# http://www.apache.org/licenses/LICENSE-2.0
  9 +#
  10 +# Unless required by applicable law or agreed to in writing, software
  11 +# distributed under the License is distributed on an "AS IS" BASIS,
  12 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 +# See the License for the specific language governing permissions and
  14 +# limitations under the License.
  15 +#
  16 +
  17 +apiVersion: v1
  18 +kind: ConfigMap
  19 +metadata:
  20 + name: tb-node-db-config
  21 + namespace: thingsboard
  22 + labels:
  23 + name: tb-node-db-config
  24 +data:
  25 + DATABASE_TS_TYPE: sql
  26 + DATABASE_ENTITIES_TYPE: sql
  27 + SPRING_JPA_DATABASE_PLATFORM: org.hibernate.dialect.PostgreSQLDialect
  28 + SPRING_DRIVER_CLASS_NAME: org.postgresql.Driver
  29 + SPRING_DATASOURCE_URL: jdbc:postgresql://tb-database:5432/thingsboard
  30 + SPRING_DATASOURCE_USERNAME: postgres
  31 + SPRING_DATASOURCE_PASSWORD: postgres
  1 +#
  2 +# Copyright © 2016-2019 The Thingsboard Authors
  3 +#
  4 +# Licensed under the Apache License, Version 2.0 (the "License");
  5 +# you may not use this file except in compliance with the License.
  6 +# You may obtain a copy of the License at
  7 +#
  8 +# http://www.apache.org/licenses/LICENSE-2.0
  9 +#
  10 +# Unless required by applicable law or agreed to in writing, software
  11 +# distributed under the License is distributed on an "AS IS" BASIS,
  12 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 +# See the License for the specific language governing permissions and
  14 +# limitations under the License.
  15 +#
  16 +
  17 +apiVersion: extensions/v1beta1
  18 +kind: Deployment
  19 +metadata:
  20 + name: zookeeper
  21 + namespace: thingsboard
  22 +spec:
  23 + template:
  24 + metadata:
  25 + labels:
  26 + app: zookeeper
  27 + spec:
  28 + containers:
  29 + - name: server
  30 + imagePullPolicy: Always
  31 + image: zookeeper:3.5
  32 + ports:
  33 + - containerPort: 2181
  34 + readinessProbe:
  35 + periodSeconds: 5
  36 + tcpSocket:
  37 + port: 2181
  38 + livenessProbe:
  39 + periodSeconds: 5
  40 + tcpSocket:
  41 + port: 2181
  42 + env:
  43 + - name: ZOO_MY_ID
  44 + value: "1"
  45 + - name: ZOO_SERVERS
  46 + value: "server.1=0.0.0.0:2888:3888;0.0.0.0:2181"
  47 + restartPolicy: Always
  48 +---
  49 +apiVersion: v1
  50 +kind: Service
  51 +metadata:
  52 + name: zookeeper
  53 + namespace: thingsboard
  54 +spec:
  55 + type: ClusterIP
  56 + selector:
  57 + app: zookeeper
  58 + ports:
  59 + - name: zk-port
  60 + port: 2181
  61 +---
  62 +apiVersion: extensions/v1beta1
  63 +kind: Deployment
  64 +metadata:
  65 + name: tb-kafka
  66 + namespace: thingsboard
  67 +spec:
  68 + template:
  69 + metadata:
  70 + labels:
  71 + app: tb-kafka
  72 + spec:
  73 + containers:
  74 + - name: server
  75 + imagePullPolicy: Always
  76 + image: wurstmeister/kafka
  77 + ports:
  78 + - containerPort: 9092
  79 + readinessProbe:
  80 + periodSeconds: 20
  81 + tcpSocket:
  82 + port: 9092
  83 + livenessProbe:
  84 + periodSeconds: 5
  85 + tcpSocket:
  86 + port: 9092
  87 + env:
  88 + - name: KAFKA_ZOOKEEPER_CONNECT
  89 + value: "zookeeper:2181"
  90 + - name: KAFKA_LISTENERS
  91 + value: "INSIDE://:9093,OUTSIDE://:9092"
  92 + - name: KAFKA_ADVERTISED_LISTENERS
  93 + value: "INSIDE://:9093,OUTSIDE://tb-kafka:9092"
  94 + - name: KAFKA_LISTENER_SECURITY_PROTOCOL_MAP
  95 + value: "INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT"
  96 + - name: KAFKA_INTER_BROKER_LISTENER_NAME
  97 + value: "INSIDE"
  98 + - name: KAFKA_CREATE_TOPICS
  99 + value: "js.eval.requests:100:1:delete --config=retention.ms=60000 --config=segment.bytes=26214400 --config=retention.bytes=104857600,tb.transport.api.requests:30:1:delete --config=retention.ms=60000 --config=segment.bytes=26214400 --config=retention.bytes=104857600,tb.rule-engine:30:1:delete --config=retention.ms=60000 --config=segment.bytes=26214400 --config=retention.bytes=104857600"
  100 + - name: KAFKA_AUTO_CREATE_TOPICS_ENABLE
  101 + value: "false"
  102 + - name: KAFKA_LOG_RETENTION_BYTES
  103 + value: "1073741824"
  104 + - name: KAFKA_LOG_SEGMENT_BYTES
  105 + value: "268435456"
  106 + - name: KAFKA_LOG_RETENTION_MS
  107 + value: "300000"
  108 + - name: KAFKA_LOG_CLEANUP_POLICY
  109 + value: "delete"
  110 + restartPolicy: Always
  111 +---
  112 +apiVersion: v1
  113 +kind: Service
  114 +metadata:
  115 + name: tb-kafka
  116 + namespace: thingsboard
  117 +spec:
  118 + type: ClusterIP
  119 + selector:
  120 + app: tb-kafka
  121 + ports:
  122 + - name: tb-kafka-port
  123 + port: 9092
  124 +---
  125 +apiVersion: extensions/v1beta1
  126 +kind: Deployment
  127 +metadata:
  128 + name: tb-redis
  129 + namespace: thingsboard
  130 +spec:
  131 + template:
  132 + metadata:
  133 + labels:
  134 + app: tb-redis
  135 + spec:
  136 + containers:
  137 + - name: server
  138 + imagePullPolicy: Always
  139 + image: redis:4.0
  140 + ports:
  141 + - containerPort: 6379
  142 + readinessProbe:
  143 + periodSeconds: 5
  144 + tcpSocket:
  145 + port: 6379
  146 + livenessProbe:
  147 + periodSeconds: 5
  148 + tcpSocket:
  149 + port: 6379
  150 + volumeMounts:
  151 + - mountPath: /data
  152 + name: redis-data
  153 + volumes:
  154 + - name: redis-data
  155 + emptyDir: {}
  156 + restartPolicy: Always
  157 +---
  158 +apiVersion: v1
  159 +kind: Service
  160 +metadata:
  161 + name: tb-redis
  162 + namespace: thingsboard
  163 +spec:
  164 + type: ClusterIP
  165 + selector:
  166 + app: tb-redis
  167 + ports:
  168 + - name: tb-redis-port
  169 + port: 6379
  170 +---
  171 +apiVersion: extensions/v1beta1
  172 +kind: Deployment
  173 +metadata:
  174 + name: tb-js-executor
  175 + namespace: thingsboard
  176 +spec:
  177 + replicas: 20
  178 + selector:
  179 + matchLabels:
  180 + app: tb-js-executor
  181 + template:
  182 + metadata:
  183 + labels:
  184 + app: tb-js-executor
  185 + spec:
  186 + containers:
  187 + - name: server
  188 + imagePullPolicy: Always
  189 + image: thingsboard/tb-js-executor:latest
  190 + env:
  191 + - name: REMOTE_JS_EVAL_REQUEST_TOPIC
  192 + value: "js.eval.requests"
  193 + - name: TB_KAFKA_SERVERS
  194 + value: "tb-kafka:9092"
  195 + - name: LOGGER_LEVEL
  196 + value: "info"
  197 + - name: LOG_FOLDER
  198 + value: "logs"
  199 + - name: LOGGER_FILENAME
  200 + value: "tb-js-executor-%DATE%.log"
  201 + - name: DOCKER_MODE
  202 + value: "true"
  203 + - name: SCRIPT_BODY_TRACE_FREQUENCY
  204 + value: "1000"
  205 + restartPolicy: Always
  206 +---
  207 +apiVersion: extensions/v1beta1
  208 +kind: Deployment
  209 +metadata:
  210 + name: tb-node
  211 + namespace: thingsboard
  212 +spec:
  213 + replicas: 2
  214 + selector:
  215 + matchLabels:
  216 + app: tb-node
  217 + template:
  218 + metadata:
  219 + labels:
  220 + app: tb-node
  221 + spec:
  222 + volumes:
  223 + - name: tb-node-config
  224 + configMap:
  225 + name: tb-node-config
  226 + items:
  227 + - key: conf
  228 + path: thingsboard.conf
  229 + - key: logback
  230 + path: logback.xml
  231 + containers:
  232 + - name: server
  233 + imagePullPolicy: Always
  234 + image: thingsboard/tb-node:latest
  235 + ports:
  236 + - containerPort: 8080
  237 + name: http
  238 + - containerPort: 9001
  239 + name: rpc
  240 + env:
  241 + - name: RPC_HOST
  242 + valueFrom:
  243 + fieldRef:
  244 + fieldPath: status.podIP
  245 + - name: CLUSTER_NODE_ID
  246 + valueFrom:
  247 + fieldRef:
  248 + fieldPath: metadata.name
  249 + - name: TB_HOST
  250 + valueFrom:
  251 + fieldRef:
  252 + fieldPath: metadata.name
  253 + - name: ZOOKEEPER_ENABLED
  254 + value: "true"
  255 + - name: ZOOKEEPER_URL
  256 + value: "zookeeper:2181"
  257 + - name: TB_KAFKA_SERVERS
  258 + value: "tb-kafka:9092"
  259 + - name: JS_EVALUATOR
  260 + value: "remote"
  261 + - name: TRANSPORT_TYPE
  262 + value: "remote"
  263 + - name: CACHE_TYPE
  264 + value: "redis"
  265 + - name: REDIS_HOST
  266 + value: "tb-redis"
  267 + - name: HTTP_LOG_CONTROLLER_ERROR_STACK_TRACE
  268 + value: "false"
  269 + envFrom:
  270 + - configMapRef:
  271 + name: tb-node-db-config
  272 + volumeMounts:
  273 + - mountPath: /config
  274 + name: tb-node-config
  275 + livenessProbe:
  276 + httpGet:
  277 + path: /login
  278 + port: http
  279 + initialDelaySeconds: 120
  280 + timeoutSeconds: 10
  281 + restartPolicy: Always
  282 +---
  283 +apiVersion: v1
  284 +kind: Service
  285 +metadata:
  286 + name: tb-node
  287 + namespace: thingsboard
  288 +spec:
  289 + type: ClusterIP
  290 + selector:
  291 + app: tb-node
  292 + ports:
  293 + - port: 8080
  294 + name: http
  295 +---
  296 +apiVersion: extensions/v1beta1
  297 +kind: Deployment
  298 +metadata:
  299 + name: tb-mqtt-transport
  300 + namespace: thingsboard
  301 +spec:
  302 + replicas: 2
  303 + selector:
  304 + matchLabels:
  305 + app: tb-mqtt-transport
  306 + template:
  307 + metadata:
  308 + labels:
  309 + app: tb-mqtt-transport
  310 + spec:
  311 + volumes:
  312 + - name: tb-mqtt-transport-config
  313 + configMap:
  314 + name: tb-mqtt-transport-config
  315 + items:
  316 + - key: conf
  317 + path: tb-mqtt-transport.conf
  318 + - key: logback
  319 + path: logback.xml
  320 + containers:
  321 + - name: server
  322 + imagePullPolicy: Always
  323 + image: thingsboard/tb-mqtt-transport:latest
  324 + ports:
  325 + - containerPort: 1883
  326 + name: mqtt
  327 + env:
  328 + - name: CLUSTER_NODE_ID
  329 + valueFrom:
  330 + fieldRef:
  331 + fieldPath: metadata.name
  332 + - name: TB_HOST
  333 + valueFrom:
  334 + fieldRef:
  335 + fieldPath: metadata.name
  336 + - name: MQTT_BIND_ADDRESS
  337 + value: "0.0.0.0"
  338 + - name: MQTT_BIND_PORT
  339 + value: "1883"
  340 + - name: MQTT_TIMEOUT
  341 + value: "10000"
  342 + - name: TB_KAFKA_SERVERS
  343 + value: "tb-kafka:9092"
  344 + volumeMounts:
  345 + - mountPath: /config
  346 + name: tb-mqtt-transport-config
  347 + readinessProbe:
  348 + periodSeconds: 20
  349 + tcpSocket:
  350 + port: 1883
  351 + livenessProbe:
  352 + periodSeconds: 20
  353 + tcpSocket:
  354 + port: 1883
  355 + restartPolicy: Always
  356 +---
  357 +apiVersion: v1
  358 +kind: Service
  359 +metadata:
  360 + name: tb-mqtt-transport
  361 + namespace: thingsboard
  362 +spec:
  363 + type: LoadBalancer
  364 + selector:
  365 + app: tb-mqtt-transport
  366 + ports:
  367 + - port: 1883
  368 + targetPort: 1883
  369 + name: mqtt
  370 +---
  371 +apiVersion: extensions/v1beta1
  372 +kind: Deployment
  373 +metadata:
  374 + name: tb-http-transport
  375 + namespace: thingsboard
  376 +spec:
  377 + replicas: 2
  378 + selector:
  379 + matchLabels:
  380 + app: tb-http-transport
  381 + template:
  382 + metadata:
  383 + labels:
  384 + app: tb-http-transport
  385 + spec:
  386 + volumes:
  387 + - name: tb-http-transport-config
  388 + configMap:
  389 + name: tb-http-transport-config
  390 + items:
  391 + - key: conf
  392 + path: tb-http-transport.conf
  393 + - key: logback
  394 + path: logback.xml
  395 + containers:
  396 + - name: server
  397 + imagePullPolicy: Always
  398 + image: thingsboard/tb-http-transport:latest
  399 + ports:
  400 + - containerPort: 8080
  401 + name: http
  402 + env:
  403 + - name: CLUSTER_NODE_ID
  404 + valueFrom:
  405 + fieldRef:
  406 + fieldPath: metadata.name
  407 + - name: TB_HOST
  408 + valueFrom:
  409 + fieldRef:
  410 + fieldPath: metadata.name
  411 + - name: HTTP_BIND_ADDRESS
  412 + value: "0.0.0.0"
  413 + - name: HTTP_BIND_PORT
  414 + value: "8080"
  415 + - name: HTTP_REQUEST_TIMEOUT
  416 + value: "60000"
  417 + - name: TB_KAFKA_SERVERS
  418 + value: "tb-kafka:9092"
  419 + volumeMounts:
  420 + - mountPath: /config
  421 + name: tb-http-transport-config
  422 + readinessProbe:
  423 + periodSeconds: 20
  424 + tcpSocket:
  425 + port: 8080
  426 + livenessProbe:
  427 + periodSeconds: 20
  428 + tcpSocket:
  429 + port: 8080
  430 + restartPolicy: Always
  431 +---
  432 +apiVersion: v1
  433 +kind: Service
  434 +metadata:
  435 + name: tb-http-transport
  436 + namespace: thingsboard
  437 +spec:
  438 + type: ClusterIP
  439 + selector:
  440 + app: tb-http-transport
  441 + ports:
  442 + - port: 8080
  443 + name: http
  444 +---
  445 +apiVersion: extensions/v1beta1
  446 +kind: Deployment
  447 +metadata:
  448 + name: tb-coap-transport
  449 + namespace: thingsboard
  450 +spec:
  451 + replicas: 2
  452 + selector:
  453 + matchLabels:
  454 + app: tb-coap-transport
  455 + template:
  456 + metadata:
  457 + labels:
  458 + app: tb-coap-transport
  459 + spec:
  460 + volumes:
  461 + - name: tb-coap-transport-config
  462 + configMap:
  463 + name: tb-coap-transport-config
  464 + items:
  465 + - key: conf
  466 + path: tb-coap-transport.conf
  467 + - key: logback
  468 + path: logback.xml
  469 + containers:
  470 + - name: server
  471 + imagePullPolicy: Always
  472 + image: thingsboard/tb-coap-transport:latest
  473 + ports:
  474 + - containerPort: 5683
  475 + name: coap
  476 + protocol: UDP
  477 + env:
  478 + - name: CLUSTER_NODE_ID
  479 + valueFrom:
  480 + fieldRef:
  481 + fieldPath: metadata.name
  482 + - name: TB_HOST
  483 + valueFrom:
  484 + fieldRef:
  485 + fieldPath: metadata.name
  486 + - name: COAP_BIND_ADDRESS
  487 + value: "0.0.0.0"
  488 + - name: COAP_BIND_PORT
  489 + value: "5683"
  490 + - name: COAP_TIMEOUT
  491 + value: "10000"
  492 + - name: TB_KAFKA_SERVERS
  493 + value: "tb-kafka:9092"
  494 + volumeMounts:
  495 + - mountPath: /config
  496 + name: tb-coap-transport-config
  497 + restartPolicy: Always
  498 +---
  499 +apiVersion: v1
  500 +kind: Service
  501 +metadata:
  502 + name: tb-coap-transport
  503 + namespace: thingsboard
  504 +spec:
  505 + type: LoadBalancer
  506 + selector:
  507 + app: tb-coap-transport
  508 + ports:
  509 + - port: 5683
  510 + name: coap
  511 + protocol: UDP
  512 +---
  513 +apiVersion: extensions/v1beta1
  514 +kind: Deployment
  515 +metadata:
  516 + name: tb-web-ui
  517 + namespace: thingsboard
  518 +spec:
  519 + replicas: 2
  520 + selector:
  521 + matchLabels:
  522 + app: tb-web-ui
  523 + template:
  524 + metadata:
  525 + labels:
  526 + app: tb-web-ui
  527 + spec:
  528 + containers:
  529 + - name: server
  530 + imagePullPolicy: Always
  531 + image: thingsboard/tb-web-ui:latest
  532 + ports:
  533 + - containerPort: 8080
  534 + name: http
  535 + env:
  536 + - name: HTTP_BIND_ADDRESS
  537 + value: "0.0.0.0"
  538 + - name: HTTP_BIND_PORT
  539 + value: "8080"
  540 + - name: TB_ENABLE_PROXY
  541 + value: "false"
  542 + - name: LOGGER_LEVEL
  543 + value: "info"
  544 + - name: LOG_FOLDER
  545 + value: "logs"
  546 + - name: LOGGER_FILENAME
  547 + value: "tb-web-ui-%DATE%.log"
  548 + - name: DOCKER_MODE
  549 + value: "true"
  550 + livenessProbe:
  551 + httpGet:
  552 + path: /index.html
  553 + port: http
  554 + initialDelaySeconds: 120
  555 + timeoutSeconds: 10
  556 + restartPolicy: Always
  557 +---
  558 +apiVersion: v1
  559 +kind: Service
  560 +metadata:
  561 + name: tb-web-ui
  562 + namespace: thingsboard
  563 +spec:
  564 + type: ClusterIP
  565 + selector:
  566 + app: tb-web-ui
  567 + ports:
  568 + - port: 8080
  569 + name: http
  570 +---
  571 +apiVersion: extensions/v1beta1
  572 +kind: Ingress
  573 +metadata:
  574 + name: tb-ingress
  575 + namespace: thingsboard
  576 + annotations:
  577 + nginx.ingress.kubernetes.io/use-regex: "true"
  578 + nginx.ingress.kubernetes.io/ssl-redirect: "false"
  579 + nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
  580 +spec:
  581 + rules:
  582 + - http:
  583 + paths:
  584 + - path: /api/v1/.*
  585 + backend:
  586 + serviceName: tb-http-transport
  587 + servicePort: 8080
  588 + - path: /static/rulenode/.*
  589 + backend:
  590 + serviceName: tb-node
  591 + servicePort: 8080
  592 + - path: /static/.*
  593 + backend:
  594 + serviceName: tb-web-ui
  595 + servicePort: 8080
  596 + - path: /index.html.*
  597 + backend:
  598 + serviceName: tb-web-ui
  599 + servicePort: 8080
  600 + - path: /
  601 + backend:
  602 + serviceName: tb-web-ui
  603 + servicePort: 8080
  604 + - path: /.*
  605 + backend:
  606 + serviceName: tb-node
  607 + servicePort: 8080
  608 +---