Commit 00e89617d507a93730018e61884bceb899871023

Authored by Igor Kulikov
1 parent e51cafa1

Create single instance docker builds. Move MSA docker configuration to the root.

Showing 66 changed files with 1567 additions and 1490 deletions
1 -# cassandra environment variables  
2 -CASSANDRA_DATA_DIR=/home/docker/cassandra_volume  
3 1
4 -# postgres environment variables  
5 -POSTGRES_DATA_DIR=/home/docker/postgres_volume  
6 -POSTGRES_DB=thingsboard 2 +DOCKER_REPO=thingsboard
7 3
8 -# hsqldb environment variables  
9 -HSQLDB_DATA_DIR=/home/docker/hsqldb_volume 4 +JS_EXECUTOR_DOCKER_NAME=tb-js-executor
  5 +TB_NODE_DOCKER_NAME=tb-node
  6 +WEB_UI_DOCKER_NAME=tb-web-ui
  7 +MQTT_TRANSPORT_DOCKER_NAME=tb-mqtt-transport
  8 +HTTP_TRANSPORT_DOCKER_NAME=tb-http-transport
  9 +COAP_TRANSPORT_DOCKER_NAME=tb-coap-transport
10 10
11 -# environment variables for schema init and insert system and demo data  
12 -ADD_SCHEMA_AND_SYSTEM_DATA=false  
13 -ADD_DEMO_DATA=false  
  11 +TB_VERSION=latest
  12 +
  13 +# Database used by ThingsBoard, can be either local (local HSQLDB), postgres (PostgreSQL), cassandra (Cassandra).
  14 +# In case of postgres or cassandra corresponding docker service will be deployed (see docker-compose.postgres.yml, docker-compose.cassandra.yml for details).
  15 +
  16 +DATABASE=cassandra
  17 +
  18 +KAFKA_TOPICS="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"
docker/.gitignore renamed from msa/docker/.gitignore
@@ -2,4 +2,6 @@ haproxy/certs.d/** @@ -2,4 +2,6 @@ haproxy/certs.d/**
2 haproxy/letsencrypt/** 2 haproxy/letsencrypt/**
3 tb-node/log/** 3 tb-node/log/**
4 tb-node/db/** 4 tb-node/db/**
  5 +tb-node/postgres/**
  6 +tb-node/cassandra/**
5 !.env 7 !.env
  1 +# Docker configuration for ThingsBoard Microservices
  2 +
  3 +This folder containing scripts and Docker Compose configurations to run ThingsBoard in Microservices mode.
  4 +
  5 +## Installation
  6 +
  7 +Execute the following command to run DataBase installation:
  8 +
  9 +`
  10 +$ ./docker-install-tb.sh --loadDemo
  11 +`
  12 +
  13 +- `--loadDemo` - optional argument. Whether to load additional demo data.
  14 +
  15 +## Running
  16 +
  17 +Execute the following command to run services:
  18 +
  19 +`
  20 +$ ./docker-start-services.sh
  21 +`
  22 +
  23 +Execute the following command to stop services:
  24 +
  25 +`
  26 +$ ./docker-stop-services.sh
  27 +`
  28 +
  29 +Execute the following command to stop and completely remove deployed docker containers:
  30 +
  31 +`
  32 +$ ./docker-remove-services.sh
  33 +`
  34 +
  35 +Execute the following command to update particular services (pull newer docker image and rebuild container):
  36 +
  37 +`
  38 +$ ./docker-update-service.sh [SERVICE...]
  39 +`
  40 +
  41 +## Upgrading
  42 +
  43 +In case when database upgrade is needed, execute the following commands:
  44 +
  45 +`
  46 +$ ./docker-stop-services.sh
  47 +$ ./docker-upgrade-tb.sh --fromVersion=[FROM_VERSION]
  48 +$ ./docker-start-services.sh
  49 +`
  50 +
  51 +- `FROM_VERSION` - from which version upgrade should be started.
1 -VERSION=2.1.0  
2 -PROJECT=thingsboard  
3 -APP=cassandra-setup  
4 -  
5 -build:  
6 - cp ../../application/target/thingsboard.deb .  
7 - docker build --pull -t ${PROJECT}/${APP}:${VERSION} -t ${PROJECT}/${APP}:latest .  
8 - rm thingsboard.deb  
9 -  
10 -push: build  
11 - docker push ${PROJECT}/${APP}:${VERSION}  
12 - docker push ${PROJECT}/${APP}:latest  
1 -VERSION=2.1.0  
2 -PROJECT=thingsboard  
3 -APP=cassandra-upgrade  
4 -  
5 -build:  
6 - cp ../../application/target/thingsboard.deb .  
7 - docker build --pull -t ${PROJECT}/${APP}:${VERSION} -t ${PROJECT}/${APP}:latest .  
8 - rm thingsboard.deb  
9 -  
10 -push: build  
11 - docker push ${PROJECT}/${APP}:${VERSION}  
12 - docker push ${PROJECT}/${APP}:latest  
1 -VERSION=2.1.0  
2 -PROJECT=thingsboard  
3 -APP=cassandra  
4 -  
5 -build:  
6 - docker build --pull -t ${PROJECT}/${APP}:${VERSION} -t ${PROJECT}/${APP}:latest .  
7 -  
8 -push: build  
9 - docker push ${PROJECT}/${APP}:${VERSION}  
10 - docker push ${PROJECT}/${APP}:latest  
docker/check-dirs.sh renamed from msa/docker/check-dirs.sh
@@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
15 # limitations under the License. 15 # limitations under the License.
16 # 16 #
17 17
18 -dirsArray=("./haproxy/certs.d" "./haproxy/letsencrypt" "./tb-node/db" "./tb-node/log") 18 +dirsArray=("./haproxy/certs.d" "./haproxy/letsencrypt" "./tb-node/db" "./tb-node/postgres" "./tb-node/cassandra" "./tb-node/log")
19 19
20 for dir in ${dirsArray[@]} 20 for dir in ${dirsArray[@]}
21 do 21 do
1 -#  
2 -# Copyright © 2016-2018 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 -version: '3.3'  
18 -services:  
19 - zookeeper:  
20 - image: wurstmeister/zookeeper  
21 - networks:  
22 - - core  
23 - ports:  
24 - - "2181:2181"  
25 -  
26 - cassandra:  
27 - image: cassandra:3.11.2  
28 - networks:  
29 - - core  
30 - ports:  
31 - - "7199:7199"  
32 - - "9160:9160"  
33 - - "9042:9042"  
34 -  
35 - redis:  
36 - image: redis:4.0  
37 - networks:  
38 - - core  
39 - command: redis-server --maxclients 2000  
40 - ports:  
41 - - "6379:6379"  
42 -  
43 -networks:  
44 - core:  
45 -  
  1 +#!/bin/bash
  2 +#
  3 +# Copyright © 2016-2018 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 additionalComposeArgs() {
  19 + source .env
  20 + ADDITIONAL_COMPOSE_ARGS=""
  21 + case $DATABASE in
  22 + local)
  23 + ;;
  24 + postgres)
  25 + ADDITIONAL_COMPOSE_ARGS="-f docker-compose.postgres.yml"
  26 + ;;
  27 + cassandra)
  28 + ADDITIONAL_COMPOSE_ARGS="-f docker-compose.cassandra.yml"
  29 + ;;
  30 + *)
  31 + echo "Unknown DATABASE value specified: '${DATABASE}'. Should be either local, postgres or cassandra." >&2
  32 + exit 1
  33 + esac
  34 + echo $ADDITIONAL_COMPOSE_ARGS
  35 +}
  36 +
  37 +function additionalStartupServices() {
  38 + source .env
  39 + ADDITIONAL_STARTUP_SERVICES=""
  40 + case $DATABASE in
  41 + local)
  42 + ;;
  43 + postgres)
  44 + ADDITIONAL_STARTUP_SERVICES=postgres
  45 + ;;
  46 + cassandra)
  47 + ADDITIONAL_STARTUP_SERVICES=cassandra
  48 + ;;
  49 + *)
  50 + echo "Unknown DATABASE value specified: '${DATABASE}'. Should be either local, postgres or cassandra." >&2
  51 + exit 1
  52 + esac
  53 + echo $ADDITIONAL_STARTUP_SERVICES
  54 +}
docker/docker-compose.cassandra.yml renamed from docker/docker-compose.static.yml
@@ -14,16 +14,21 @@ @@ -14,16 +14,21 @@
14 # limitations under the License. 14 # limitations under the License.
15 # 15 #
16 16
17 -version: '2' 17 +version: '2.2'
18 18
19 services: 19 services:
20 cassandra: 20 cassandra:
  21 + restart: always
  22 + image: "cassandra:3.11.3"
21 ports: 23 ports:
22 - - "9042:9042"  
23 - - "9160:9160"  
24 - zk:  
25 - ports:  
26 - - "2181:2181"  
27 - postgres:  
28 - ports:  
29 - - "5432:5432"  
  24 + - "9042"
  25 + volumes:
  26 + - ./tb-node/cassandra:/var/lib/cassandra
  27 + tb:
  28 + environment:
  29 + DATABASE_TS_TYPE: cassandra
  30 + DATABASE_ENTITIES_TYPE: cassandra
  31 + CASSANDRA_URL: cassandra:9042
  32 + depends_on:
  33 + - kafka
  34 + - cassandra
docker/docker-compose.postgres.yml renamed from docker/docker-compose-tests.yml
@@ -14,14 +14,27 @@ @@ -14,14 +14,27 @@
14 # limitations under the License. 14 # limitations under the License.
15 # 15 #
16 16
17 -version: '3.3' 17 +version: '2.2'
  18 +
18 services: 19 services:
19 - redis:  
20 - image: redis:4.0  
21 - networks:  
22 - - core 20 + postgres:
  21 + restart: always
  22 + image: "postgres:9.6"
23 ports: 23 ports:
24 - - "6379:6379"  
25 -  
26 -networks:  
27 - core: 24 + - "5432"
  25 + environment:
  26 + POSTGRES_DB: thingsboard
  27 + volumes:
  28 + - ./tb-node/postgres:/var/lib/postgresql/data
  29 + tb:
  30 + environment:
  31 + DATABASE_TS_TYPE: sql
  32 + DATABASE_ENTITIES_TYPE: sql
  33 + SPRING_JPA_DATABASE_PLATFORM: org.hibernate.dialect.PostgreSQLDialect
  34 + SPRING_DRIVER_CLASS_NAME: org.postgresql.Driver
  35 + SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/thingsboard
  36 + SPRING_DATASOURCE_USERNAME: postgres
  37 + SPRING_DATASOURCE_PASSWORD: postgres
  38 + depends_on:
  39 + - kafka
  40 + - postgres
@@ -14,40 +14,167 @@ @@ -14,40 +14,167 @@
14 # limitations under the License. 14 # limitations under the License.
15 # 15 #
16 16
17 -version: '2' 17 +
  18 +version: '2.2'
18 19
19 services: 20 services:
  21 + zookeeper:
  22 + restart: always
  23 + image: "wurstmeister/zookeeper"
  24 + ports:
  25 + - "2181"
  26 + kafka:
  27 + restart: always
  28 + image: "wurstmeister/kafka"
  29 + ports:
  30 + - "9092:9092"
  31 + environment:
  32 + KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
  33 + KAFKA_LISTENERS: INSIDE://:9093,OUTSIDE://:9092
  34 + KAFKA_ADVERTISED_LISTENERS: INSIDE://:9093,OUTSIDE://kafka:9092
  35 + KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT
  36 + KAFKA_INTER_BROKER_LISTENER_NAME: INSIDE
  37 + KAFKA_CREATE_TOPICS: "${KAFKA_TOPICS}"
  38 + KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'false'
  39 + KAFKA_LOG_RETENTION_BYTES: 1073741824
  40 + KAFKA_LOG_SEGMENT_BYTES: 268435456
  41 + KAFKA_LOG_RETENTION_MS: 300000
  42 + KAFKA_LOG_CLEANUP_POLICY: delete
  43 + depends_on:
  44 + - zookeeper
  45 + tb-js-executor:
  46 + restart: always
  47 + image: "${DOCKER_REPO}/${JS_EXECUTOR_DOCKER_NAME}:${TB_VERSION}"
  48 + scale: 20
  49 + environment:
  50 + TB_KAFKA_SERVERS: kafka:9092
  51 + env_file:
  52 + - tb-js-executor.env
  53 + depends_on:
  54 + - kafka
20 tb: 55 tb:
21 - image: "thingsboard/application:2.1.0" 56 + restart: always
  57 + image: "${DOCKER_REPO}/${TB_NODE_DOCKER_NAME}:${TB_VERSION}"
22 ports: 58 ports:
23 - - "8080:8080"  
24 - - "1883:1883"  
25 - - "5683:5683/udp" 59 + - "8080"
  60 + logging:
  61 + driver: "json-file"
  62 + options:
  63 + max-size: "200m"
  64 + max-file: "30"
26 env_file: 65 env_file:
27 - - tb.env 66 + - tb-node.env
28 environment: 67 environment:
29 - - ADD_SCHEMA_AND_SYSTEM_DATA=${ADD_SCHEMA_AND_SYSTEM_DATA}  
30 - - ADD_DEMO_DATA=${ADD_DEMO_DATA} 68 + ZOOKEEPER_URL: zk:2181
  69 + TB_KAFKA_SERVERS: kafka:9092
  70 + JS_EVALUATOR: remote
  71 + DATABASE_TS_TYPE: sql
  72 + DATABASE_ENTITIES_TYPE: sql
  73 + SQL_DATA_FOLDER: /usr/share/thingsboard/data/db
31 volumes: 74 volumes:
32 - - "${HSQLDB_DATA_DIR}:/usr/share/thingsboard/data/sql"  
33 - entrypoint: /run-application.sh  
34 - cassandra:  
35 - image: "cassandra:3.11.2" 75 + - ./tb-node/db:/usr/share/thingsboard/data/db
  76 + - ./tb-node/conf:/config
  77 + - ./tb-node/log:/var/log/thingsboard
  78 + depends_on:
  79 + - kafka
  80 + tb-mqtt-transport1:
  81 + restart: always
  82 + image: "${DOCKER_REPO}/${MQTT_TRANSPORT_DOCKER_NAME}:${TB_VERSION}"
36 ports: 83 ports:
37 - - "9042"  
38 - - "9160"  
39 - volumes:  
40 - - "${CASSANDRA_DATA_DIR}:/var/lib/cassandra"  
41 - zk:  
42 - image: "zookeeper:3.4.10" 84 + - "1883"
  85 + environment:
  86 + TB_KAFKA_SERVERS: kafka:9092
  87 + env_file:
  88 + - tb-mqtt-transport.env
  89 + depends_on:
  90 + - kafka
  91 + tb-mqtt-transport2:
  92 + restart: always
  93 + image: "${DOCKER_REPO}/${MQTT_TRANSPORT_DOCKER_NAME}:${TB_VERSION}"
43 ports: 94 ports:
44 - - "2181" 95 + - "1883"
  96 + environment:
  97 + TB_KAFKA_SERVERS: kafka:9092
  98 + env_file:
  99 + - tb-mqtt-transport.env
  100 + depends_on:
  101 + - kafka
  102 + tb-http-transport1:
45 restart: always 103 restart: always
46 - postgres:  
47 - image: "postgres:9.6" 104 + image: "${DOCKER_REPO}/${HTTP_TRANSPORT_DOCKER_NAME}:${TB_VERSION}"
48 ports: 105 ports:
49 - - "5432" 106 + - "8081"
50 environment: 107 environment:
51 - - POSTGRES_DB=${POSTGRES_DB} 108 + TB_KAFKA_SERVERS: kafka:9092
  109 + env_file:
  110 + - tb-http-transport.env
  111 + depends_on:
  112 + - kafka
  113 + tb-http-transport2:
  114 + restart: always
  115 + image: "${DOCKER_REPO}/${HTTP_TRANSPORT_DOCKER_NAME}:${TB_VERSION}"
  116 + ports:
  117 + - "8081"
  118 + environment:
  119 + TB_KAFKA_SERVERS: kafka:9092
  120 + env_file:
  121 + - tb-http-transport.env
  122 + depends_on:
  123 + - kafka
  124 + tb-coap-transport:
  125 + restart: always
  126 + image: "${DOCKER_REPO}/${COAP_TRANSPORT_DOCKER_NAME}:${TB_VERSION}"
  127 + ports:
  128 + - "5683:5683/udp"
  129 + environment:
  130 + TB_KAFKA_SERVERS: kafka:9092
  131 + env_file:
  132 + - tb-coap-transport.env
  133 + depends_on:
  134 + - kafka
  135 + tb-web-ui1:
  136 + restart: always
  137 + image: "${DOCKER_REPO}/${WEB_UI_DOCKER_NAME}:${TB_VERSION}"
  138 + ports:
  139 + - "8080"
  140 + environment:
  141 + TB_HOST: tb
  142 + TB_PORT: 8080
  143 + env_file:
  144 + - tb-web-ui.env
  145 + tb-web-ui2:
  146 + restart: always
  147 + image: "${DOCKER_REPO}/${WEB_UI_DOCKER_NAME}:${TB_VERSION}"
  148 + ports:
  149 + - "8080"
  150 + environment:
  151 + TB_HOST: tb
  152 + TB_PORT: 8080
  153 + env_file:
  154 + - tb-web-ui.env
  155 + web:
  156 + restart: always
  157 + container_name: haproxy-certbot
  158 + image: nmarus/haproxy-certbot
52 volumes: 159 volumes:
53 - - "${POSTGRES_DATA_DIR}:/var/lib/postgresql/data" 160 + - ./haproxy/config:/config
  161 + - ./haproxy/letsencrypt:/etc/letsencrypt
  162 + - ./haproxy/certs.d:/usr/local/etc/haproxy/certs.d
  163 + ports:
  164 + - "80:80"
  165 + - "443:443"
  166 + - "1883:1883"
  167 + - "9999:9999"
  168 + cap_add:
  169 + - NET_ADMIN
  170 + environment:
  171 + HTTP_PORT: 80
  172 + HTTPS_PORT: 443
  173 + MQTT_PORT: 1883
  174 + links:
  175 + - tb-web-ui1
  176 + - tb-web-ui2
  177 + - tb-mqtt-transport1
  178 + - tb-mqtt-transport2
  179 + - tb-http-transport1
  180 + - tb-http-transport2
docker/docker-install-tb.sh renamed from msa/docker/docker-install-tb.sh
@@ -39,6 +39,18 @@ else @@ -39,6 +39,18 @@ else
39 loadDemo=false 39 loadDemo=false
40 fi 40 fi
41 41
42 -docker-compose run --no-deps --rm -e INSTALL_TB=true -e LOAD_DEMO=${loadDemo} tb 42 +set -e
  43 +
  44 +source compose-utils.sh
  45 +
  46 +ADDITIONAL_COMPOSE_ARGS=$(additionalComposeArgs) || exit $?
  47 +
  48 +ADDITIONAL_STARTUP_SERVICES=$(additionalStartupServices) || exit $?
  49 +
  50 +if [ ! -z "${ADDITIONAL_STARTUP_SERVICES// }" ]; then
  51 + docker-compose -f docker-compose.yml $ADDITIONAL_COMPOSE_ARGS up -d $ADDITIONAL_STARTUP_SERVICES
  52 +fi
  53 +
  54 +docker-compose -f docker-compose.yml $ADDITIONAL_COMPOSE_ARGS run --no-deps --rm -e INSTALL_TB=true -e LOAD_DEMO=${loadDemo} tb
43 55
44 56
docker/docker-remove-services.sh renamed from docker/cassandra-setup/Dockerfile 100644 → 100755
  1 +#!/bin/bash
1 # 2 #
2 # Copyright © 2016-2018 The Thingsboard Authors 3 # Copyright © 2016-2018 The Thingsboard Authors
3 # 4 #
@@ -14,11 +15,10 @@ @@ -14,11 +15,10 @@
14 # limitations under the License. 15 # limitations under the License.
15 # 16 #
16 17
17 -FROM openjdk:8-jre 18 +set -e
18 19
19 -ADD install.sh /install.sh  
20 -ADD thingsboard.deb /thingsboard.deb 20 +source compose-utils.sh
21 21
22 -RUN apt-get update \  
23 - && apt-get install -y nmap \  
24 - && chmod +x /install.sh 22 +ADDITIONAL_COMPOSE_ARGS=$(additionalComposeArgs) || exit $?
  23 +
  24 +docker-compose -f docker-compose.yml $ADDITIONAL_COMPOSE_ARGS down -v
docker/docker-start-services.sh renamed from docker/cassandra-upgrade/upgrade.sh
@@ -15,14 +15,12 @@ @@ -15,14 +15,12 @@
15 # limitations under the License. 15 # limitations under the License.
16 # 16 #
17 17
  18 +./check-dirs.sh
18 19
19 -dpkg -i /thingsboard.deb 20 +set -e
20 21
21 -until nmap $CASSANDRA_HOST -p $CASSANDRA_PORT | grep "$CASSANDRA_PORT/tcp open"  
22 -do  
23 - echo "Wait for cassandra db to start..."  
24 - sleep 10  
25 -done 22 +source compose-utils.sh
26 23
27 -echo "Upgrading 'Thingsboard' schema..."  
28 -/usr/share/thingsboard/bin/install/upgrade.sh --fromVersion=$UPGRADE_FROM_VERSION 24 +ADDITIONAL_COMPOSE_ARGS=$(additionalComposeArgs) || exit $?
  25 +
  26 +docker-compose -f docker-compose.yml $ADDITIONAL_COMPOSE_ARGS up -d
docker/docker-stop-services.sh renamed from docker/cassandra-upgrade/Dockerfile 100644 → 100755
  1 +#!/bin/bash
1 # 2 #
2 # Copyright © 2016-2018 The Thingsboard Authors 3 # Copyright © 2016-2018 The Thingsboard Authors
3 # 4 #
@@ -14,11 +15,10 @@ @@ -14,11 +15,10 @@
14 # limitations under the License. 15 # limitations under the License.
15 # 16 #
16 17
17 -FROM openjdk:8-jre 18 +set -e
18 19
19 -ADD upgrade.sh /upgrade.sh  
20 -ADD thingsboard.deb /thingsboard.deb 20 +source compose-utils.sh
21 21
22 -RUN apt-get update \  
23 - && apt-get install -y nmap \  
24 - && chmod +x /upgrade.sh 22 +ADDITIONAL_COMPOSE_ARGS=$(additionalComposeArgs) || exit $?
  23 +
  24 +docker-compose -f docker-compose.yml $ADDITIONAL_COMPOSE_ARGS stop
docker/docker-update-service.sh renamed from docker/tb/Dockerfile 100644 → 100755
  1 +#!/bin/bash
1 # 2 #
2 # Copyright © 2016-2018 The Thingsboard Authors 3 # Copyright © 2016-2018 The Thingsboard Authors
3 # 4 #
@@ -14,13 +15,11 @@ @@ -14,13 +15,11 @@
14 # limitations under the License. 15 # limitations under the License.
15 # 16 #
16 17
17 -FROM openjdk:8-jre 18 +set -e
18 19
19 -ADD run-application.sh /run-application.sh  
20 -ADD thingsboard.deb /thingsboard.deb 20 +source compose-utils.sh
21 21
22 -RUN apt-get update \  
23 - && apt-get install --no-install-recommends -y nmap \  
24 - && apt-get clean \  
25 - && rm -r /var/lib/apt/lists/* \  
26 - && chmod +x /run-application.sh 22 +ADDITIONAL_COMPOSE_ARGS=$(additionalComposeArgs) || exit $?
  23 +
  24 +docker-compose -f docker-compose.yml $ADDITIONAL_COMPOSE_ARGS pull $@
  25 +docker-compose -f docker-compose.yml $ADDITIONAL_COMPOSE_ARGS up -d --no-deps --build $@
docker/docker-upgrade-tb.sh renamed from msa/docker/docker-upgrade-tb.sh
@@ -38,4 +38,16 @@ else @@ -38,4 +38,16 @@ else
38 fromVersion="${FROM_VERSION// }" 38 fromVersion="${FROM_VERSION// }"
39 fi 39 fi
40 40
41 -docker-compose run --no-deps --rm -e UPGRADE_TB=true -e FROM_VERSION=${fromVersion} tb 41 +set -e
  42 +
  43 +source compose-utils.sh
  44 +
  45 +ADDITIONAL_COMPOSE_ARGS=$(additionalComposeArgs) || exit $?
  46 +
  47 +ADDITIONAL_STARTUP_SERVICES=$(additionalStartupServices) || exit $?
  48 +
  49 +if [ ! -z "${ADDITIONAL_STARTUP_SERVICES// }" ]; then
  50 + docker-compose -f docker-compose.yml $ADDITIONAL_COMPOSE_ARGS up -d $ADDITIONAL_STARTUP_SERVICES
  51 +fi
  52 +
  53 +docker-compose -f docker-compose.yml $ADDITIONAL_COMPOSE_ARGS run --no-deps --rm -e UPGRADE_TB=true -e FROM_VERSION=${fromVersion} tb
docker/haproxy/config/haproxy.cfg renamed from msa/docker/haproxy/config/haproxy.cfg
1 -#  
2 -# Copyright © 2016-2018 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: cassandra-setup  
21 -spec:  
22 - containers:  
23 - - name: cassandra-setup  
24 - imagePullPolicy: Always  
25 - image: thingsboard/cassandra-setup:2.1.0  
26 - env:  
27 - - name: ADD_DEMO_DATA  
28 - value: "true"  
29 - - name : CASSANDRA_HOST  
30 - value: "cassandra-headless"  
31 - - name : CASSANDRA_PORT  
32 - value: "9042"  
33 - - name : DATABASE_ENTITIES_TYPE  
34 - value: "cassandra"  
35 - - name : DATABASE_TS_TYPE  
36 - value: "cassandra"  
37 - - name : CASSANDRA_URL  
38 - value: "cassandra-headless:9042"  
39 - command:  
40 - - sh  
41 - - -c  
42 - - /install.sh  
43 - restartPolicy: Never  
1 -#  
2 -# Copyright © 2016-2018 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: cassandra-upgrade  
21 -spec:  
22 - containers:  
23 - - name: cassandra-upgrade  
24 - imagePullPolicy: Always  
25 - image: thingsboard/cassandra-upgrade:2.1.0  
26 - env:  
27 - - name: ADD_DEMO_DATA  
28 - value: "true"  
29 - - name : CASSANDRA_HOST  
30 - value: "cassandra-headless"  
31 - - name : CASSANDRA_PORT  
32 - value: "9042"  
33 - - name : DATABASE_ENTITIES_TYPE  
34 - value: "cassandra"  
35 - - name : DATABASE_TS_TYPE  
36 - value: "cassandra"  
37 - - name : CASSANDRA_URL  
38 - value: "cassandra-headless:9042"  
39 - - name : UPGRADE_FROM_VERSION  
40 - value: "1.4.0"  
41 - command:  
42 - - sh  
43 - - -c  
44 - - /upgrade.sh  
45 - restartPolicy: Never  
1 -#  
2 -# Copyright © 2016-2018 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: Service  
19 -metadata:  
20 - name: cassandra-headless  
21 - labels:  
22 - app: cassandra-headless  
23 -spec:  
24 - ports:  
25 - - port: 9042  
26 - name: cql  
27 - clusterIP: None  
28 - selector:  
29 - app: cassandra  
30 ----  
31 -apiVersion: "apps/v1beta1"  
32 -kind: StatefulSet  
33 -metadata:  
34 - name: cassandra  
35 -spec:  
36 - serviceName: cassandra-headless  
37 - replicas: 2  
38 - template:  
39 - metadata:  
40 - labels:  
41 - app: cassandra  
42 - spec:  
43 - nodeSelector:  
44 - machinetype: other  
45 - affinity:  
46 - podAntiAffinity:  
47 - requiredDuringSchedulingIgnoredDuringExecution:  
48 - - labelSelector:  
49 - matchExpressions:  
50 - - key: "app"  
51 - operator: In  
52 - values:  
53 - - cassandra-headless  
54 - topologyKey: "kubernetes.io/hostname"  
55 - containers:  
56 - - name: cassandra  
57 - image: thingsboard/cassandra:2.1.0  
58 - imagePullPolicy: Always  
59 - ports:  
60 - - containerPort: 7000  
61 - name: intra-node  
62 - - containerPort: 7001  
63 - name: tls-intra-node  
64 - - containerPort: 7199  
65 - name: jmx  
66 - - containerPort: 9042  
67 - name: cql  
68 - - containerPort: 9160  
69 - name: thrift  
70 - securityContext:  
71 - capabilities:  
72 - add:  
73 - - IPC_LOCK  
74 - lifecycle:  
75 - preStop:  
76 - exec:  
77 - command: ["/bin/sh", "-c", "PID=$(pidof java) && kill $PID && while ps -p $PID > /dev/null; do sleep 1; done"]  
78 - env:  
79 - - name: MAX_HEAP_SIZE  
80 - value: 2048M  
81 - - name: HEAP_NEWSIZE  
82 - value: 100M  
83 - - name: CASSANDRA_SEEDS  
84 - value: "cassandra-0.cassandra-headless.default.svc.cluster.local"  
85 - - name: CASSANDRA_CLUSTER_NAME  
86 - value: "Thingsboard-Cluster"  
87 - - name: CASSANDRA_DC  
88 - value: "DC1-Thingsboard-Cluster"  
89 - - name: CASSANDRA_RACK  
90 - value: "Rack-Thingsboard-Cluster"  
91 - - name: CASSANDRA_AUTO_BOOTSTRAP  
92 - value: "false"  
93 - - name: POD_IP  
94 - valueFrom:  
95 - fieldRef:  
96 - fieldPath: status.podIP  
97 - - name: POD_NAMESPACE  
98 - valueFrom:  
99 - fieldRef:  
100 - fieldPath: metadata.namespace  
101 - readinessProbe:  
102 - exec:  
103 - command:  
104 - - /bin/bash  
105 - - -c  
106 - - /ready-probe.sh  
107 - initialDelaySeconds: 15  
108 - timeoutSeconds: 5  
109 - volumeMounts:  
110 - - name: cassandra-data  
111 - mountPath: /var/lib/cassandra/data  
112 - - name: cassandra-commitlog  
113 - mountPath: /var/lib/cassandra/commitlog  
114 - volumeClaimTemplates:  
115 - - metadata:  
116 - name: cassandra-data  
117 - annotations:  
118 - volume.beta.kubernetes.io/storage-class: fast  
119 - spec:  
120 - accessModes: [ "ReadWriteOnce" ]  
121 - resources:  
122 - requests:  
123 - storage: 3Gi  
124 - - metadata:  
125 - name: cassandra-commitlog  
126 - annotations:  
127 - volume.beta.kubernetes.io/storage-class: fast  
128 - spec:  
129 - accessModes: [ "ReadWriteOnce" ]  
130 - resources:  
131 - requests:  
132 - storage: 2Gi  
1 -#  
2 -# Copyright © 2016-2018 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 ----  
18 -apiVersion: storage.k8s.io/v1beta1  
19 -kind: StorageClass  
20 -metadata:  
21 - name: slow  
22 -provisioner: kubernetes.io/gce-pd  
23 -parameters:  
24 - type: pd-standard  
25 ----  
26 -apiVersion: storage.k8s.io/v1beta1  
27 -kind: StorageClass  
28 -metadata:  
29 - name: fast  
30 -provisioner: kubernetes.io/gce-pd  
31 -parameters:  
32 - type: pd-ssd  
33 ----  
1 -#  
2 -# Copyright © 2016-2018 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 ----  
18 -apiVersion: v1  
19 -kind: Service  
20 -metadata:  
21 - labels:  
22 - name: redis-service  
23 - name: redis-service  
24 -spec:  
25 - ports:  
26 - - name: redis-service  
27 - protocol: TCP  
28 - port: 6379  
29 - targetPort: 6379  
30 - selector:  
31 - app: redis  
32 ----  
33 -apiVersion: v1  
34 -kind: ConfigMap  
35 -metadata:  
36 - name: redis-conf  
37 -data:  
38 - redis.conf: |  
39 - appendonly yes  
40 - protected-mode no  
41 - bind 0.0.0.0  
42 - port 6379  
43 - dir /var/lib/redis  
44 ----  
45 -apiVersion: apps/v1beta1  
46 -kind: StatefulSet  
47 -metadata:  
48 - name: redis  
49 -spec:  
50 - serviceName: redis-service  
51 - replicas: 1  
52 - template:  
53 - metadata:  
54 - labels:  
55 - app: redis  
56 - spec:  
57 - terminationGracePeriodSeconds: 10  
58 - containers:  
59 - - name: redis  
60 - image: redis:4.0.9  
61 - command:  
62 - - redis-server  
63 - args:  
64 - - /etc/redis/redis.conf  
65 - resources:  
66 - requests:  
67 - cpu: 100m  
68 - memory: 100Mi  
69 - ports:  
70 - - containerPort: 6379  
71 - name: redis  
72 - volumeMounts:  
73 - - name: redis-data  
74 - mountPath: /var/lib/redis  
75 - - name: redis-conf  
76 - mountPath: /etc/redis  
77 - volumes:  
78 - - name: redis-conf  
79 - configMap:  
80 - name: redis-conf  
81 - items:  
82 - - key: redis.conf  
83 - path: redis.conf  
84 - volumeClaimTemplates:  
85 - - metadata:  
86 - name: redis-data  
87 - annotations:  
88 - volume.beta.kubernetes.io/storage-class: fast  
89 - spec:  
90 - accessModes: [ "ReadWriteOnce" ]  
91 - resources:  
92 - requests:  
93 - storage: 1Gi  
1 -#  
2 -# Copyright © 2016-2018 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 ----  
18 -apiVersion: v1  
19 -kind: Service  
20 -metadata:  
21 - name: tb-service  
22 - labels:  
23 - app: tb-service  
24 -spec:  
25 - ports:  
26 - - port: 8080  
27 - name: ui  
28 - - port: 1883  
29 - name: mqtt  
30 - - port: 5683  
31 - name: coap  
32 - selector:  
33 - app: tb  
34 - type: LoadBalancer  
35 ----  
36 -apiVersion: policy/v1beta1  
37 -kind: PodDisruptionBudget  
38 -metadata:  
39 - name: tb-budget  
40 -spec:  
41 - selector:  
42 - matchLabels:  
43 - app: tb  
44 - minAvailable: 3  
45 ----  
46 -apiVersion: v1  
47 -kind: ConfigMap  
48 -metadata:  
49 - name: tb-config  
50 -data:  
51 - zookeeper.enabled: "true"  
52 - zookeeper.url: "zk-headless"  
53 - cassandra.url: "cassandra-headless:9042"  
54 - cassandra.host: "cassandra-headless"  
55 - cassandra.port: "9042"  
56 - database.type: "cassandra"  
57 - cache.type: "redis"  
58 - redis.host: "redis-service"  
59 ----  
60 -apiVersion: apps/v1beta1  
61 -kind: StatefulSet  
62 -metadata:  
63 - name: tb  
64 -spec:  
65 - serviceName: "tb-service"  
66 - replicas: 3  
67 - template:  
68 - metadata:  
69 - labels:  
70 - app: tb  
71 - spec:  
72 - nodeSelector:  
73 - machinetype: tb  
74 - affinity:  
75 - podAntiAffinity:  
76 - requiredDuringSchedulingIgnoredDuringExecution:  
77 - - labelSelector:  
78 - matchExpressions:  
79 - - key: "app"  
80 - operator: In  
81 - values:  
82 - - tb-service  
83 - topologyKey: "kubernetes.io/hostname"  
84 - containers:  
85 - - name: tb  
86 - imagePullPolicy: Always  
87 - image: thingsboard/application:2.1.0  
88 - ports:  
89 - - containerPort: 8080  
90 - name: ui  
91 - - containerPort: 1883  
92 - name: mqtt  
93 - - containerPort: 5683  
94 - name: coap  
95 - - containerPort: 9001  
96 - name: rpc  
97 - env:  
98 - - name: ZOOKEEPER_ENABLED  
99 - valueFrom:  
100 - configMapKeyRef:  
101 - name: tb-config  
102 - key: zookeeper.enabled  
103 - - name: ZOOKEEPER_URL  
104 - valueFrom:  
105 - configMapKeyRef:  
106 - name: tb-config  
107 - key: zookeeper.url  
108 - - name : CASSANDRA_HOST  
109 - valueFrom:  
110 - configMapKeyRef:  
111 - name: tb-config  
112 - key: cassandra.host  
113 - - name : CASSANDRA_PORT  
114 - valueFrom:  
115 - configMapKeyRef:  
116 - name: tb-config  
117 - key: cassandra.port  
118 - - name : CASSANDRA_URL  
119 - valueFrom:  
120 - configMapKeyRef:  
121 - name: tb-config  
122 - key: cassandra.url  
123 - - name: DATABASE_ENTITIES_TYPE  
124 - valueFrom:  
125 - configMapKeyRef:  
126 - name: tb-config  
127 - key: database.type  
128 - - name: DATABASE_TS_TYPE  
129 - valueFrom:  
130 - configMapKeyRef:  
131 - name: tb-config  
132 - key: database.type  
133 - - name : RPC_HOST  
134 - valueFrom:  
135 - fieldRef:  
136 - fieldPath: status.podIP  
137 - - name: CACHE_TYPE  
138 - valueFrom:  
139 - configMapKeyRef:  
140 - name: tb-config  
141 - key: cache.type  
142 - - name: REDIS_HOST  
143 - valueFrom:  
144 - configMapKeyRef:  
145 - name: tb-config  
146 - key: redis.host  
147 - command:  
148 - - sh  
149 - - -c  
150 - - /run-application.sh  
151 - livenessProbe:  
152 - httpGet:  
153 - path: /login  
154 - port: ui-port  
155 - initialDelaySeconds: 120  
156 - timeoutSeconds: 10  
1 -#  
2 -# Copyright © 2016-2018 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: Service  
19 -metadata:  
20 - name: zk-headless  
21 - labels:  
22 - app: zk-headless  
23 -spec:  
24 - ports:  
25 - - port: 2888  
26 - name: server  
27 - - port: 3888  
28 - name: leader-election  
29 - clusterIP: None  
30 - selector:  
31 - app: zk  
32 ----  
33 -apiVersion: v1  
34 -kind: ConfigMap  
35 -metadata:  
36 - name: zk-config  
37 -data:  
38 - ensemble: "zk-0;zk-1;zk-2"  
39 - replicas: "3"  
40 - jvm.heap: "500m"  
41 - tick: "2000"  
42 - init: "10"  
43 - sync: "5"  
44 - client.cnxns: "60"  
45 - snap.retain: "3"  
46 - purge.interval: "1"  
47 - client.port: "2181"  
48 - server.port: "2888"  
49 - election.port: "3888"  
50 ----  
51 -apiVersion: policy/v1beta1  
52 -kind: PodDisruptionBudget  
53 -metadata:  
54 - name: zk-budget  
55 -spec:  
56 - selector:  
57 - matchLabels:  
58 - app: zk  
59 - minAvailable: 3  
60 ----  
61 -apiVersion: apps/v1beta1  
62 -kind: StatefulSet  
63 -metadata:  
64 - name: zk  
65 -spec:  
66 - serviceName: zk-headless  
67 - replicas: 3  
68 - template:  
69 - metadata:  
70 - labels:  
71 - app: zk  
72 - annotations:  
73 - pod.alpha.kubernetes.io/initialized: "true"  
74 - spec:  
75 - nodeSelector:  
76 - machinetype: other  
77 - affinity:  
78 - podAntiAffinity:  
79 - requiredDuringSchedulingIgnoredDuringExecution:  
80 - - labelSelector:  
81 - matchExpressions:  
82 - - key: "app"  
83 - operator: In  
84 - values:  
85 - - zk-headless  
86 - topologyKey: "kubernetes.io/hostname"  
87 - containers:  
88 - - name: zk  
89 - imagePullPolicy: Always  
90 - image: thingsboard/zk:2.1.0  
91 - ports:  
92 - - containerPort: 2181  
93 - name: client  
94 - - containerPort: 2888  
95 - name: server  
96 - - containerPort: 3888  
97 - name: leader-election  
98 - env:  
99 - - name : ZK_ENSEMBLE  
100 - valueFrom:  
101 - configMapKeyRef:  
102 - name: zk-config  
103 - key: ensemble  
104 - - name : ZK_REPLICAS  
105 - valueFrom:  
106 - configMapKeyRef:  
107 - name: zk-config  
108 - key: replicas  
109 - - name : ZK_HEAP_SIZE  
110 - valueFrom:  
111 - configMapKeyRef:  
112 - name: zk-config  
113 - key: jvm.heap  
114 - - name : ZK_TICK_TIME  
115 - valueFrom:  
116 - configMapKeyRef:  
117 - name: zk-config  
118 - key: tick  
119 - - name : ZK_INIT_LIMIT  
120 - valueFrom:  
121 - configMapKeyRef:  
122 - name: zk-config  
123 - key: init  
124 - - name : ZK_SYNC_LIMIT  
125 - valueFrom:  
126 - configMapKeyRef:  
127 - name: zk-config  
128 - key: tick  
129 - - name : ZK_MAX_CLIENT_CNXNS  
130 - valueFrom:  
131 - configMapKeyRef:  
132 - name: zk-config  
133 - key: client.cnxns  
134 - - name: ZK_SNAP_RETAIN_COUNT  
135 - valueFrom:  
136 - configMapKeyRef:  
137 - name: zk-config  
138 - key: snap.retain  
139 - - name: ZK_PURGE_INTERVAL  
140 - valueFrom:  
141 - configMapKeyRef:  
142 - name: zk-config  
143 - key: purge.interval  
144 - - name: ZK_CLIENT_PORT  
145 - valueFrom:  
146 - configMapKeyRef:  
147 - name: zk-config  
148 - key: client.port  
149 - - name: ZK_SERVER_PORT  
150 - valueFrom:  
151 - configMapKeyRef:  
152 - name: zk-config  
153 - key: server.port  
154 - - name: ZK_ELECTION_PORT  
155 - valueFrom:  
156 - configMapKeyRef:  
157 - name: zk-config  
158 - key: election.port  
159 - command:  
160 - - sh  
161 - - -c  
162 - - zk-gen-config.sh && zkServer.sh start-foreground  
163 - readinessProbe:  
164 - exec:  
165 - command:  
166 - - "zk-ok.sh"  
167 - initialDelaySeconds: 15  
168 - timeoutSeconds: 5  
169 - livenessProbe:  
170 - exec:  
171 - command:  
172 - - "zk-ok.sh"  
173 - initialDelaySeconds: 15  
174 - timeoutSeconds: 5  
175 - volumeMounts:  
176 - - name: zkdatadir  
177 - mountPath: /var/lib/zookeeper  
178 - securityContext:  
179 - runAsUser: 1000  
180 - fsGroup: 1000  
181 - volumeClaimTemplates:  
182 - - metadata:  
183 - name: zkdatadir  
184 - annotations:  
185 - volume.beta.kubernetes.io/storage-class: slow  
186 - spec:  
187 - accessModes: [ "ReadWriteOnce" ]  
188 - resources:  
189 - requests:  
190 - storage: 1Gi  
docker/tb-coap-transport.env renamed from msa/docker/tb-coap-transport.env
docker/tb-http-transport.env renamed from msa/docker/tb-http-transport.env
docker/tb-js-executor.env renamed from msa/docker/tb-js-executor.env
docker/tb-mqtt-transport.env renamed from msa/docker/tb-mqtt-transport.env
  1 +# ThingsBoard server configuration
  2 +
  3 +TRANSPORT_TYPE=remote
docker/tb-node/conf/logback.xml renamed from msa/docker/tb-node/conf/logback.xml
docker/tb-node/conf/thingsboard.conf renamed from msa/docker/tb-node/conf/thingsboard.conf
docker/tb-web-ui.env renamed from msa/docker/tb-web-ui.env
1 -#Thingsboard server configuration  
2 -MQTT_BIND_ADDRESS=0.0.0.0  
3 -MQTT_BIND_PORT=1883  
4 -COAP_BIND_ADDRESS=0.0.0.0  
5 -COAP_BIND_PORT=5683  
6 -  
7 -# zk config  
8 -ZOOKEEPER_URL=zk:2181  
9 -  
10 -# type of database to use: sql[DEFAULT] or cassandra  
11 -DATABASE_TS_TYPE=sql  
12 -DATABASE_ENTITIES_TYPE=sql  
13 -  
14 -# cassandra db config  
15 -CASSANDRA_URL=cassandra:9042  
16 -CASSANDRA_HOST=cassandra  
17 -CASSANDRA_PORT=9042  
18 -  
19 -# postgres db config  
20 -POSTGRES_HOST=postgres  
21 -POSTGRES_PORT=5432  
22 -# SPRING_JPA_DATABASE_PLATFORM=org.hibernate.dialect.PostgreSQLDialect  
23 -# SPRING_DRIVER_CLASS_NAME=org.postgresql.Driver  
24 -# SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/thingsboard  
25 -# SPRING_DATASOURCE_USERNAME=postgres  
26 -# SPRING_DATASOURCE_PASSWORD=postgres  
1 -VERSION=2.1.0  
2 -PROJECT=thingsboard  
3 -APP=application  
4 -  
5 -build:  
6 - cp ../../application/target/thingsboard.deb .  
7 - docker build --pull -t ${PROJECT}/${APP}:${VERSION} -t ${PROJECT}/${APP}:latest .  
8 - rm thingsboard.deb  
9 -  
10 -push: build  
11 - docker push ${PROJECT}/${APP}:${VERSION}  
12 - docker push ${PROJECT}/${APP}:latest  
1 -#!/bin/bash  
2 -#  
3 -# Copyright © 2016-2018 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 -  
19 -dpkg -i /thingsboard.deb  
20 -  
21 -# Copying env variables into conf files  
22 -printenv | awk -F "=" '{print "export " $1 "='\''" $2 "'\''"}' >> /usr/share/thingsboard/conf/thingsboard.conf  
23 -  
24 -cat /usr/share/thingsboard/conf/thingsboard.conf  
25 -  
26 -if [ "$DATABASE_ENTITIES_TYPE" == "cassandra" ]; then  
27 - until nmap $CASSANDRA_HOST -p $CASSANDRA_PORT | grep "$CASSANDRA_PORT/tcp open\|filtered"  
28 - do  
29 - echo "Wait for cassandra db to start..."  
30 - sleep 10  
31 - done  
32 -fi  
33 -  
34 -if [ "$DATABASE_ENTITIES_TYPE" == "sql" ]; then  
35 - if [ "$SPRING_DRIVER_CLASS_NAME" == "org.postgresql.Driver" ]; then  
36 - until nmap $POSTGRES_HOST -p $POSTGRES_PORT | grep "$POSTGRES_PORT/tcp open"  
37 - do  
38 - echo "Waiting for postgres db to start..."  
39 - sleep 10  
40 - done  
41 - fi  
42 -fi  
43 -  
44 -if [ "$ADD_SCHEMA_AND_SYSTEM_DATA" == "true" ]; then  
45 - echo "Creating 'Thingsboard' schema and system data..."  
46 - if [ "$ADD_DEMO_DATA" == "true" ]; then  
47 - echo "plus demo data..."  
48 - /usr/share/thingsboard/bin/install/install.sh --loadDemo  
49 - elif [ "$ADD_DEMO_DATA" == "false" ]; then  
50 - /usr/share/thingsboard/bin/install/install.sh  
51 - fi  
52 -fi  
53 -  
54 -echo "Starting 'Thingsboard' service..."  
55 -service thingsboard start  
56 -  
57 -# Wait until log file is created  
58 -sleep 10  
59 -tail -f /var/log/thingsboard/thingsboard.log  
1 -#  
2 -# Copyright © 2016-2018 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 -FROM ubuntu:16.04  
18 -ENV ZK_USER=zookeeper \  
19 -ZK_DATA_DIR=/var/lib/zookeeper/data \  
20 -ZK_DATA_LOG_DIR=/var/lib/zookeeper/log \  
21 -ZK_LOG_DIR=/var/log/zookeeper \  
22 -JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64  
23 -  
24 -ARG GPG_KEY=C823E3E5B12AF29C67F81976F5CECB3CB5E9BD2D  
25 -ARG ZK_DIST=zookeeper-3.4.10  
26 -RUN set -x \  
27 - && apt-get update \  
28 - && apt-get install -y openjdk-8-jre-headless wget netcat-openbsd \  
29 - && wget -q "http://www.apache.org/dist/zookeeper/$ZK_DIST/$ZK_DIST.tar.gz" \  
30 - && wget -q "http://www.apache.org/dist/zookeeper/$ZK_DIST/$ZK_DIST.tar.gz.asc" \  
31 - && export GNUPGHOME="$(mktemp -d)" \  
32 - && gpg --keyserver ha.pool.sks-keyservers.net --recv-key "$GPG_KEY" \  
33 - && gpg --batch --verify "$ZK_DIST.tar.gz.asc" "$ZK_DIST.tar.gz" \  
34 - && tar -xzf "$ZK_DIST.tar.gz" -C /opt \  
35 - && rm -r "$GNUPGHOME" "$ZK_DIST.tar.gz" "$ZK_DIST.tar.gz.asc" \  
36 - && ln -s /opt/$ZK_DIST /opt/zookeeper \  
37 - && rm -rf /opt/zookeeper/CHANGES.txt \  
38 - /opt/zookeeper/README.txt \  
39 - /opt/zookeeper/NOTICE.txt \  
40 - /opt/zookeeper/CHANGES.txt \  
41 - /opt/zookeeper/README_packaging.txt \  
42 - /opt/zookeeper/build.xml \  
43 - /opt/zookeeper/config \  
44 - /opt/zookeeper/contrib \  
45 - /opt/zookeeper/dist-maven \  
46 - /opt/zookeeper/docs \  
47 - /opt/zookeeper/ivy.xml \  
48 - /opt/zookeeper/ivysettings.xml \  
49 - /opt/zookeeper/recipes \  
50 - /opt/zookeeper/src \  
51 - /opt/zookeeper/$ZK_DIST.jar.asc \  
52 - /opt/zookeeper/$ZK_DIST.jar.md5 \  
53 - /opt/zookeeper/$ZK_DIST.jar.sha1 \  
54 - && apt-get autoremove -y wget \  
55 - && rm -rf /var/lib/apt/lists/*  
56 -  
57 -#Copy configuration generator script to bin  
58 -COPY zk-gen-config.sh zk-ok.sh /opt/zookeeper/bin/  
59 -  
60 -# Create a user for the zookeeper process and configure file system ownership  
61 -# for nessecary directories and symlink the distribution as a user executable  
62 -RUN set -x \  
63 - && useradd $ZK_USER \  
64 - && [ `id -u $ZK_USER` -eq 1000 ] \  
65 - && [ `id -g $ZK_USER` -eq 1000 ] \  
66 - && mkdir -p $ZK_DATA_DIR $ZK_DATA_LOG_DIR $ZK_LOG_DIR /usr/share/zookeeper /tmp/zookeeper /usr/etc/ \  
67 - && chown -R "$ZK_USER:$ZK_USER" /opt/$ZK_DIST $ZK_DATA_DIR $ZK_LOG_DIR $ZK_DATA_LOG_DIR /tmp/zookeeper \  
68 - && ln -s /opt/zookeeper/conf/ /usr/etc/zookeeper \  
69 - && ln -s /opt/zookeeper/bin/* /usr/bin \  
70 - && ln -s /opt/zookeeper/$ZK_DIST.jar /usr/share/zookeeper/ \  
71 - && ln -s /opt/zookeeper/lib/* /usr/share/zookeeper  
1 -VERSION=2.1.0  
2 -PROJECT=thingsboard  
3 -APP=zk  
4 -  
5 -build:  
6 - docker build --pull -t ${PROJECT}/${APP}:${VERSION} -t ${PROJECT}/${APP}:latest .  
7 -  
8 -push: build  
9 - docker push ${PROJECT}/${APP}:${VERSION}  
10 - docker push ${PROJECT}/${APP}:latest  
1 -#!/usr/bin/env bash  
2 -#  
3 -# Copyright © 2016-2018 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 -ZK_USER=${ZK_USER:-"zookeeper"}  
19 -ZK_LOG_LEVEL=${ZK_LOG_LEVEL:-"INFO"}  
20 -ZK_DATA_DIR=${ZK_DATA_DIR:-"/var/lib/zookeeper/data"}  
21 -ZK_DATA_LOG_DIR=${ZK_DATA_LOG_DIR:-"/var/lib/zookeeper/log"}  
22 -ZK_LOG_DIR=${ZK_LOG_DIR:-"var/log/zookeeper"}  
23 -ZK_CONF_DIR=${ZK_CONF_DIR:-"/opt/zookeeper/conf"}  
24 -ZK_CLIENT_PORT=${ZK_CLIENT_PORT:-2181}  
25 -ZK_SERVER_PORT=${ZK_SERVER_PORT:-2888}  
26 -ZK_ELECTION_PORT=${ZK_ELECTION_PORT:-3888}  
27 -ZK_TICK_TIME=${ZK_TICK_TIME:-2000}  
28 -ZK_INIT_LIMIT=${ZK_INIT_LIMIT:-10}  
29 -ZK_SYNC_LIMIT=${ZK_SYNC_LIMIT:-5}  
30 -ZK_HEAP_SIZE=${ZK_HEAP_SIZE:-2G}  
31 -ZK_MAX_CLIENT_CNXNS=${ZK_MAX_CLIENT_CNXNS:-60}  
32 -ZK_MIN_SESSION_TIMEOUT=${ZK_MIN_SESSION_TIMEOUT:- $((ZK_TICK_TIME*2))}  
33 -ZK_MAX_SESSION_TIMEOUT=${ZK_MAX_SESSION_TIMEOUT:- $((ZK_TICK_TIME*20))}  
34 -ZK_SNAP_RETAIN_COUNT=${ZK_SNAP_RETAIN_COUNT:-3}  
35 -ZK_PURGE_INTERVAL=${ZK_PURGE_INTERVAL:-0}  
36 -ID_FILE="$ZK_DATA_DIR/myid"  
37 -ZK_CONFIG_FILE="$ZK_CONF_DIR/zoo.cfg"  
38 -LOGGER_PROPS_FILE="$ZK_CONF_DIR/log4j.properties"  
39 -JAVA_ENV_FILE="$ZK_CONF_DIR/java.env"  
40 -HOST=`hostname -s`  
41 -DOMAIN=`hostname -d`  
42 -  
43 -function print_servers() {  
44 - for (( i=1; i<=$ZK_REPLICAS; i++ ))  
45 - do  
46 - echo "server.$i=$NAME-$((i-1)).$DOMAIN:$ZK_SERVER_PORT:$ZK_ELECTION_PORT"  
47 - done  
48 -}  
49 -  
50 -function validate_env() {  
51 - echo "Validating environment"  
52 - if [ -z $ZK_REPLICAS ]; then  
53 - echo "ZK_REPLICAS is a mandatory environment variable"  
54 - exit 1  
55 - fi  
56 -  
57 - if [[ $HOST =~ (.*)-([0-9]+)$ ]]; then  
58 - NAME=${BASH_REMATCH[1]}  
59 - ORD=${BASH_REMATCH[2]}  
60 - else  
61 - echo "Failed to extract ordinal from hostname $HOST"  
62 - exit 1  
63 - fi  
64 - MY_ID=$((ORD+1))  
65 - echo "ZK_REPLICAS=$ZK_REPLICAS"  
66 - echo "MY_ID=$MY_ID"  
67 - echo "ZK_LOG_LEVEL=$ZK_LOG_LEVEL"  
68 - echo "ZK_DATA_DIR=$ZK_DATA_DIR"  
69 - echo "ZK_DATA_LOG_DIR=$ZK_DATA_LOG_DIR"  
70 - echo "ZK_LOG_DIR=$ZK_LOG_DIR"  
71 - echo "ZK_CLIENT_PORT=$ZK_CLIENT_PORT"  
72 - echo "ZK_SERVER_PORT=$ZK_SERVER_PORT"  
73 - echo "ZK_ELECTION_PORT=$ZK_ELECTION_PORT"  
74 - echo "ZK_TICK_TIME=$ZK_TICK_TIME"  
75 - echo "ZK_INIT_LIMIT=$ZK_INIT_LIMIT"  
76 - echo "ZK_SYNC_LIMIT=$ZK_SYNC_LIMIT"  
77 - echo "ZK_MAX_CLIENT_CNXNS=$ZK_MAX_CLIENT_CNXNS"  
78 - echo "ZK_MIN_SESSION_TIMEOUT=$ZK_MIN_SESSION_TIMEOUT"  
79 - echo "ZK_MAX_SESSION_TIMEOUT=$ZK_MAX_SESSION_TIMEOUT"  
80 - echo "ZK_HEAP_SIZE=$ZK_HEAP_SIZE"  
81 - echo "ZK_SNAP_RETAIN_COUNT=$ZK_SNAP_RETAIN_COUNT"  
82 - echo "ZK_PURGE_INTERVAL=$ZK_PURGE_INTERVAL"  
83 - echo "ENSEMBLE"  
84 - print_servers  
85 - echo "Environment validation successful"  
86 -}  
87 -  
88 -function create_config() {  
89 - rm -f $ZK_CONFIG_FILE  
90 - echo "Creating ZooKeeper configuration"  
91 - echo "#This file was autogenerated by zk DO NOT EDIT" >> $ZK_CONFIG_FILE  
92 - echo "clientPort=$ZK_CLIENT_PORT" >> $ZK_CONFIG_FILE  
93 - echo "dataDir=$ZK_DATA_DIR" >> $ZK_CONFIG_FILE  
94 - echo "dataLogDir=$ZK_DATA_LOG_DIR" >> $ZK_CONFIG_FILE  
95 - echo "tickTime=$ZK_TICK_TIME" >> $ZK_CONFIG_FILE  
96 - echo "initLimit=$ZK_INIT_LIMIT" >> $ZK_CONFIG_FILE  
97 - echo "syncLimit=$ZK_SYNC_LIMIT" >> $ZK_CONFIG_FILE  
98 - echo "maxClientCnxns=$ZK_MAX_CLIENT_CNXNS" >> $ZK_CONFIG_FILE  
99 - echo "minSessionTimeout=$ZK_MIN_SESSION_TIMEOUT" >> $ZK_CONFIG_FILE  
100 - echo "maxSessionTimeout=$ZK_MAX_SESSION_TIMEOUT" >> $ZK_CONFIG_FILE  
101 - echo "autopurge.snapRetainCount=$ZK_SNAP_RETAIN_COUNT" >> $ZK_CONFIG_FILE  
102 - echo "autopurge.purgeInteval=$ZK_PURGE_INTERVAL" >> $ZK_CONFIG_FILE  
103 -  
104 - if [ $ZK_REPLICAS -gt 1 ]; then  
105 - print_servers >> $ZK_CONFIG_FILE  
106 - fi  
107 - echo "Wrote ZooKeeper configuration file to $ZK_CONFIG_FILE"  
108 -}  
109 -  
110 -function create_data_dirs() {  
111 - echo "Creating ZooKeeper data directories and setting permissions"  
112 - if [ ! -d $ZK_DATA_DIR ]; then  
113 - mkdir -p $ZK_DATA_DIR  
114 - chown -R $ZK_USER:$ZK_USER $ZK_DATA_DIR  
115 - fi  
116 -  
117 - if [ ! -d $ZK_DATA_LOG_DIR ]; then  
118 - mkdir -p $ZK_DATA_LOG_DIR  
119 - chown -R $ZK_USER:$ZK_USER $ZK_DATA_LOG_DIR  
120 - fi  
121 -  
122 - if [ ! -d $ZK_LOG_DIR ]; then  
123 - mkdir -p $ZK_LOG_DIR  
124 - chown -R $ZK_USER:$ZK_USER $ZK_LOG_DIR  
125 - fi  
126 - if [ ! -f $ID_FILE ]; then  
127 - echo $MY_ID >> $ID_FILE  
128 - fi  
129 - echo "Created ZooKeeper data directories and set permissions in $ZK_DATA_DIR"  
130 -}  
131 -  
132 -function create_log_props () {  
133 - rm -f $LOGGER_PROPS_FILE  
134 - echo "Creating ZooKeeper log4j configuration"  
135 - echo "zookeeper.root.logger=CONSOLE" >> $LOGGER_PROPS_FILE  
136 - echo "zookeeper.console.threshold="$ZK_LOG_LEVEL >> $LOGGER_PROPS_FILE  
137 - echo "log4j.rootLogger=\${zookeeper.root.logger}" >> $LOGGER_PROPS_FILE  
138 - echo "log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender" >> $LOGGER_PROPS_FILE  
139 - echo "log4j.appender.CONSOLE.Threshold=\${zookeeper.console.threshold}" >> $LOGGER_PROPS_FILE  
140 - echo "log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout" >> $LOGGER_PROPS_FILE  
141 - echo "log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} [myid:%X{myid}] - %-5p [%t:%C{1}@%L] - %m%n" >> $LOGGER_PROPS_FILE  
142 - echo "Wrote log4j configuration to $LOGGER_PROPS_FILE"  
143 -}  
144 -  
145 -function create_java_env() {  
146 - rm -f $JAVA_ENV_FILE  
147 - echo "Creating JVM configuration file"  
148 - echo "ZOO_LOG_DIR=$ZK_LOG_DIR" >> $JAVA_ENV_FILE  
149 - echo "JVMFLAGS=\"-Xmx$ZK_HEAP_SIZE -Xms$ZK_HEAP_SIZE\"" >> $JAVA_ENV_FILE  
150 - echo "Wrote JVM configuration to $JAVA_ENV_FILE"  
151 -}  
152 -  
153 -validate_env && create_config && create_log_props && create_data_dirs && create_java_env  
1 -  
2 -DOCKER_REPO=local-maven-build  
3 -  
4 -JS_EXECUTOR_DOCKER_NAME=tb-js-executor  
5 -TB_NODE_DOCKER_NAME=tb-node  
6 -WEB_UI_DOCKER_NAME=tb-web-ui  
7 -MQTT_TRANSPORT_DOCKER_NAME=tb-mqtt-transport  
8 -HTTP_TRANSPORT_DOCKER_NAME=tb-http-transport  
9 -COAP_TRANSPORT_DOCKER_NAME=tb-coap-transport  
10 -  
11 -TB_VERSION=2.2.0-SNAPSHOT  
12 -  
13 -KAFKA_TOPICS=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  
1 -#  
2 -# Copyright © 2016-2018 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 -  
18 -version: '2.2'  
19 -  
20 -services:  
21 - zookeeper:  
22 - restart: always  
23 - image: "wurstmeister/zookeeper"  
24 - ports:  
25 - - "2181"  
26 - kafka:  
27 - restart: always  
28 - image: "wurstmeister/kafka"  
29 - ports:  
30 - - "9092:9092"  
31 - environment:  
32 - KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181  
33 - KAFKA_LISTENERS: INSIDE://:9093,OUTSIDE://:9092  
34 - KAFKA_ADVERTISED_LISTENERS: INSIDE://:9093,OUTSIDE://kafka:9092  
35 - KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT  
36 - KAFKA_INTER_BROKER_LISTENER_NAME: INSIDE  
37 - KAFKA_CREATE_TOPICS: "${KAFKA_TOPICS}"  
38 - KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'false'  
39 - KAFKA_LOG_RETENTION_BYTES: 1073741824  
40 - KAFKA_LOG_SEGMENT_BYTES: 268435456  
41 - KAFKA_LOG_RETENTION_MS: 300000  
42 - KAFKA_LOG_CLEANUP_POLICY: delete  
43 - depends_on:  
44 - - zookeeper  
45 - tb-js-executor:  
46 - restart: always  
47 - image: "${DOCKER_REPO}/${JS_EXECUTOR_DOCKER_NAME}:${TB_VERSION}"  
48 - scale: 20  
49 - environment:  
50 - TB_KAFKA_SERVERS: kafka:9092  
51 - env_file:  
52 - - tb-js-executor.env  
53 - depends_on:  
54 - - kafka  
55 - tb:  
56 - restart: always  
57 - image: "${DOCKER_REPO}/${TB_NODE_DOCKER_NAME}:${TB_VERSION}"  
58 - ports:  
59 - - "8080"  
60 - logging:  
61 - driver: "json-file"  
62 - options:  
63 - max-size: "200m"  
64 - max-file: "30"  
65 - env_file:  
66 - - tb-node.env  
67 - environment:  
68 - ZOOKEEPER_URL: zk:2181  
69 - TB_KAFKA_SERVERS: kafka:9092  
70 - JS_EVALUATOR: remote  
71 - volumes:  
72 - - ./tb-node/db:/usr/share/thingsboard/data/db  
73 - - ./tb-node/conf:/config  
74 - - ./tb-node/log:/var/log/thingsboard  
75 - depends_on:  
76 - - kafka  
77 - tb-mqtt-transport1:  
78 - restart: always  
79 - image: "${DOCKER_REPO}/${MQTT_TRANSPORT_DOCKER_NAME}:${TB_VERSION}"  
80 - ports:  
81 - - "1883"  
82 - environment:  
83 - TB_KAFKA_SERVERS: kafka:9092  
84 - env_file:  
85 - - tb-mqtt-transport.env  
86 - depends_on:  
87 - - kafka  
88 - tb-mqtt-transport2:  
89 - restart: always  
90 - image: "${DOCKER_REPO}/${MQTT_TRANSPORT_DOCKER_NAME}:${TB_VERSION}"  
91 - ports:  
92 - - "1883"  
93 - environment:  
94 - TB_KAFKA_SERVERS: kafka:9092  
95 - env_file:  
96 - - tb-mqtt-transport.env  
97 - depends_on:  
98 - - kafka  
99 - tb-http-transport1:  
100 - restart: always  
101 - image: "${DOCKER_REPO}/${HTTP_TRANSPORT_DOCKER_NAME}:${TB_VERSION}"  
102 - ports:  
103 - - "8081"  
104 - environment:  
105 - TB_KAFKA_SERVERS: kafka:9092  
106 - env_file:  
107 - - tb-http-transport.env  
108 - depends_on:  
109 - - kafka  
110 - tb-http-transport2:  
111 - restart: always  
112 - image: "${DOCKER_REPO}/${HTTP_TRANSPORT_DOCKER_NAME}:${TB_VERSION}"  
113 - ports:  
114 - - "8081"  
115 - environment:  
116 - TB_KAFKA_SERVERS: kafka:9092  
117 - env_file:  
118 - - tb-http-transport.env  
119 - depends_on:  
120 - - kafka  
121 - tb-coap-transport:  
122 - restart: always  
123 - image: "${DOCKER_REPO}/${COAP_TRANSPORT_DOCKER_NAME}:${TB_VERSION}"  
124 - ports:  
125 - - "5683:5683/udp"  
126 - environment:  
127 - TB_KAFKA_SERVERS: kafka:9092  
128 - env_file:  
129 - - tb-coap-transport.env  
130 - depends_on:  
131 - - kafka  
132 - tb-web-ui1:  
133 - restart: always  
134 - image: "${DOCKER_REPO}/${WEB_UI_DOCKER_NAME}:${TB_VERSION}"  
135 - ports:  
136 - - "8080"  
137 - environment:  
138 - TB_HOST: tb  
139 - TB_PORT: 8080  
140 - env_file:  
141 - - tb-web-ui.env  
142 - tb-web-ui2:  
143 - restart: always  
144 - image: "${DOCKER_REPO}/${WEB_UI_DOCKER_NAME}:${TB_VERSION}"  
145 - ports:  
146 - - "8080"  
147 - environment:  
148 - TB_HOST: tb  
149 - TB_PORT: 8080  
150 - env_file:  
151 - - tb-web-ui.env  
152 - web:  
153 - restart: always  
154 - container_name: haproxy-certbot  
155 - image: nmarus/haproxy-certbot  
156 - volumes:  
157 - - ./haproxy/config:/config  
158 - - ./haproxy/letsencrypt:/etc/letsencrypt  
159 - - ./haproxy/certs.d:/usr/local/etc/haproxy/certs.d  
160 - ports:  
161 - - "80:80"  
162 - - "443:443"  
163 - - "1883:1883"  
164 - - "9999:9999"  
165 - cap_add:  
166 - - NET_ADMIN  
167 - environment:  
168 - HTTP_PORT: 80  
169 - HTTPS_PORT: 443  
170 - MQTT_PORT: 1883  
171 - links:  
172 - - tb-web-ui1  
173 - - tb-web-ui2  
174 - - tb-mqtt-transport1  
175 - - tb-mqtt-transport2  
176 - - tb-http-transport1  
177 - - tb-http-transport2  
1 -# ThingsBoard server configuration  
2 -  
3 -TRANSPORT_TYPE=remote  
4 -  
5 -# type of database to use: sql[DEFAULT] or cassandra  
6 -DATABASE_TS_TYPE=sql  
7 -DATABASE_ENTITIES_TYPE=sql  
8 -SQL_DATA_FOLDER=/usr/share/thingsboard/data/db  
9 -  
10 -# cassandra db config  
11 -CASSANDRA_URL=cassandra:9042  
12 -CASSANDRA_HOST=cassandra  
13 -CASSANDRA_PORT=9042  
14 -  
15 -# postgres db config  
16 -POSTGRES_HOST=postgres  
17 -POSTGRES_PORT=5432  
18 -# SPRING_JPA_DATABASE_PLATFORM=org.hibernate.dialect.PostgreSQLDialect  
19 -# SPRING_DRIVER_CLASS_NAME=org.postgresql.Driver  
20 -# SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/thingsboard  
21 -# SPRING_DATASOURCE_USERNAME=postgres  
22 -# SPRING_DATASOURCE_PASSWORD=postgres  
@@ -287,16 +287,27 @@ @@ -287,16 +287,27 @@
287 <goals> 287 <goals>
288 <goal>build</goal> 288 <goal>build</goal>
289 </goals> 289 </goals>
  290 + <configuration>
  291 + <skip>${dockerfile.skip}</skip>
  292 + <repository>${docker.repo}/${docker.name}</repository>
  293 + <verbose>true</verbose>
  294 + <googleContainerRegistryEnabled>false</googleContainerRegistryEnabled>
  295 + <contextDirectory>${project.build.directory}</contextDirectory>
  296 + </configuration>
  297 + </execution>
  298 + <execution>
  299 + <id>tag-docker-image</id>
  300 + <phase>pre-integration-test</phase>
  301 + <goals>
  302 + <goal>tag</goal>
  303 + </goals>
  304 + <configuration>
  305 + <skip>${dockerfile.skip}</skip>
  306 + <repository>${docker.repo}/${docker.name}</repository>
  307 + <tag>${project.version}</tag>
  308 + </configuration>
290 </execution> 309 </execution>
291 </executions> 310 </executions>
292 - <configuration>  
293 - <skip>${dockerfile.skip}</skip>  
294 - <repository>${docker.repo}/${docker.name}</repository>  
295 - <tag>${project.version}</tag>  
296 - <verbose>true</verbose>  
297 - <googleContainerRegistryEnabled>false</googleContainerRegistryEnabled>  
298 - <contextDirectory>${project.build.directory}</contextDirectory>  
299 - </configuration>  
300 </plugin> 311 </plugin>
301 </plugins> 312 </plugins>
302 </build> 313 </build>
@@ -334,6 +345,46 @@ @@ -334,6 +345,46 @@
334 </plugins> 345 </plugins>
335 </build> 346 </build>
336 </profile> 347 </profile>
  348 + <profile>
  349 + <id>push-docker-image</id>
  350 + <activation>
  351 + <property>
  352 + <name>push-docker-image</name>
  353 + </property>
  354 + </activation>
  355 + <build>
  356 + <plugins>
  357 + <plugin>
  358 + <groupId>com.spotify</groupId>
  359 + <artifactId>dockerfile-maven-plugin</artifactId>
  360 + <executions>
  361 + <execution>
  362 + <id>push-latest-docker-image</id>
  363 + <phase>pre-integration-test</phase>
  364 + <goals>
  365 + <goal>push</goal>
  366 + </goals>
  367 + <configuration>
  368 + <tag>latest</tag>
  369 + <repository>${docker.repo}/${docker.name}</repository>
  370 + </configuration>
  371 + </execution>
  372 + <execution>
  373 + <id>push-version-docker-image</id>
  374 + <phase>pre-integration-test</phase>
  375 + <goals>
  376 + <goal>push</goal>
  377 + </goals>
  378 + <configuration>
  379 + <tag>${project.version}</tag>
  380 + <repository>${docker.repo}/${docker.name}</repository>
  381 + </configuration>
  382 + </execution>
  383 + </executions>
  384 + </plugin>
  385 + </plugins>
  386 + </build>
  387 + </profile>
337 </profiles> 388 </profiles>
338 <repositories> 389 <repositories>
339 <repository> 390 <repository>
@@ -32,11 +32,12 @@ @@ -32,11 +32,12 @@
32 32
33 <properties> 33 <properties>
34 <main.dir>${basedir}/..</main.dir> 34 <main.dir>${basedir}/..</main.dir>
35 - <docker.repo>local-maven-build</docker.repo> 35 + <docker.repo>thingsboard</docker.repo>
36 <dockerfile.skip>true</dockerfile.skip> 36 <dockerfile.skip>true</dockerfile.skip>
37 </properties> 37 </properties>
38 38
39 <modules> 39 <modules>
  40 + <module>tb</module>
40 <module>js-executor</module> 41 <module>js-executor</module>
41 <module>web-ui</module> 42 <module>web-ui</module>
42 <module>tb-node</module> 43 <module>tb-node</module>
@@ -111,19 +111,72 @@ @@ -111,19 +111,72 @@
111 <goals> 111 <goals>
112 <goal>build</goal> 112 <goal>build</goal>
113 </goals> 113 </goals>
  114 + <configuration>
  115 + <skip>${dockerfile.skip}</skip>
  116 + <repository>${docker.repo}/${docker.name}</repository>
  117 + <verbose>true</verbose>
  118 + <googleContainerRegistryEnabled>false</googleContainerRegistryEnabled>
  119 + <contextDirectory>${project.build.directory}</contextDirectory>
  120 + </configuration>
  121 + </execution>
  122 + <execution>
  123 + <id>tag-docker-image</id>
  124 + <phase>pre-integration-test</phase>
  125 + <goals>
  126 + <goal>tag</goal>
  127 + </goals>
  128 + <configuration>
  129 + <skip>${dockerfile.skip}</skip>
  130 + <repository>${docker.repo}/${docker.name}</repository>
  131 + <tag>${project.version}</tag>
  132 + </configuration>
114 </execution> 133 </execution>
115 </executions> 134 </executions>
116 - <configuration>  
117 - <skip>${dockerfile.skip}</skip>  
118 - <repository>${docker.repo}/${docker.name}</repository>  
119 - <tag>${project.version}</tag>  
120 - <verbose>true</verbose>  
121 - <googleContainerRegistryEnabled>false</googleContainerRegistryEnabled>  
122 - <contextDirectory>${project.build.directory}</contextDirectory>  
123 - </configuration>  
124 </plugin> 135 </plugin>
125 </plugins> 136 </plugins>
126 </build> 137 </build>
  138 + <profiles>
  139 + <profile>
  140 + <id>push-docker-image</id>
  141 + <activation>
  142 + <property>
  143 + <name>push-docker-image</name>
  144 + </property>
  145 + </activation>
  146 + <build>
  147 + <plugins>
  148 + <plugin>
  149 + <groupId>com.spotify</groupId>
  150 + <artifactId>dockerfile-maven-plugin</artifactId>
  151 + <executions>
  152 + <execution>
  153 + <id>push-latest-docker-image</id>
  154 + <phase>pre-integration-test</phase>
  155 + <goals>
  156 + <goal>push</goal>
  157 + </goals>
  158 + <configuration>
  159 + <tag>latest</tag>
  160 + <repository>${docker.repo}/${docker.name}</repository>
  161 + </configuration>
  162 + </execution>
  163 + <execution>
  164 + <id>push-version-docker-image</id>
  165 + <phase>pre-integration-test</phase>
  166 + <goals>
  167 + <goal>push</goal>
  168 + </goals>
  169 + <configuration>
  170 + <tag>${project.version}</tag>
  171 + <repository>${docker.repo}/${docker.name}</repository>
  172 + </configuration>
  173 + </execution>
  174 + </executions>
  175 + </plugin>
  176 + </plugins>
  177 + </build>
  178 + </profile>
  179 + </profiles>
127 <repositories> 180 <repositories>
128 <repository> 181 <repository>
129 <id>jenkins</id> 182 <id>jenkins</id>
  1 +# ThingsBoard single docker images
  2 +
  3 +This project provides the build for the ThingsBoard single docker images.
  4 +
  5 +* `thingsboard/tb` - single instance of ThingsBoard with embedded HSQLDB database.
  6 +* `thingsboard/tb-postgres` - single instance of ThingsBoard with PostgreSQL database.
  7 +* `thingsboard/tb-cassandra` - single instance of ThingsBoard with Cassandra database.
  8 +
  9 +## Running
  10 +
  11 +Execute the following command to run this docker directly:
  12 +
  13 +`
  14 +$ docker run -it -p 9090:9090 -p 1883:1883 -p 5683:5683/udp -v ~/.mytb-data:/data --name mytb thingsboard/tb
  15 +`
  16 +
  17 +Where:
  18 +
  19 +- `docker run` - run this container
  20 +- `-it` - attach a terminal session with current ThingsBoard process output
  21 +- `-p 9090:9090` - connect local port 9090 to exposed internal HTTP port 9090
  22 +- `-p 1883:1883` - connect local port 1883 to exposed internal MQTT port 1883
  23 +- `-p 5683:5683` - connect local port 5683 to exposed internal COAP port 5683
  24 +- `-v ~/.mytb-data:/data` - mounts the host's dir `~/.mytb-data` to ThingsBoard DataBase data directory
  25 +- `--name mytb` - friendly local name of this machine
  26 +- `thingsboard/tb` - docker image
  27 +
  28 +After executing this command you can open `http://{yor-host-ip}:9090` in you browser. You should see ThingsBoard login page.
  29 +Use the following default credentials:
  30 +
  31 +- **Systen Administrator**: sysadmin@thingsboard.org / sysadmin
  32 +- **Tenant Administrator**: tenant@thingsboard.org / tenant
  33 +- **Customer User**: customer@thingsboard.org / customer
  34 +
  35 +You can always change passwords for each account in account profile page.
  36 +
  37 +You can detach from session terminal with `Ctrl-p` `Ctrl-q` - the container will keep running in the background.
  38 +
  39 +To reattach to the terminal (to see ThingsBoard logs) run:
  40 +
  41 +`
  42 +$ docker attach mytb
  43 +`
  44 +
  45 +To stop the container:
  46 +
  47 +`
  48 +$ docker stop mytb
  49 +`
  50 +
  51 +To start the container:
  52 +
  53 +`
  54 +$ docker start mytb
  55 +`
  56 +
  57 +## Upgrading
  58 +
  59 +In order to update to the latest image, execute the following commands:
  60 +
  61 +`
  62 +$ docker pull thingsboard/tb
  63 +$ docker stop mytb
  64 +$ docker run -it -v ~/.mytb-data:/data --rm thingsboard/tb upgrade-tb.sh
  65 +$ docker start mytb
  66 +`
  67 +
  68 +**NOTE**: replace host's directory `~/.mytb-data` with directory used during container creation.
  1 +#
  2 +# Copyright © 2016-2018 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 +FROM openjdk:8-jre
  18 +
  19 +RUN apt-get update
  20 +RUN apt-get install -y curl nmap procps
  21 +RUN echo 'deb http://www.apache.org/dist/cassandra/debian 311x main' | tee --append /etc/apt/sources.list.d/cassandra.list > /dev/null
  22 +RUN curl https://www.apache.org/dist/cassandra/KEYS | apt-key add -
  23 +RUN apt-get update
  24 +RUN apt-get install -y cassandra cassandra-tools
  25 +RUN update-rc.d cassandra disable
  26 +RUN sed -i.old '/ulimit/d' /etc/init.d/cassandra
  27 +
  28 +COPY logback.xml ${pkg.name}.conf start-db.sh stop-db.sh start-tb.sh upgrade-tb.sh install-tb.sh ${pkg.name}.deb /tmp/
  29 +
  30 +RUN chmod a+x /tmp/*.sh \
  31 + && mv /tmp/start-tb.sh /usr/bin \
  32 + && mv /tmp/upgrade-tb.sh /usr/bin \
  33 + && mv /tmp/install-tb.sh /usr/bin \
  34 + && mv /tmp/start-db.sh /usr/bin \
  35 + && mv /tmp/stop-db.sh /usr/bin
  36 +
  37 +RUN dpkg -i /tmp/${pkg.name}.deb
  38 +
  39 +RUN update-rc.d ${pkg.name} disable
  40 +
  41 +RUN mv /tmp/logback.xml ${pkg.installFolder}/conf \
  42 + && mv /tmp/${pkg.name}.conf ${pkg.installFolder}/conf
  43 +
  44 +ENV DATA_FOLDER=/data
  45 +
  46 +ENV HTTP_BIND_PORT=9090
  47 +ENV DATABASE_TS_TYPE=cassandra
  48 +ENV DATABASE_ENTITIES_TYPE=cassandra
  49 +
  50 +ENV CASSANDRA_HOST=localhost
  51 +ENV CASSANDRA_PORT=9042
  52 +
  53 +EXPOSE 9090
  54 +EXPOSE 1883
  55 +EXPOSE 5683/udp
  56 +
  57 +VOLUME ["/data"]
  58 +
  59 +CMD ["start-tb.sh"]
msa/tb/docker-cassandra/start-db.sh renamed from docker/cassandra-setup/install.sh 100755 → 100644
@@ -15,19 +15,24 @@ @@ -15,19 +15,24 @@
15 # limitations under the License. 15 # limitations under the License.
16 # 16 #
17 17
  18 +cassandra_data_dir=${DATA_FOLDER}/db
  19 +cassandra_data_link=/var/lib/cassandra
18 20
19 -dpkg -i /thingsboard.deb 21 +if [ ! -L ${cassandra_data_link} ]; then
  22 + if [ -d ${cassandra_data_link} ]; then
  23 + rm -rf ${cassandra_data_link}
  24 + fi
  25 + if [ ! -d ${cassandra_data_dir} ]; then
  26 + mkdir -p ${cassandra_data_dir}
  27 + chown -R cassandra:cassandra ${cassandra_data_dir}
  28 + fi
  29 + ln -s ${cassandra_data_dir} ${cassandra_data_link}
  30 +fi
  31 +
  32 +service cassandra start
20 33
21 until nmap $CASSANDRA_HOST -p $CASSANDRA_PORT | grep "$CASSANDRA_PORT/tcp open" 34 until nmap $CASSANDRA_HOST -p $CASSANDRA_PORT | grep "$CASSANDRA_PORT/tcp open"
22 do 35 do
23 echo "Wait for cassandra db to start..." 36 echo "Wait for cassandra db to start..."
24 - sleep 10 37 + sleep 5
25 done 38 done
26 -  
27 -echo "Creating 'Thingsboard' schema and system data..."  
28 -if [ "$ADD_DEMO_DATA" == "true" ]; then  
29 - echo "plus demo data..."  
30 - /usr/share/thingsboard/bin/install/install.sh --loadDemo  
31 -elif [ "$ADD_DEMO_DATA" == "false" ]; then  
32 - /usr/share/thingsboard/bin/install/install.sh  
33 -fi  
msa/tb/docker-cassandra/stop-db.sh renamed from msa/docker/docker-stop-services.sh 100755 → 100644
@@ -15,4 +15,4 @@ @@ -15,4 +15,4 @@
15 # limitations under the License. 15 # limitations under the License.
16 # 16 #
17 17
18 -docker-compose stop 18 +service cassandra stop
  1 +#
  2 +# Copyright © 2016-2018 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 +FROM openjdk:8-jre
  18 +
  19 +RUN apt-get update
  20 +RUN apt-get install -y postgresql postgresql-contrib
  21 +RUN update-rc.d postgresql disable
  22 +
  23 +RUN mkdir -p /var/log/postgres
  24 +RUN chown -R postgres:postgres /var/log/postgres
  25 +
  26 +COPY logback.xml ${pkg.name}.conf start-db.sh stop-db.sh start-tb.sh upgrade-tb.sh install-tb.sh ${pkg.name}.deb /tmp/
  27 +
  28 +RUN chmod a+x /tmp/*.sh \
  29 + && mv /tmp/start-tb.sh /usr/bin \
  30 + && mv /tmp/upgrade-tb.sh /usr/bin \
  31 + && mv /tmp/install-tb.sh /usr/bin \
  32 + && mv /tmp/start-db.sh /usr/bin \
  33 + && mv /tmp/stop-db.sh /usr/bin
  34 +
  35 +RUN dpkg -i /tmp/${pkg.name}.deb
  36 +
  37 +RUN update-rc.d ${pkg.name} disable
  38 +
  39 +RUN mv /tmp/logback.xml ${pkg.installFolder}/conf \
  40 + && mv /tmp/${pkg.name}.conf ${pkg.installFolder}/conf
  41 +
  42 +ENV DATA_FOLDER=/data
  43 +
  44 +ENV HTTP_BIND_PORT=9090
  45 +ENV DATABASE_TS_TYPE=sql
  46 +ENV DATABASE_ENTITIES_TYPE=sql
  47 +
  48 +ENV PGDATA=/data/db
  49 +
  50 +ENV SPRING_JPA_DATABASE_PLATFORM=org.hibernate.dialect.PostgreSQLDialect
  51 +ENV SPRING_DRIVER_CLASS_NAME=org.postgresql.Driver
  52 +ENV SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/thingsboard
  53 +ENV SPRING_DATASOURCE_USERNAME=postgres
  54 +ENV SPRING_DATASOURCE_PASSWORD=postgres
  55 +
  56 +EXPOSE 9090
  57 +EXPOSE 1883
  58 +EXPOSE 5683/udp
  59 +
  60 +VOLUME ["/data"]
  61 +
  62 +CMD ["start-tb.sh"]
msa/tb/docker-postgres/start-db.sh renamed from docker/cassandra/ready-probe.sh
1 -#!/usr/bin/env bash 1 +#!/bin/bash
2 # 2 #
3 # Copyright © 2016-2018 The Thingsboard Authors 3 # Copyright © 2016-2018 The Thingsboard Authors
4 # 4 #
@@ -15,14 +15,16 @@ @@ -15,14 +15,16 @@
15 # limitations under the License. 15 # limitations under the License.
16 # 16 #
17 17
18 -if [[ $(nodetool status | grep $POD_IP) == *"UN"* ]]; then  
19 - if [[ $DEBUG ]]; then  
20 - echo "UN";  
21 - fi  
22 - exit 0;  
23 -else  
24 - if [[ $DEBUG ]]; then  
25 - echo "Not Up";  
26 - fi  
27 - exit 1;  
28 -fi  
  18 +firstlaunch=${DATA_FOLDER}/.firstlaunch
  19 +
  20 +if [ ! -d ${PGDATA} ]; then
  21 + mkdir -p ${PGDATA}
  22 + chown -R postgres:postgres ${PGDATA}
  23 + su postgres -c '/usr/lib/postgresql/9.6/bin/pg_ctl initdb -U postgres'
  24 +fi
  25 +
  26 +su postgres -c '/usr/lib/postgresql/9.6/bin/pg_ctl -l /var/log/postgres/postgres.log -w start'
  27 +
  28 +if [ ! -f ${firstlaunch} ]; then
  29 + su postgres -c 'psql -U postgres -d postgres -c "CREATE DATABASE thingsboard"'
  30 +fi
msa/tb/docker-postgres/stop-db.sh renamed from msa/docker/docker-start-services.sh 100755 → 100644
@@ -15,6 +15,4 @@ @@ -15,6 +15,4 @@
15 # limitations under the License. 15 # limitations under the License.
16 # 16 #
17 17
18 -./check-dirs.sh  
19 -  
20 -docker-compose up -d 18 +su postgres -c '/usr/lib/postgresql/9.6/bin/pg_ctl stop'
  1 +#
  2 +# Copyright © 2016-2018 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 +FROM openjdk:8-jre
  18 +
  19 +COPY logback.xml ${pkg.name}.conf start-db.sh stop-db.sh start-tb.sh upgrade-tb.sh install-tb.sh ${pkg.name}.deb /tmp/
  20 +
  21 +RUN chmod a+x /tmp/*.sh \
  22 + && mv /tmp/start-tb.sh /usr/bin \
  23 + && mv /tmp/upgrade-tb.sh /usr/bin \
  24 + && mv /tmp/install-tb.sh /usr/bin \
  25 + && mv /tmp/start-db.sh /usr/bin \
  26 + && mv /tmp/stop-db.sh /usr/bin
  27 +
  28 +RUN dpkg -i /tmp/${pkg.name}.deb
  29 +
  30 +RUN update-rc.d ${pkg.name} disable
  31 +
  32 +RUN mv /tmp/logback.xml ${pkg.installFolder}/conf \
  33 + && mv /tmp/${pkg.name}.conf ${pkg.installFolder}/conf
  34 +
  35 +ENV DATA_FOLDER=/data
  36 +
  37 +ENV HTTP_BIND_PORT=9090
  38 +ENV DATABASE_TS_TYPE=sql
  39 +ENV DATABASE_ENTITIES_TYPE=sql
  40 +ENV SQL_DATA_FOLDER=/data/db
  41 +
  42 +EXPOSE 9090
  43 +EXPOSE 1883
  44 +EXPOSE 5683/udp
  45 +
  46 +VOLUME ["/data"]
  47 +
  48 +CMD ["start-tb.sh"]
msa/tb/docker-tb/start-db.sh renamed from msa/docker/docker-update-service.sh 100755 → 100644
@@ -15,5 +15,4 @@ @@ -15,5 +15,4 @@
15 # limitations under the License. 15 # limitations under the License.
16 # 16 #
17 17
18 -docker-compose pull $@  
19 -docker-compose up -d --no-deps --build $@ 18 +# Do nothing
msa/tb/docker-tb/stop-db.sh renamed from docker/cassandra/Dockerfile
  1 +#!/bin/bash
1 # 2 #
2 # Copyright © 2016-2018 The Thingsboard Authors 3 # Copyright © 2016-2018 The Thingsboard Authors
3 # 4 #
@@ -14,10 +15,4 @@ @@ -14,10 +15,4 @@
14 # limitations under the License. 15 # limitations under the License.
15 # 16 #
16 17
17 -FROM cassandra:3.11.2  
18 -  
19 -ADD ready-probe.sh /ready-probe.sh  
20 -  
21 -RUN chmod +x /ready-probe.sh  
22 -  
23 -CMD ["cassandra", "-f"]  
  18 +# Do nothing
  1 +#!/bin/bash
  2 +#
  3 +# Copyright © 2016-2018 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 +while [[ $# -gt 0 ]]
  19 +do
  20 +key="$1"
  21 +
  22 +case $key in
  23 + --loadDemo)
  24 + LOAD_DEMO=true
  25 + shift # past argument
  26 + ;;
  27 + *)
  28 + # unknown option
  29 + ;;
  30 +esac
  31 +shift # past argument or value
  32 +done
  33 +
  34 +if [ "$LOAD_DEMO" == "true" ]; then
  35 + loadDemo=true
  36 +else
  37 + loadDemo=false
  38 +fi
  39 +
  40 +CONF_FOLDER="${pkg.installFolder}/conf"
  41 +jarfile=${pkg.installFolder}/bin/${pkg.name}.jar
  42 +configfile=${pkg.name}.conf
  43 +upgradeversion=${DATA_FOLDER}/.upgradeversion
  44 +
  45 +source "${CONF_FOLDER}/${configfile}"
  46 +
  47 +echo "Starting ThingsBoard installation ..."
  48 +
  49 +java -cp ${jarfile} $JAVA_OPTS -Dloader.main=org.thingsboard.server.ThingsboardInstallApplication \
  50 + -Dinstall.load_demo=${loadDemo} \
  51 + -Dspring.jpa.hibernate.ddl-auto=none \
  52 + -Dinstall.upgrade=false \
  53 + -Dlogging.config=/usr/share/thingsboard/bin/install/logback.xml \
  54 + org.springframework.boot.loader.PropertiesLauncher
  55 +
  56 +echo "${pkg.upgradeVersion}" > ${upgradeversion}
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!--
  3 +
  4 + Copyright © 2016-2018 The Thingsboard Authors
  5 +
  6 + Licensed under the Apache License, Version 2.0 (the "License");
  7 + you may not use this file except in compliance with the License.
  8 + You may obtain a copy of the License at
  9 +
  10 + http://www.apache.org/licenses/LICENSE-2.0
  11 +
  12 + Unless required by applicable law or agreed to in writing, software
  13 + distributed under the License is distributed on an "AS IS" BASIS,
  14 + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15 + See the License for the specific language governing permissions and
  16 + limitations under the License.
  17 +
  18 +-->
  19 +<!DOCTYPE configuration>
  20 +<configuration scan="true" scanPeriod="10 seconds">
  21 +
  22 + <appender name="fileLogAppender"
  23 + class="ch.qos.logback.core.rolling.RollingFileAppender">
  24 + <file>/var/log/thingsboard/thingsboard.log</file>
  25 + <rollingPolicy
  26 + class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
  27 + <fileNamePattern>/var/log/thingsboard/thingsboard.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
  28 + <maxFileSize>100MB</maxFileSize>
  29 + <maxHistory>30</maxHistory>
  30 + <totalSizeCap>3GB</totalSizeCap>
  31 + </rollingPolicy>
  32 + <encoder>
  33 + <pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern>
  34 + </encoder>
  35 + </appender>
  36 +
  37 + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
  38 + <encoder>
  39 + <pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern>
  40 + </encoder>
  41 + </appender>
  42 +
  43 + <logger name="org.thingsboard.server" level="INFO" />
  44 + <logger name="akka" level="INFO" />
  45 +
  46 + <root level="INFO">
  47 + <appender-ref ref="fileLogAppender"/>
  48 + <appender-ref ref="STDOUT"/>
  49 + </root>
  50 +
  51 +</configuration>
  1 +#!/bin/bash
  2 +#
  3 +# Copyright © 2016-2018 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 +start-db.sh
  19 +
  20 +CONF_FOLDER="${pkg.installFolder}/conf"
  21 +jarfile=${pkg.installFolder}/bin/${pkg.name}.jar
  22 +configfile=${pkg.name}.conf
  23 +firstlaunch=${DATA_FOLDER}/.firstlaunch
  24 +
  25 +source "${CONF_FOLDER}/${configfile}"
  26 +
  27 +if [ ! -f ${firstlaunch} ]; then
  28 + install-tb.sh --loadDemo
  29 + touch ${firstlaunch}
  30 +fi
  31 +
  32 +echo "Starting ThingsBoard ..."
  33 +
  34 +java -cp ${jarfile} $JAVA_OPTS -Dloader.main=org.thingsboard.server.ThingsboardServerApplication \
  35 + -Dspring.jpa.hibernate.ddl-auto=none \
  36 + -Dlogging.config=${CONF_FOLDER}/logback.xml \
  37 + org.springframework.boot.loader.PropertiesLauncher
  38 +
  39 +stop-db.sh
  1 +#
  2 +# Copyright © 2016-2018 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 +export JAVA_OPTS="$JAVA_OPTS -Dplatform=deb -Dinstall.data_dir=/usr/share/thingsboard/data"
  18 +export JAVA_OPTS="$JAVA_OPTS -Xloggc:/var/log/thingsboard/gc.log -XX:+IgnoreUnrecognizedVMOptions -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDetails -XX:+PrintGCDateStamps"
  19 +export JAVA_OPTS="$JAVA_OPTS -XX:+PrintHeapAtGC -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10"
  20 +export JAVA_OPTS="$JAVA_OPTS -XX:GCLogFileSize=10M -XX:-UseBiasedLocking -XX:+UseTLAB -XX:+ResizeTLAB -XX:+PerfDisableSharedMem -XX:+UseCondCardMark"
  21 +export JAVA_OPTS="$JAVA_OPTS -XX:CMSWaitDuration=10000 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+CMSParallelInitialMarkEnabled"
  22 +export JAVA_OPTS="$JAVA_OPTS -XX:+CMSEdenChunksRecordAlways -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+ExitOnOutOfMemoryError"
  23 +export LOG_FILENAME=thingsboard.out
  24 +export LOADER_PATH=/usr/share/thingsboard/conf,/usr/share/thingsboard/extensions
msa/tb/docker/upgrade-tb.sh renamed from docker/zookeeper/zk-ok.sh 100755 → 100644
1 -#!/usr/bin/env bash 1 +#!/bin/bash
2 # 2 #
3 # Copyright © 2016-2018 The Thingsboard Authors 3 # Copyright © 2016-2018 The Thingsboard Authors
4 # 4 #
@@ -15,14 +15,33 @@ @@ -15,14 +15,33 @@
15 # limitations under the License. 15 # limitations under the License.
16 # 16 #
17 17
18 -# zk-ok.sh uses the ruok ZooKeeper four letter work to determine if the instance  
19 -# is health. The $? variable will be set to 0 if server responds that it is  
20 -# healthy, or 1 if the server fails to respond. 18 +start-db.sh
21 19
22 -ZK_CLIENT_PORT=${ZK_CLIENT_PORT:-2181}  
23 -OK=$(echo ruok | nc 127.0.0.1 $ZK_CLIENT_PORT)  
24 -if [ "$OK" == "imok" ]; then  
25 - exit 0 20 +CONF_FOLDER="${pkg.installFolder}/conf"
  21 +jarfile=${pkg.installFolder}/bin/${pkg.name}.jar
  22 +configfile=${pkg.name}.conf
  23 +upgradeversion=${DATA_FOLDER}/.upgradeversion
  24 +
  25 +source "${CONF_FOLDER}/${configfile}"
  26 +
  27 +FROM_VERSION=`cat ${upgradeversion}`
  28 +
  29 +echo "Starting ThingsBoard upgrade ..."
  30 +
  31 +if [[ -z "${FROM_VERSION// }" ]]; then
  32 + echo "FROM_VERSION variable is invalid or unspecified!"
  33 + exit 1
26 else 34 else
27 - exit 1 35 + fromVersion="${FROM_VERSION// }"
28 fi 36 fi
  37 +
  38 +java -cp ${jarfile} $JAVA_OPTS -Dloader.main=org.thingsboard.server.ThingsboardInstallApplication \
  39 + -Dspring.jpa.hibernate.ddl-auto=none \
  40 + -Dinstall.upgrade=true \
  41 + -Dinstall.upgrade.from_version=${fromVersion} \
  42 + -Dlogging.config=/usr/share/thingsboard/bin/install/logback.xml \
  43 + org.springframework.boot.loader.PropertiesLauncher
  44 +
  45 +echo "${pkg.upgradeVersion}" > ${upgradeversion}
  46 +
  47 +stop-db.sh
  1 +<!--
  2 +
  3 + Copyright © 2016-2018 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 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  19 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  20 + <modelVersion>4.0.0</modelVersion>
  21 + <parent>
  22 + <groupId>org.thingsboard</groupId>
  23 + <version>2.2.0-SNAPSHOT</version>
  24 + <artifactId>msa</artifactId>
  25 + </parent>
  26 + <groupId>org.thingsboard.msa</groupId>
  27 + <artifactId>tb</artifactId>
  28 + <packaging>pom</packaging>
  29 +
  30 + <name>ThingsBoard Docker Images</name>
  31 + <url>https://thingsboard.io</url>
  32 + <description>ThingsBoard Docker Images</description>
  33 +
  34 + <properties>
  35 + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  36 + <main.dir>${basedir}/../..</main.dir>
  37 + <pkg.name>thingsboard</pkg.name>
  38 + <tb.docker.name>tb</tb.docker.name>
  39 + <tb-postgres.docker.name>tb-postgres</tb-postgres.docker.name>
  40 + <tb-cassandra.docker.name>tb-cassandra</tb-cassandra.docker.name>
  41 + <pkg.user>thingsboard</pkg.user>
  42 + <pkg.installFolder>/usr/share/${pkg.name}</pkg.installFolder>
  43 + <pkg.upgradeVersion>2.1.1</pkg.upgradeVersion>
  44 + </properties>
  45 +
  46 + <dependencies>
  47 + <dependency>
  48 + <groupId>org.thingsboard</groupId>
  49 + <artifactId>application</artifactId>
  50 + <version>${project.version}</version>
  51 + <classifier>deb</classifier>
  52 + <type>deb</type>
  53 + <scope>provided</scope>
  54 + </dependency>
  55 + </dependencies>
  56 +
  57 + <build>
  58 + <plugins>
  59 + <plugin>
  60 + <groupId>org.apache.maven.plugins</groupId>
  61 + <artifactId>maven-dependency-plugin</artifactId>
  62 + <executions>
  63 + <execution>
  64 + <id>copy-tb-deb</id>
  65 + <phase>package</phase>
  66 + <goals>
  67 + <goal>copy</goal>
  68 + </goals>
  69 + <configuration>
  70 + <artifactItems>
  71 + <artifactItem>
  72 + <groupId>org.thingsboard</groupId>
  73 + <artifactId>application</artifactId>
  74 + <classifier>deb</classifier>
  75 + <type>deb</type>
  76 + <destFileName>${pkg.name}.deb</destFileName>
  77 + <outputDirectory>${project.build.directory}/docker-tb</outputDirectory>
  78 + </artifactItem>
  79 + </artifactItems>
  80 + </configuration>
  81 + </execution>
  82 + <execution>
  83 + <id>copy-tb-postgres-deb</id>
  84 + <phase>package</phase>
  85 + <goals>
  86 + <goal>copy</goal>
  87 + </goals>
  88 + <configuration>
  89 + <artifactItems>
  90 + <artifactItem>
  91 + <groupId>org.thingsboard</groupId>
  92 + <artifactId>application</artifactId>
  93 + <classifier>deb</classifier>
  94 + <type>deb</type>
  95 + <destFileName>${pkg.name}.deb</destFileName>
  96 + <outputDirectory>${project.build.directory}/docker-postgres</outputDirectory>
  97 + </artifactItem>
  98 + </artifactItems>
  99 + </configuration>
  100 + </execution>
  101 + <execution>
  102 + <id>copy-tb-cassandra-deb</id>
  103 + <phase>package</phase>
  104 + <goals>
  105 + <goal>copy</goal>
  106 + </goals>
  107 + <configuration>
  108 + <artifactItems>
  109 + <artifactItem>
  110 + <groupId>org.thingsboard</groupId>
  111 + <artifactId>application</artifactId>
  112 + <classifier>deb</classifier>
  113 + <type>deb</type>
  114 + <destFileName>${pkg.name}.deb</destFileName>
  115 + <outputDirectory>${project.build.directory}/docker-cassandra</outputDirectory>
  116 + </artifactItem>
  117 + </artifactItems>
  118 + </configuration>
  119 + </execution>
  120 + </executions>
  121 + </plugin>
  122 + <plugin>
  123 + <groupId>org.apache.maven.plugins</groupId>
  124 + <artifactId>maven-resources-plugin</artifactId>
  125 + <executions>
  126 + <execution>
  127 + <id>copy-docker-tb-config</id>
  128 + <phase>process-resources</phase>
  129 + <goals>
  130 + <goal>copy-resources</goal>
  131 + </goals>
  132 + <configuration>
  133 + <outputDirectory>${project.build.directory}/docker-tb</outputDirectory>
  134 + <resources>
  135 + <resource>
  136 + <directory>docker</directory>
  137 + <filtering>true</filtering>
  138 + </resource>
  139 + <resource>
  140 + <directory>docker-tb</directory>
  141 + <filtering>true</filtering>
  142 + </resource>
  143 + </resources>
  144 + </configuration>
  145 + </execution>
  146 + <execution>
  147 + <id>copy-docker-tb-postgres-config</id>
  148 + <phase>process-resources</phase>
  149 + <goals>
  150 + <goal>copy-resources</goal>
  151 + </goals>
  152 + <configuration>
  153 + <outputDirectory>${project.build.directory}/docker-postgres</outputDirectory>
  154 + <resources>
  155 + <resource>
  156 + <directory>docker</directory>
  157 + <filtering>true</filtering>
  158 + </resource>
  159 + <resource>
  160 + <directory>docker-postgres</directory>
  161 + <filtering>true</filtering>
  162 + </resource>
  163 + </resources>
  164 + </configuration>
  165 + </execution>
  166 + <execution>
  167 + <id>copy-docker-tb-cassandra-config</id>
  168 + <phase>process-resources</phase>
  169 + <goals>
  170 + <goal>copy-resources</goal>
  171 + </goals>
  172 + <configuration>
  173 + <outputDirectory>${project.build.directory}/docker-cassandra</outputDirectory>
  174 + <resources>
  175 + <resource>
  176 + <directory>docker</directory>
  177 + <filtering>true</filtering>
  178 + </resource>
  179 + <resource>
  180 + <directory>docker-cassandra</directory>
  181 + <filtering>true</filtering>
  182 + </resource>
  183 + </resources>
  184 + </configuration>
  185 + </execution>
  186 + </executions>
  187 + </plugin>
  188 + <plugin>
  189 + <groupId>com.spotify</groupId>
  190 + <artifactId>dockerfile-maven-plugin</artifactId>
  191 + <executions>
  192 + <execution>
  193 + <id>build-docker-tb-image</id>
  194 + <phase>pre-integration-test</phase>
  195 + <goals>
  196 + <goal>build</goal>
  197 + </goals>
  198 + <configuration>
  199 + <skip>${dockerfile.skip}</skip>
  200 + <repository>${docker.repo}/${tb.docker.name}</repository>
  201 + <verbose>true</verbose>
  202 + <googleContainerRegistryEnabled>false</googleContainerRegistryEnabled>
  203 + <contextDirectory>${project.build.directory}/docker-tb</contextDirectory>
  204 + </configuration>
  205 + </execution>
  206 + <execution>
  207 + <id>tag-docker-tb-image</id>
  208 + <phase>pre-integration-test</phase>
  209 + <goals>
  210 + <goal>tag</goal>
  211 + </goals>
  212 + <configuration>
  213 + <skip>${dockerfile.skip}</skip>
  214 + <repository>${docker.repo}/${tb.docker.name}</repository>
  215 + <tag>${project.version}</tag>
  216 + </configuration>
  217 + </execution>
  218 + <execution>
  219 + <id>build-docker-tb-postgres-image</id>
  220 + <phase>pre-integration-test</phase>
  221 + <goals>
  222 + <goal>build</goal>
  223 + </goals>
  224 + <configuration>
  225 + <skip>${dockerfile.skip}</skip>
  226 + <repository>${docker.repo}/${tb-postgres.docker.name}</repository>
  227 + <verbose>true</verbose>
  228 + <googleContainerRegistryEnabled>false</googleContainerRegistryEnabled>
  229 + <contextDirectory>${project.build.directory}/docker-postgres</contextDirectory>
  230 + </configuration>
  231 + </execution>
  232 + <execution>
  233 + <id>tag-docker-tb-postgres-image</id>
  234 + <phase>pre-integration-test</phase>
  235 + <goals>
  236 + <goal>tag</goal>
  237 + </goals>
  238 + <configuration>
  239 + <skip>${dockerfile.skip}</skip>
  240 + <repository>${docker.repo}/${tb-postgres.docker.name}</repository>
  241 + <tag>${project.version}</tag>
  242 + </configuration>
  243 + </execution>
  244 + <execution>
  245 + <id>build-docker-tb-cassandra-image</id>
  246 + <phase>pre-integration-test</phase>
  247 + <goals>
  248 + <goal>build</goal>
  249 + </goals>
  250 + <configuration>
  251 + <skip>${dockerfile.skip}</skip>
  252 + <repository>${docker.repo}/${tb-cassandra.docker.name}</repository>
  253 + <verbose>true</verbose>
  254 + <googleContainerRegistryEnabled>false</googleContainerRegistryEnabled>
  255 + <contextDirectory>${project.build.directory}/docker-cassandra</contextDirectory>
  256 + </configuration>
  257 + </execution>
  258 + <execution>
  259 + <id>tag-docker-tb-cassandra-image</id>
  260 + <phase>pre-integration-test</phase>
  261 + <goals>
  262 + <goal>tag</goal>
  263 + </goals>
  264 + <configuration>
  265 + <skip>${dockerfile.skip}</skip>
  266 + <repository>${docker.repo}/${tb-cassandra.docker.name}</repository>
  267 + <tag>${project.version}</tag>
  268 + </configuration>
  269 + </execution>
  270 + </executions>
  271 + </plugin>
  272 + </plugins>
  273 + </build>
  274 + <profiles>
  275 + <profile>
  276 + <id>push-docker-image</id>
  277 + <activation>
  278 + <property>
  279 + <name>push-docker-image</name>
  280 + </property>
  281 + </activation>
  282 + <build>
  283 + <plugins>
  284 + <plugin>
  285 + <groupId>com.spotify</groupId>
  286 + <artifactId>dockerfile-maven-plugin</artifactId>
  287 + <executions>
  288 + <execution>
  289 + <id>push-latest-docker-tb-image</id>
  290 + <phase>pre-integration-test</phase>
  291 + <goals>
  292 + <goal>push</goal>
  293 + </goals>
  294 + <configuration>
  295 + <tag>latest</tag>
  296 + <repository>${docker.repo}/${tb.docker.name}</repository>
  297 + </configuration>
  298 + </execution>
  299 + <execution>
  300 + <id>push-version-docker-tb-image</id>
  301 + <phase>pre-integration-test</phase>
  302 + <goals>
  303 + <goal>push</goal>
  304 + </goals>
  305 + <configuration>
  306 + <tag>${project.version}</tag>
  307 + <repository>${docker.repo}/${tb.docker.name}</repository>
  308 + </configuration>
  309 + </execution>
  310 + <execution>
  311 + <id>push-latest-docker-tb-postgres-image</id>
  312 + <phase>pre-integration-test</phase>
  313 + <goals>
  314 + <goal>push</goal>
  315 + </goals>
  316 + <configuration>
  317 + <tag>latest</tag>
  318 + <repository>${docker.repo}/${tb-postgres.docker.name}</repository>
  319 + </configuration>
  320 + </execution>
  321 + <execution>
  322 + <id>push-version-docker-tb-postgres-image</id>
  323 + <phase>pre-integration-test</phase>
  324 + <goals>
  325 + <goal>push</goal>
  326 + </goals>
  327 + <configuration>
  328 + <tag>${project.version}</tag>
  329 + <repository>${docker.repo}/${tb-postgres.docker.name}</repository>
  330 + </configuration>
  331 + </execution>
  332 + <execution>
  333 + <id>push-latest-docker-tb-cassandra-image</id>
  334 + <phase>pre-integration-test</phase>
  335 + <goals>
  336 + <goal>push</goal>
  337 + </goals>
  338 + <configuration>
  339 + <tag>latest</tag>
  340 + <repository>${docker.repo}/${tb-cassandra.docker.name}</repository>
  341 + </configuration>
  342 + </execution>
  343 + <execution>
  344 + <id>push-version-docker-tb-cassandra-image</id>
  345 + <phase>pre-integration-test</phase>
  346 + <goals>
  347 + <goal>push</goal>
  348 + </goals>
  349 + <configuration>
  350 + <tag>${project.version}</tag>
  351 + <repository>${docker.repo}/${tb-cassandra.docker.name}</repository>
  352 + </configuration>
  353 + </execution>
  354 + </executions>
  355 + </plugin>
  356 + </plugins>
  357 + </build>
  358 + </profile>
  359 + </profiles>
  360 + <repositories>
  361 + <repository>
  362 + <id>jenkins</id>
  363 + <name>Jenkins Repository</name>
  364 + <url>http://repo.jenkins-ci.org/releases</url>
  365 + <snapshots>
  366 + <enabled>false</enabled>
  367 + </snapshots>
  368 + </repository>
  369 + </repositories>
  370 +</project>
@@ -111,19 +111,72 @@ @@ -111,19 +111,72 @@
111 <goals> 111 <goals>
112 <goal>build</goal> 112 <goal>build</goal>
113 </goals> 113 </goals>
  114 + <configuration>
  115 + <skip>${dockerfile.skip}</skip>
  116 + <repository>${docker.repo}/${docker.name}</repository>
  117 + <verbose>true</verbose>
  118 + <googleContainerRegistryEnabled>false</googleContainerRegistryEnabled>
  119 + <contextDirectory>${project.build.directory}</contextDirectory>
  120 + </configuration>
  121 + </execution>
  122 + <execution>
  123 + <id>tag-docker-image</id>
  124 + <phase>pre-integration-test</phase>
  125 + <goals>
  126 + <goal>tag</goal>
  127 + </goals>
  128 + <configuration>
  129 + <skip>${dockerfile.skip}</skip>
  130 + <repository>${docker.repo}/${docker.name}</repository>
  131 + <tag>${project.version}</tag>
  132 + </configuration>
114 </execution> 133 </execution>
115 </executions> 134 </executions>
116 - <configuration>  
117 - <skip>${dockerfile.skip}</skip>  
118 - <repository>${docker.repo}/${docker.name}</repository>  
119 - <tag>${project.version}</tag>  
120 - <verbose>true</verbose>  
121 - <googleContainerRegistryEnabled>false</googleContainerRegistryEnabled>  
122 - <contextDirectory>${project.build.directory}</contextDirectory>  
123 - </configuration>  
124 </plugin> 135 </plugin>
125 </plugins> 136 </plugins>
126 </build> 137 </build>
  138 + <profiles>
  139 + <profile>
  140 + <id>push-docker-image</id>
  141 + <activation>
  142 + <property>
  143 + <name>push-docker-image</name>
  144 + </property>
  145 + </activation>
  146 + <build>
  147 + <plugins>
  148 + <plugin>
  149 + <groupId>com.spotify</groupId>
  150 + <artifactId>dockerfile-maven-plugin</artifactId>
  151 + <executions>
  152 + <execution>
  153 + <id>push-latest-docker-image</id>
  154 + <phase>pre-integration-test</phase>
  155 + <goals>
  156 + <goal>push</goal>
  157 + </goals>
  158 + <configuration>
  159 + <tag>latest</tag>
  160 + <repository>${docker.repo}/${docker.name}</repository>
  161 + </configuration>
  162 + </execution>
  163 + <execution>
  164 + <id>push-version-docker-image</id>
  165 + <phase>pre-integration-test</phase>
  166 + <goals>
  167 + <goal>push</goal>
  168 + </goals>
  169 + <configuration>
  170 + <tag>${project.version}</tag>
  171 + <repository>${docker.repo}/${docker.name}</repository>
  172 + </configuration>
  173 + </execution>
  174 + </executions>
  175 + </plugin>
  176 + </plugins>
  177 + </build>
  178 + </profile>
  179 + </profiles>
127 <repositories> 180 <repositories>
128 <repository> 181 <repository>
129 <id>jenkins</id> 182 <id>jenkins</id>
@@ -111,19 +111,72 @@ @@ -111,19 +111,72 @@
111 <goals> 111 <goals>
112 <goal>build</goal> 112 <goal>build</goal>
113 </goals> 113 </goals>
  114 + <configuration>
  115 + <skip>${dockerfile.skip}</skip>
  116 + <repository>${docker.repo}/${docker.name}</repository>
  117 + <verbose>true</verbose>
  118 + <googleContainerRegistryEnabled>false</googleContainerRegistryEnabled>
  119 + <contextDirectory>${project.build.directory}</contextDirectory>
  120 + </configuration>
  121 + </execution>
  122 + <execution>
  123 + <id>tag-docker-image</id>
  124 + <phase>pre-integration-test</phase>
  125 + <goals>
  126 + <goal>tag</goal>
  127 + </goals>
  128 + <configuration>
  129 + <skip>${dockerfile.skip}</skip>
  130 + <repository>${docker.repo}/${docker.name}</repository>
  131 + <tag>${project.version}</tag>
  132 + </configuration>
114 </execution> 133 </execution>
115 </executions> 134 </executions>
116 - <configuration>  
117 - <skip>${dockerfile.skip}</skip>  
118 - <repository>${docker.repo}/${docker.name}</repository>  
119 - <tag>${project.version}</tag>  
120 - <verbose>true</verbose>  
121 - <googleContainerRegistryEnabled>false</googleContainerRegistryEnabled>  
122 - <contextDirectory>${project.build.directory}</contextDirectory>  
123 - </configuration>  
124 </plugin> 135 </plugin>
125 </plugins> 136 </plugins>
126 </build> 137 </build>
  138 + <profiles>
  139 + <profile>
  140 + <id>push-docker-image</id>
  141 + <activation>
  142 + <property>
  143 + <name>push-docker-image</name>
  144 + </property>
  145 + </activation>
  146 + <build>
  147 + <plugins>
  148 + <plugin>
  149 + <groupId>com.spotify</groupId>
  150 + <artifactId>dockerfile-maven-plugin</artifactId>
  151 + <executions>
  152 + <execution>
  153 + <id>push-latest-docker-image</id>
  154 + <phase>pre-integration-test</phase>
  155 + <goals>
  156 + <goal>push</goal>
  157 + </goals>
  158 + <configuration>
  159 + <tag>latest</tag>
  160 + <repository>${docker.repo}/${docker.name}</repository>
  161 + </configuration>
  162 + </execution>
  163 + <execution>
  164 + <id>push-version-docker-image</id>
  165 + <phase>pre-integration-test</phase>
  166 + <goals>
  167 + <goal>push</goal>
  168 + </goals>
  169 + <configuration>
  170 + <tag>${project.version}</tag>
  171 + <repository>${docker.repo}/${docker.name}</repository>
  172 + </configuration>
  173 + </execution>
  174 + </executions>
  175 + </plugin>
  176 + </plugins>
  177 + </build>
  178 + </profile>
  179 + </profiles>
127 <repositories> 180 <repositories>
128 <repository> 181 <repository>
129 <id>jenkins</id> 182 <id>jenkins</id>
@@ -111,19 +111,72 @@ @@ -111,19 +111,72 @@
111 <goals> 111 <goals>
112 <goal>build</goal> 112 <goal>build</goal>
113 </goals> 113 </goals>
  114 + <configuration>
  115 + <skip>${dockerfile.skip}</skip>
  116 + <repository>${docker.repo}/${docker.name}</repository>
  117 + <verbose>true</verbose>
  118 + <googleContainerRegistryEnabled>false</googleContainerRegistryEnabled>
  119 + <contextDirectory>${project.build.directory}</contextDirectory>
  120 + </configuration>
  121 + </execution>
  122 + <execution>
  123 + <id>tag-docker-image</id>
  124 + <phase>pre-integration-test</phase>
  125 + <goals>
  126 + <goal>tag</goal>
  127 + </goals>
  128 + <configuration>
  129 + <skip>${dockerfile.skip}</skip>
  130 + <repository>${docker.repo}/${docker.name}</repository>
  131 + <tag>${project.version}</tag>
  132 + </configuration>
114 </execution> 133 </execution>
115 </executions> 134 </executions>
116 - <configuration>  
117 - <skip>${dockerfile.skip}</skip>  
118 - <repository>${docker.repo}/${docker.name}</repository>  
119 - <tag>${project.version}</tag>  
120 - <verbose>true</verbose>  
121 - <googleContainerRegistryEnabled>false</googleContainerRegistryEnabled>  
122 - <contextDirectory>${project.build.directory}</contextDirectory>  
123 - </configuration>  
124 </plugin> 135 </plugin>
125 </plugins> 136 </plugins>
126 </build> 137 </build>
  138 + <profiles>
  139 + <profile>
  140 + <id>push-docker-image</id>
  141 + <activation>
  142 + <property>
  143 + <name>push-docker-image</name>
  144 + </property>
  145 + </activation>
  146 + <build>
  147 + <plugins>
  148 + <plugin>
  149 + <groupId>com.spotify</groupId>
  150 + <artifactId>dockerfile-maven-plugin</artifactId>
  151 + <executions>
  152 + <execution>
  153 + <id>push-latest-docker-image</id>
  154 + <phase>pre-integration-test</phase>
  155 + <goals>
  156 + <goal>push</goal>
  157 + </goals>
  158 + <configuration>
  159 + <tag>latest</tag>
  160 + <repository>${docker.repo}/${docker.name}</repository>
  161 + </configuration>
  162 + </execution>
  163 + <execution>
  164 + <id>push-version-docker-image</id>
  165 + <phase>pre-integration-test</phase>
  166 + <goals>
  167 + <goal>push</goal>
  168 + </goals>
  169 + <configuration>
  170 + <tag>${project.version}</tag>
  171 + <repository>${docker.repo}/${docker.name}</repository>
  172 + </configuration>
  173 + </execution>
  174 + </executions>
  175 + </plugin>
  176 + </plugins>
  177 + </build>
  178 + </profile>
  179 + </profiles>
127 <repositories> 180 <repositories>
128 <repository> 181 <repository>
129 <id>jenkins</id> 182 <id>jenkins</id>
@@ -311,16 +311,27 @@ @@ -311,16 +311,27 @@
311 <goals> 311 <goals>
312 <goal>build</goal> 312 <goal>build</goal>
313 </goals> 313 </goals>
  314 + <configuration>
  315 + <skip>${dockerfile.skip}</skip>
  316 + <repository>${docker.repo}/${docker.name}</repository>
  317 + <verbose>true</verbose>
  318 + <googleContainerRegistryEnabled>false</googleContainerRegistryEnabled>
  319 + <contextDirectory>${project.build.directory}</contextDirectory>
  320 + </configuration>
  321 + </execution>
  322 + <execution>
  323 + <id>tag-docker-image</id>
  324 + <phase>pre-integration-test</phase>
  325 + <goals>
  326 + <goal>tag</goal>
  327 + </goals>
  328 + <configuration>
  329 + <skip>${dockerfile.skip}</skip>
  330 + <repository>${docker.repo}/${docker.name}</repository>
  331 + <tag>${project.version}</tag>
  332 + </configuration>
314 </execution> 333 </execution>
315 </executions> 334 </executions>
316 - <configuration>  
317 - <skip>${dockerfile.skip}</skip>  
318 - <repository>${docker.repo}/${docker.name}</repository>  
319 - <tag>${project.version}</tag>  
320 - <verbose>true</verbose>  
321 - <googleContainerRegistryEnabled>false</googleContainerRegistryEnabled>  
322 - <contextDirectory>${project.build.directory}</contextDirectory>  
323 - </configuration>  
324 </plugin> 335 </plugin>
325 </plugins> 336 </plugins>
326 </build> 337 </build>
@@ -358,6 +369,46 @@ @@ -358,6 +369,46 @@
358 </plugins> 369 </plugins>
359 </build> 370 </build>
360 </profile> 371 </profile>
  372 + <profile>
  373 + <id>push-docker-image</id>
  374 + <activation>
  375 + <property>
  376 + <name>push-docker-image</name>
  377 + </property>
  378 + </activation>
  379 + <build>
  380 + <plugins>
  381 + <plugin>
  382 + <groupId>com.spotify</groupId>
  383 + <artifactId>dockerfile-maven-plugin</artifactId>
  384 + <executions>
  385 + <execution>
  386 + <id>push-latest-docker-image</id>
  387 + <phase>pre-integration-test</phase>
  388 + <goals>
  389 + <goal>push</goal>
  390 + </goals>
  391 + <configuration>
  392 + <tag>latest</tag>
  393 + <repository>${docker.repo}/${docker.name}</repository>
  394 + </configuration>
  395 + </execution>
  396 + <execution>
  397 + <id>push-version-docker-image</id>
  398 + <phase>pre-integration-test</phase>
  399 + <goals>
  400 + <goal>push</goal>
  401 + </goals>
  402 + <configuration>
  403 + <tag>${project.version}</tag>
  404 + <repository>${docker.repo}/${docker.name}</repository>
  405 + </configuration>
  406 + </execution>
  407 + </executions>
  408 + </plugin>
  409 + </plugins>
  410 + </build>
  411 + </profile>
361 </profiles> 412 </profiles>
362 <repositories> 413 <repositories>
363 <repository> 414 <repository>