diff --git a/application/pom.xml b/application/pom.xml
index 67dd91d757..c4766f2ba8 100644
--- a/application/pom.xml
+++ b/application/pom.xml
@@ -576,6 +576,27 @@
+
+ org.apache.maven.plugins
+ maven-install-plugin
+
+ ${project.build.directory}/${pkg.name}.deb
+ ${project.artifactId}
+ ${project.groupId}
+ ${project.version}
+ deb
+ deb
+
+
+
+ install-deb
+ package
+
+ install-file
+
+
+
+
org.xolstice.maven.plugins
protobuf-maven-plugin
diff --git a/application/src/main/resources/thingsboard.yml b/application/src/main/resources/thingsboard.yml
index a6d42eb71c..052490939a 100644
--- a/application/src/main/resources/thingsboard.yml
+++ b/application/src/main/resources/thingsboard.yml
@@ -407,7 +407,7 @@ state:
kafka:
enabled: true
- bootstrap.servers: "${TB_KAFKA_SERVERS:192.168.2.157:9092}"
+ bootstrap.servers: "${TB_KAFKA_SERVERS:localhost:9092}"
acks: "${TB_KAFKA_ACKS:all}"
retries: "${TB_KAFKA_RETRIES:1}"
batch.size: "${TB_KAFKA_BATCH_SIZE:16384}"
@@ -415,7 +415,7 @@ kafka:
buffer.memory: "${TB_BUFFER_MEMORY:33554432}"
js:
- evaluator: "${JS_EVALUATOR:remote}" # local/remote
+ evaluator: "${JS_EVALUATOR:local}" # local/remote
# Built-in JVM JavaScript environment properties
local:
# Use Sandboxed (secured) JVM JavaScript environment
diff --git a/common/queue/src/main/java/org/thingsboard/server/kafka/TBKafkaAdmin.java b/common/queue/src/main/java/org/thingsboard/server/kafka/TBKafkaAdmin.java
index 7ea40cd17c..f6bafef45d 100644
--- a/common/queue/src/main/java/org/thingsboard/server/kafka/TBKafkaAdmin.java
+++ b/common/queue/src/main/java/org/thingsboard/server/kafka/TBKafkaAdmin.java
@@ -32,15 +32,8 @@ public class TBKafkaAdmin {
AdminClient client;
- public TBKafkaAdmin() {
- Properties props = new Properties();
- props.put("bootstrap.servers", "localhost:9092");
- props.put("group.id", "test");
- props.put("enable.auto.commit", "true");
- props.put("auto.commit.interval.ms", "1000");
- props.put("key.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
- props.put("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
- client = AdminClient.create(props);
+ public TBKafkaAdmin(TbKafkaSettings settings) {
+ client = AdminClient.create(settings.toProps());
}
public CreateTopicsResult createTopic(NewTopic topic){
diff --git a/common/queue/src/main/java/org/thingsboard/server/kafka/TBKafkaProducerTemplate.java b/common/queue/src/main/java/org/thingsboard/server/kafka/TBKafkaProducerTemplate.java
index 1f0d3ad20e..7e24ad00a6 100644
--- a/common/queue/src/main/java/org/thingsboard/server/kafka/TBKafkaProducerTemplate.java
+++ b/common/queue/src/main/java/org/thingsboard/server/kafka/TBKafkaProducerTemplate.java
@@ -52,12 +52,16 @@ public class TBKafkaProducerTemplate {
@Getter
private final String defaultTopic;
+ @Getter
+ private final TbKafkaSettings settings;
+
@Builder
private TBKafkaProducerTemplate(TbKafkaSettings settings, TbKafkaEncoder encoder, TbKafkaEnricher enricher,
TbKafkaPartitioner partitioner, String defaultTopic) {
Properties props = settings.toProps();
props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringSerializer");
props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.ByteArraySerializer");
+ this.settings = settings;
this.producer = new KafkaProducer<>(props);
this.encoder = encoder;
this.enricher = enricher;
@@ -67,7 +71,7 @@ public class TBKafkaProducerTemplate {
public void init() {
try {
- TBKafkaAdmin admin = new TBKafkaAdmin();
+ TBKafkaAdmin admin = new TBKafkaAdmin(this.settings);
CreateTopicsResult result = admin.createTopic(new NewTopic(defaultTopic, 100, (short) 1));
result.all().get();
} catch (Exception e) {
diff --git a/common/queue/src/main/java/org/thingsboard/server/kafka/TbKafkaRequestTemplate.java b/common/queue/src/main/java/org/thingsboard/server/kafka/TbKafkaRequestTemplate.java
index 17b44597c7..8a0f5293d9 100644
--- a/common/queue/src/main/java/org/thingsboard/server/kafka/TbKafkaRequestTemplate.java
+++ b/common/queue/src/main/java/org/thingsboard/server/kafka/TbKafkaRequestTemplate.java
@@ -55,7 +55,8 @@ public class TbKafkaRequestTemplate {
private volatile boolean stopped = false;
@Builder
- public TbKafkaRequestTemplate(TBKafkaProducerTemplate requestTemplate, TBKafkaConsumerTemplate responseTemplate,
+ public TbKafkaRequestTemplate(TBKafkaProducerTemplate requestTemplate,
+ TBKafkaConsumerTemplate responseTemplate,
long maxRequestTimeout,
long maxPendingRequests,
long pollInterval,
@@ -77,7 +78,7 @@ public class TbKafkaRequestTemplate {
public void init() {
try {
- TBKafkaAdmin admin = new TBKafkaAdmin();
+ TBKafkaAdmin admin = new TBKafkaAdmin(this.requestTemplate.getSettings());
CreateTopicsResult result = admin.createTopic(new NewTopic(responseTemplate.getTopic(), 1, (short) 1));
result.all().get();
} catch (Exception e) {
diff --git a/msa/docker/.env b/msa/docker/.env
new file mode 100644
index 0000000000..b3c8ff66bb
--- /dev/null
+++ b/msa/docker/.env
@@ -0,0 +1,7 @@
+
+DOCKER_REPO=local-maven-build
+TB_VERSION=2.2.0-SNAPSHOT
+
+KAFKA_TOPICS=js.eval.requests:100:1
+HTTP_PORT=80
+HTTPS_PORT=80
\ No newline at end of file
diff --git a/msa/docker/.gitignore b/msa/docker/.gitignore
new file mode 100644
index 0000000000..473a5a6ead
--- /dev/null
+++ b/msa/docker/.gitignore
@@ -0,0 +1,4 @@
+haproxy/certs.d/**
+haproxy/letsencrypt/**
+tb-node/log/**
+!.env
diff --git a/msa/docker/docker-compose.yml b/msa/docker/docker-compose.yml
index 727936c2f6..876646f16d 100644
--- a/msa/docker/docker-compose.yml
+++ b/msa/docker/docker-compose.yml
@@ -19,17 +19,19 @@ version: '2'
services:
zookeeper:
+ restart: always
image: "wurstmeister/zookeeper"
ports:
- "2181"
kafka:
+ restart: always
image: "wurstmeister/kafka"
ports:
- "9092:9092"
environment:
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_LISTENERS: INSIDE://:9093,OUTSIDE://:9092
- KAFKA_ADVERTISED_LISTENERS: INSIDE://:9093,OUTSIDE://${EXTERNAL_HOSTNAME}:9092
+ KAFKA_ADVERTISED_LISTENERS: INSIDE://:9093,OUTSIDE://kafka:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: INSIDE
KAFKA_CREATE_TOPICS: "${KAFKA_TOPICS}"
@@ -37,21 +39,81 @@ services:
depends_on:
- zookeeper
tb-js-executor:
- image: "local-maven-build/tb-js-executor:latest"
+ restart: always
+ image: "${DOCKER_REPO}/tb-js-executor:${TB_VERSION}"
environment:
TB_KAFKA_SERVERS: kafka:9092
env_file:
- tb-js-executor.env
depends_on:
- kafka
- tb-web-ui:
- image: "local-maven-build/tb-web-ui:latest"
+ tb:
+ restart: always
+ image: "${DOCKER_REPO}/tb-node:${TB_VERSION}"
ports:
- - "8090:8090"
+ - "8080"
+ - "1883:1883"
+ - "5683:5683/udp"
+ env_file:
+ - tb-node.env
environment:
- HTTP_BIND_ADDRESS: 0.0.0.0
- HTTP_BIND_PORT: 8090
- TB_HOST: ${EXTERNAL_HOSTNAME}
+ ZOOKEEPER_URL: zk:2181
+ TB_KAFKA_SERVERS: kafka:9092
+ JS_EVALUATOR: remote
+ volumes:
+ - ./tb-node/db:/usr/share/thingsboard/data/db"
+ - ./tb-node/conf:/config
+ - ./tb-node/log:/var/log/thingsboard
+ depends_on:
+ - kafka
+ tb-web-ui1:
+ restart: always
+ image: "${DOCKER_REPO}/tb-web-ui:${TB_VERSION}"
+ ports:
+ - "8080"
+ environment:
+ TB_HOST: tb
TB_PORT: 8080
env_file:
- tb-web-ui.env
+ tb-web-ui2:
+ restart: always
+ image: "${DOCKER_REPO}/tb-web-ui:${TB_VERSION}"
+ ports:
+ - "8080"
+ environment:
+ TB_HOST: tb
+ TB_PORT: 8080
+ env_file:
+ - tb-web-ui.env
+ tb-web-ui3:
+ restart: always
+ image: "${DOCKER_REPO}/tb-web-ui:${TB_VERSION}"
+ ports:
+ - "8080"
+ environment:
+ TB_HOST: tb
+ TB_PORT: 8080
+ env_file:
+ - tb-web-ui.env
+ web:
+ restart: always
+ container_name: haproxy-certbot
+ image: nmarus/haproxy-certbot
+ volumes:
+ - ./haproxy/config:/config
+ - ./haproxy/letsencrypt:/etc/letsencrypt
+ - ./haproxy/certs.d:/usr/local/etc/haproxy/certs.d
+ ports:
+ - "80:80"
+ - "443:443"
+ - "9999:9999"
+ cap_add:
+ - NET_ADMIN
+ environment:
+ HTTP_PORT: ${HTTP_PORT}
+ HTTPS_PORT: ${HTTPS_PORT}
+ links:
+ - tb-web-ui1
+ - tb-web-ui2
+ - tb-web-ui3
diff --git a/msa/docker/docker-install-tb.sh b/msa/docker/docker-install-tb.sh
new file mode 100755
index 0000000000..d17ba305d1
--- /dev/null
+++ b/msa/docker/docker-install-tb.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+#
+# Copyright © 2016-2018 The Thingsboard Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+while [[ $# -gt 0 ]]
+do
+key="$1"
+
+case $key in
+ --loadDemo)
+ LOAD_DEMO=true
+ shift # past argument
+ ;;
+ *)
+ # unknown option
+ ;;
+esac
+shift # past argument or value
+done
+
+if [ "$LOAD_DEMO" == "true" ]; then
+ loadDemo=true
+else
+ loadDemo=false
+fi
+
+docker-compose run --rm -e INSTALL_TB=true -e LOAD_DEMO=${loadDemo} tb
+
+
diff --git a/msa/docker/docker-start-services.sh b/msa/docker/docker-start-services.sh
new file mode 100755
index 0000000000..3b07efb4a2
--- /dev/null
+++ b/msa/docker/docker-start-services.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+#
+# Copyright © 2016-2018 The Thingsboard Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+docker-compose up -d
diff --git a/msa/docker/docker-stop-services.sh b/msa/docker/docker-stop-services.sh
new file mode 100755
index 0000000000..a388bf1391
--- /dev/null
+++ b/msa/docker/docker-stop-services.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+#
+# Copyright © 2016-2018 The Thingsboard Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+docker-compose down
diff --git a/msa/docker/docker-upgrade-tb.sh b/msa/docker/docker-upgrade-tb.sh
new file mode 100755
index 0000000000..69cb4faa9e
--- /dev/null
+++ b/msa/docker/docker-upgrade-tb.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+#
+# Copyright © 2016-2018 The Thingsboard Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+for i in "$@"
+do
+case $i in
+ --fromVersion=*)
+ FROM_VERSION="${i#*=}"
+ shift
+ ;;
+ *)
+ # unknown option
+ ;;
+esac
+done
+
+if [[ -z "${FROM_VERSION// }" ]]; then
+ echo "--fromVersion parameter is invalid or unspecified!"
+ echo "Usage: docker-upgrade-tb.sh --fromVersion={VERSION}"
+ exit 1
+else
+ fromVersion="${FROM_VERSION// }"
+fi
+
+docker-compose run --rm -e UPGRADE_TB=true -e FROM_VERSION=${fromVersion} tb
diff --git a/msa/docker/haproxy/certs.d/.gitignore b/msa/docker/haproxy/certs.d/.gitignore
new file mode 100644
index 0000000000..86d0cb2726
--- /dev/null
+++ b/msa/docker/haproxy/certs.d/.gitignore
@@ -0,0 +1,4 @@
+# Ignore everything in this directory
+*
+# Except this file
+!.gitignore
\ No newline at end of file
diff --git a/msa/docker/haproxy/config/haproxy.cfg b/msa/docker/haproxy/config/haproxy.cfg
new file mode 100644
index 0000000000..67e3f563a7
--- /dev/null
+++ b/msa/docker/haproxy/config/haproxy.cfg
@@ -0,0 +1,61 @@
+#HA Proxy Config
+global
+ maxconn 4096
+
+ log 127.0.0.1 local0
+ log 127.0.0.1 local1 notice
+
+ ca-base /etc/ssl/certs
+ crt-base /etc/ssl/private
+
+ ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS
+ ssl-default-bind-options no-sslv3
+
+defaults
+
+ option forwardfor
+
+ log global
+
+ mode http
+
+ timeout connect 5000ms
+ timeout client 50000ms
+ timeout server 50000ms
+
+listen stats
+ bind *:9999
+ stats enable
+ stats hide-version
+ stats uri /stats
+ stats auth admin:admin@123
+
+frontend http-in
+ bind *:${HTTP_PORT}
+
+ reqadd X-Forwarded-Proto:\ http
+
+ acl letsencrypt_http_acl path_beg /.well-known/acme-challenge/
+ redirect scheme https if !letsencrypt_http_acl
+ use_backend letsencrypt_http if letsencrypt_http_acl
+
+ default_backend tb-web-backend
+
+frontend https_in
+ bind *:${HTTPS_PORT} ssl crt /usr/local/etc/haproxy/default.pem crt /usr/local/etc/haproxy/certs.d ciphers ECDHE-RSA-AES256-SHA:RC4-SHA:RC4:HIGH:!MD5:!aNULL:!EDH:!AESGCM
+
+ reqadd X-Forwarded-Proto:\ https
+
+ default_backend tb-web-backend
+
+backend letsencrypt_http
+ server letsencrypt_http_srv 127.0.0.1:8080
+
+backend tb-web-backend
+ balance leastconn
+ option tcp-check
+ option log-health-checks
+ server tbWeb1 tb-web-ui1:8080 check
+ server tbWeb2 tb-web-ui2:8080 check
+ server tbWeb3 tb-web-ui3:8080 check
+ http-request set-header X-Forwarded-Port %[dst_port]
diff --git a/msa/docker/haproxy/letsencrypt/.gitignore b/msa/docker/haproxy/letsencrypt/.gitignore
new file mode 100644
index 0000000000..86d0cb2726
--- /dev/null
+++ b/msa/docker/haproxy/letsencrypt/.gitignore
@@ -0,0 +1,4 @@
+# Ignore everything in this directory
+*
+# Except this file
+!.gitignore
\ No newline at end of file
diff --git a/msa/docker/tb-node.env b/msa/docker/tb-node.env
new file mode 100644
index 0000000000..8ba24620c2
--- /dev/null
+++ b/msa/docker/tb-node.env
@@ -0,0 +1,23 @@
+# ThingsBoard server configuration
+MQTT_BIND_ADDRESS=0.0.0.0
+MQTT_BIND_PORT=1883
+COAP_BIND_ADDRESS=0.0.0.0
+COAP_BIND_PORT=5683
+
+# type of database to use: sql[DEFAULT] or cassandra
+DATABASE_TYPE=sql
+SQL_DATA_FOLDER=/usr/share/thingsboard/data/db
+
+# cassandra db config
+CASSANDRA_URL=cassandra:9042
+CASSANDRA_HOST=cassandra
+CASSANDRA_PORT=9042
+
+# postgres db config
+POSTGRES_HOST=postgres
+POSTGRES_PORT=5432
+# SPRING_JPA_DATABASE_PLATFORM=org.hibernate.dialect.PostgreSQLDialect
+# SPRING_DRIVER_CLASS_NAME=org.postgresql.Driver
+# SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/thingsboard
+# SPRING_DATASOURCE_USERNAME=postgres
+# SPRING_DATASOURCE_PASSWORD=postgres
diff --git a/msa/docker/tb-node/conf/logback.xml b/msa/docker/tb-node/conf/logback.xml
new file mode 100644
index 0000000000..87f9bf4c06
--- /dev/null
+++ b/msa/docker/tb-node/conf/logback.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+ /var/log/thingsboard/thingsboard.log
+
+ /var/log/thingsboard/thingsboard.%d{yyyy-MM-dd}.%i.log
+ 100MB
+ 30
+ 3GB
+
+
+ %d{ISO8601} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+ %d{ISO8601} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/msa/docker/tb-node/conf/thingsboard.conf b/msa/docker/tb-node/conf/thingsboard.conf
new file mode 100644
index 0000000000..1fc5ac4835
--- /dev/null
+++ b/msa/docker/tb-node/conf/thingsboard.conf
@@ -0,0 +1,24 @@
+#
+# Copyright © 2016-2018 The Thingsboard Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+export JAVA_OPTS="$JAVA_OPTS -Dplatform=deb -Dinstall.data_dir=/usr/share/thingsboard/data"
+export JAVA_OPTS="$JAVA_OPTS -Xloggc:/var/log/thingsboard/gc.log -XX:+IgnoreUnrecognizedVMOptions -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDetails -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"
+export JAVA_OPTS="$JAVA_OPTS -XX:CMSWaitDuration=10000 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+CMSParallelInitialMarkEnabled"
+export JAVA_OPTS="$JAVA_OPTS -XX:+CMSEdenChunksRecordAlways -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly"
+export LOG_FILENAME=thingsboard.out
+export LOADER_PATH=/usr/share/thingsboard/conf,/usr/share/thingsboard/extensions
diff --git a/msa/docker/tb-node/db/.gitignore b/msa/docker/tb-node/db/.gitignore
new file mode 100644
index 0000000000..86d0cb2726
--- /dev/null
+++ b/msa/docker/tb-node/db/.gitignore
@@ -0,0 +1,4 @@
+# Ignore everything in this directory
+*
+# Except this file
+!.gitignore
\ No newline at end of file
diff --git a/msa/docker/tb-node/log/.gitignore b/msa/docker/tb-node/log/.gitignore
new file mode 100644
index 0000000000..86d0cb2726
--- /dev/null
+++ b/msa/docker/tb-node/log/.gitignore
@@ -0,0 +1,4 @@
+# Ignore everything in this directory
+*
+# Except this file
+!.gitignore
\ No newline at end of file
diff --git a/msa/docker/tb-web-ui.env b/msa/docker/tb-web-ui.env
index 8d6157bfc8..e78c80c86e 100644
--- a/msa/docker/tb-web-ui.env
+++ b/msa/docker/tb-web-ui.env
@@ -1,6 +1,6 @@
HTTP_BIND_ADDRESS=0.0.0.0
-HTTP_BIND_PORT=8090
+HTTP_BIND_PORT=8080
TB_HOST=localhost
TB_PORT=8080
LOGGER_LEVEL=debug
diff --git a/msa/js-executor/pom.xml b/msa/js-executor/pom.xml
index 51416f5aa3..84792f18b8 100644
--- a/msa/js-executor/pom.xml
+++ b/msa/js-executor/pom.xml
@@ -40,7 +40,6 @@
/usr/share/${pkg.name}
${project.build.directory}/package/linux
${project.build.directory}/package/windows
- true
@@ -280,7 +279,6 @@
com.spotify
dockerfile-maven-plugin
- 1.4.4
build-docker-image
@@ -292,7 +290,8 @@
${dockerfile.skip}
- local-maven-build/${pkg.name}
+ ${docker.repo}/${pkg.name}
+ ${project.version}
true
false
${project.build.directory}
diff --git a/msa/pom.xml b/msa/pom.xml
index 3241d0cf51..21ddb4dafe 100644
--- a/msa/pom.xml
+++ b/msa/pom.xml
@@ -32,11 +32,26 @@
${basedir}/..
+ local-maven-build
+ true
js-executor
web-ui
+ tb-node
+
+
+
+
+ com.spotify
+ dockerfile-maven-plugin
+ 1.4.5
+
+
+
+
+
diff --git a/msa/tb-node/docker/Dockerfile b/msa/tb-node/docker/Dockerfile
new file mode 100644
index 0000000000..c86d020d20
--- /dev/null
+++ b/msa/tb-node/docker/Dockerfile
@@ -0,0 +1,28 @@
+#
+# Copyright © 2016-2018 The Thingsboard Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+FROM openjdk:8-jre
+
+COPY start-tb-node.sh ${pkg.name}.deb /tmp/
+
+RUN chmod a+x /tmp/*.sh \
+ && mv /tmp/start-tb-node.sh /usr/bin
+
+RUN dpkg -i /tmp/${pkg.name}.deb
+
+RUN update-rc.d ${pkg.name} disable
+
+CMD ["start-tb-node.sh"]
diff --git a/msa/tb-node/docker/start-tb-node.sh b/msa/tb-node/docker/start-tb-node.sh
new file mode 100755
index 0000000000..7f7e8696e2
--- /dev/null
+++ b/msa/tb-node/docker/start-tb-node.sh
@@ -0,0 +1,71 @@
+#!/bin/bash
+#
+# Copyright © 2016-2018 The Thingsboard Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+CONF_FOLDER="/config"
+jarfile=${pkg.installFolder}/bin/${pkg.name}.jar
+configfile=${pkg.name}.conf
+run_user=${pkg.name}
+
+source "${CONF_FOLDER}/${configfile}"
+
+export LOADER_PATH=/config,${LOADER_PATH}
+
+if [ "$INSTALL_TB" == "true" ]; then
+
+ if [ "$LOAD_DEMO" == "true" ]; then
+ loadDemo=true
+ else
+ loadDemo=false
+ fi
+
+ echo "Starting ThingsBoard installation ..."
+
+ exec java -cp ${jarfile} $JAVA_OPTS -Dloader.main=org.thingsboard.server.ThingsboardInstallApplication \
+ -Dinstall.load_demo=${loadDemo} \
+ -Dspring.jpa.hibernate.ddl-auto=none \
+ -Dinstall.upgrade=false \
+ -Dlogging.config=/usr/share/thingsboard/bin/install/logback.xml \
+ org.springframework.boot.loader.PropertiesLauncher
+
+elif [ "$UPGRADE_TB" == "true" ]; then
+
+ echo "Starting ThingsBoard upgrade ..."
+
+ if [[ -z "${FROM_VERSION// }" ]]; then
+ echo "FROM_VERSION variable is invalid or unspecified!"
+ exit 1
+ else
+ fromVersion="${FROM_VERSION// }"
+ fi
+
+ exec java -cp ${jarfile} $JAVA_OPTS -Dloader.main=org.thingsboard.server.ThingsboardInstallApplication \
+ -Dspring.jpa.hibernate.ddl-auto=none \
+ -Dinstall.upgrade=true \
+ -Dinstall.upgrade.from_version=${fromVersion} \
+ -Dlogging.config=/usr/share/thingsboard/bin/install/logback.xml \
+ org.springframework.boot.loader.PropertiesLauncher
+
+else
+
+ echo "Starting '${project.name}' ..."
+
+ exec java -cp ${jarfile} $JAVA_OPTS -Dloader.main=org.thingsboard.server.ThingsboardServerApplication \
+ -Dspring.jpa.hibernate.ddl-auto=none \
+ -Dlogging.config=/config/logback.xml \
+ org.springframework.boot.loader.PropertiesLauncher
+
+fi
diff --git a/msa/tb-node/pom.xml b/msa/tb-node/pom.xml
new file mode 100644
index 0000000000..436d88b994
--- /dev/null
+++ b/msa/tb-node/pom.xml
@@ -0,0 +1,136 @@
+
+
+ 4.0.0
+
+ org.thingsboard
+ 2.2.0-SNAPSHOT
+ msa
+
+ org.thingsboard.msa
+ tb-node
+ pom
+
+ ThingsBoard Node Microservice
+ https://thingsboard.io
+ ThingsBoard Node Microservice
+
+
+ UTF-8
+ ${basedir}/../..
+ thingsboard
+ thingsboard
+ /var/log/${pkg.name}
+ /usr/share/${pkg.name}
+
+
+
+
+ org.thingsboard
+ application
+ ${project.version}
+ deb
+ deb
+ provided
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+
+
+ copy-tb-deb
+ package
+
+ copy
+
+
+
+
+ org.thingsboard
+ application
+ deb
+ deb
+ ${pkg.name}.deb
+ ${project.build.directory}
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+
+
+ copy-docker-config
+ process-resources
+
+ copy-resources
+
+
+ ${project.build.directory}
+
+
+ docker
+ true
+
+
+
+
+
+
+
+ com.spotify
+ dockerfile-maven-plugin
+
+
+ build-docker-image
+ pre-integration-test
+
+ build
+
+
+
+
+ ${dockerfile.skip}
+ ${docker.repo}/tb-node
+ ${project.version}
+ true
+ false
+ ${project.build.directory}
+
+
+
+
+
+
+ jenkins
+ Jenkins Repository
+ http://repo.jenkins-ci.org/releases
+
+ false
+
+
+
+
diff --git a/msa/web-ui/pom.xml b/msa/web-ui/pom.xml
index 54c3bb45f5..32a076d183 100644
--- a/msa/web-ui/pom.xml
+++ b/msa/web-ui/pom.xml
@@ -40,7 +40,6 @@
/usr/share/${pkg.name}
${project.build.directory}/package/linux
${project.build.directory}/package/windows
- true
@@ -304,7 +303,6 @@
com.spotify
dockerfile-maven-plugin
- 1.4.4
build-docker-image
@@ -316,7 +314,8 @@
${dockerfile.skip}
- local-maven-build/${pkg.name}
+ ${docker.repo}/${pkg.name}
+ ${project.version}
true
false
${project.build.directory}
diff --git a/pom.xml b/pom.xml
index 327838c5a0..d6db123ebe 100755
--- a/pom.xml
+++ b/pom.xml
@@ -284,6 +284,8 @@
src/main/scripts/windows/**
src/main/resources/public/static/rulenode/**
**/*.proto.js
+ docker/haproxy/**
+ docker/tb-node/**
JAVADOC_STYLE