Commit be8f7062a46128fede2ba97ae88345a2c4d60502

Authored by Volodymyr Babak
1 parent d1f9f25f

Docker updates to new release features

@@ -115,7 +115,9 @@ cassandra: @@ -115,7 +115,9 @@ cassandra:
115 # Thingsboard keyspace name 115 # Thingsboard keyspace name
116 keyspace_name: "${CASSANDRA_KEYSPACE_NAME:thingsboard}" 116 keyspace_name: "${CASSANDRA_KEYSPACE_NAME:thingsboard}"
117 # Specify node list 117 # Specify node list
118 - url: "${CASSANDRA_URL:127.0.0.1:9042}" 118 + host: "${CASSANDRA_HOST:127.0.0.1}"
  119 + # Specify node list
  120 + post: "${CASSANDRA_PORT:9042}"
119 # Enable/disable secure connection 121 # Enable/disable secure connection
120 ssl: "${CASSANDRA_USE_SSL:false}" 122 ssl: "${CASSANDRA_USE_SSL:false}"
121 # Enable/disable JMX 123 # Enable/disable JMX
@@ -44,7 +44,7 @@ public abstract class AbstractCassandraCluster { @@ -44,7 +44,7 @@ public abstract class AbstractCassandraCluster {
44 44
45 @Value("${cassandra.cluster_name}") 45 @Value("${cassandra.cluster_name}")
46 private String clusterName; 46 private String clusterName;
47 - @Value("${cassandra.url}") 47 + @Value("${cassandra.host}:${cassandra.port}")
48 private String url; 48 private String url;
49 @Value("${cassandra.compression}") 49 @Value("${cassandra.compression}")
50 private String compression; 50 private String compression;
@@ -2,7 +2,9 @@ cassandra.cluster_name=Thingsboard Cluster @@ -2,7 +2,9 @@ cassandra.cluster_name=Thingsboard Cluster
2 2
3 cassandra.keyspace_name=thingsboard 3 cassandra.keyspace_name=thingsboard
4 4
5 -cassandra.url=127.0.0.1:9142 5 +cassandra.host=127.0.0.1
  6 +
  7 +cassandra.port=9142
6 8
7 cassandra.ssl=false 9 cassandra.ssl=false
8 10
  1 +#
  2 +# Copyright © 2016-2017 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 +ADD install.sh /install.sh
  20 +ADD thingsboard.deb /thingsboard.deb
  21 +
  22 +RUN apt-get update \
  23 + && apt-get install -y nmap \
  24 + && chmod +x /install.sh
  1 +VERSION=1.2.4
  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 +#!/bin/bash
  2 +#
  3 +# Copyright © 2016-2017 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 +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
  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
@@ -7,4 +7,4 @@ build: @@ -7,4 +7,4 @@ build:
7 7
8 push: build 8 push: build
9 docker push ${PROJECT}/${APP}:${VERSION} 9 docker push ${PROJECT}/${APP}:${VERSION}
10 - docker push ${PROJECT}/${APP}:latest 10 + docker push ${PROJECT}/${APP}:latest
  1 +#
  2 +# Copyright © 2016-2017 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:1.2.4
  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_TYPE
  34 + value: "cassandra"
  35 + command:
  36 + - sh
  37 + - -c
  38 + - /install.sh
  39 + restartPolicy: Never
@@ -50,7 +50,9 @@ metadata: @@ -50,7 +50,9 @@ metadata:
50 data: 50 data:
51 zookeeper.enabled: "true" 51 zookeeper.enabled: "true"
52 zookeeper.url: "zk-headless" 52 zookeeper.url: "zk-headless"
53 - cassandra.url: "cassandra-headless:9042" 53 + cassandra.host: "cassandra-headless"
  54 + cassandra.port: "9042"
  55 + database.type: "cassandra"
54 --- 56 ---
55 apiVersion: apps/v1beta1 57 apiVersion: apps/v1beta1
56 kind: StatefulSet 58 kind: StatefulSet
@@ -100,11 +102,21 @@ spec: @@ -100,11 +102,21 @@ spec:
100 configMapKeyRef: 102 configMapKeyRef:
101 name: tb-config 103 name: tb-config
102 key: zookeeper.url 104 key: zookeeper.url
103 - - name : CASSANDRA_URL 105 + - name : CASSANDRA_HOST
104 valueFrom: 106 valueFrom:
105 configMapKeyRef: 107 configMapKeyRef:
106 name: tb-config 108 name: tb-config
107 - key: cassandra.url 109 + key: cassandra.host
  110 + - name : CASSANDRA_PORT
  111 + valueFrom:
  112 + configMapKeyRef:
  113 + name: tb-config
  114 + key: cassandra.port
  115 + - name: DATABASE_TYPE
  116 + valueFrom:
  117 + configMapKeyRef:
  118 + name: tb-config
  119 + key: database.type
108 - name : RPC_HOST 120 - name : RPC_HOST
109 valueFrom: 121 valueFrom:
110 fieldRef: 122 fieldRef:
@@ -8,10 +8,11 @@ COAP_BIND_PORT=5683 @@ -8,10 +8,11 @@ COAP_BIND_PORT=5683
8 ZOOKEEPER_URL=zk:2181 8 ZOOKEEPER_URL=zk:2181
9 9
10 # type of database to use: sql[DEFAULT] or cassandra 10 # type of database to use: sql[DEFAULT] or cassandra
11 -DATABASE_TYPE=sql 11 +DATABASE_TYPE=cassandra
12 12
13 # cassandra db config 13 # cassandra db config
14 -CASSANDRA_URL=cassandra:9042 14 +CASSANDRA_HOST=cassandra
  15 +CASSANDRA_PORT=9042
15 16
16 # postgres db config 17 # postgres db config
17 # SPRING_JPA_DATABASE_PLATFORM=org.hibernate.dialect.PostgreSQLDialect 18 # SPRING_JPA_DATABASE_PLATFORM=org.hibernate.dialect.PostgreSQLDialect
@@ -9,4 +9,4 @@ build: @@ -9,4 +9,4 @@ build:
9 9
10 push: build 10 push: build
11 docker push ${PROJECT}/${APP}:${VERSION} 11 docker push ${PROJECT}/${APP}:${VERSION}
12 - docker push ${PROJECT}/${APP}:latest 12 + docker push ${PROJECT}/${APP}:latest
@@ -19,7 +19,7 @@ @@ -19,7 +19,7 @@
19 dpkg -i /thingsboard.deb 19 dpkg -i /thingsboard.deb
20 20
21 if [ "$DATABASE_TYPE" == "cassandra" ]; then 21 if [ "$DATABASE_TYPE" == "cassandra" ]; then
22 - until nmap cassandra -p 9042 | grep "9042/tcp open" 22 + until nmap $CASSANDRA_HOST -p $CASSANDRA_PORT | grep "$CASSANDRA_PORT/tcp open"
23 do 23 do
24 echo "Wait for cassandra db to start..." 24 echo "Wait for cassandra db to start..."
25 sleep 10 25 sleep 10
@@ -39,7 +39,7 @@ fi @@ -39,7 +39,7 @@ fi
39 if [ "$ADD_SCHEMA_AND_SYSTEM_DATA" == "true" ]; then 39 if [ "$ADD_SCHEMA_AND_SYSTEM_DATA" == "true" ]; then
40 echo "Creating 'Thingsboard' schema and system data..." 40 echo "Creating 'Thingsboard' schema and system data..."
41 if [ "$ADD_DEMO_DATA" == "true" ]; then 41 if [ "$ADD_DEMO_DATA" == "true" ]; then
42 - echo "Adding demo data..." 42 + echo "plus demo data..."
43 /usr/share/thingsboard/bin/install/install.sh --loadDemo 43 /usr/share/thingsboard/bin/install/install.sh --loadDemo
44 elif [ "$ADD_DEMO_DATA" == "false" ]; then 44 elif [ "$ADD_DEMO_DATA" == "false" ]; then
45 /usr/share/thingsboard/bin/install/install.sh 45 /usr/share/thingsboard/bin/install/install.sh