Commit be8f7062a46128fede2ba97ae88345a2c4d60502

Authored by Volodymyr Babak
1 parent d1f9f25f

Docker updates to new release features

... ... @@ -115,7 +115,9 @@ cassandra:
115 115 # Thingsboard keyspace name
116 116 keyspace_name: "${CASSANDRA_KEYSPACE_NAME:thingsboard}"
117 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 121 # Enable/disable secure connection
120 122 ssl: "${CASSANDRA_USE_SSL:false}"
121 123 # Enable/disable JMX
... ...
... ... @@ -44,7 +44,7 @@ public abstract class AbstractCassandraCluster {
44 44
45 45 @Value("${cassandra.cluster_name}")
46 46 private String clusterName;
47   - @Value("${cassandra.url}")
  47 + @Value("${cassandra.host}:${cassandra.port}")
48 48 private String url;
49 49 @Value("${cassandra.compression}")
50 50 private String compression;
... ...
... ... @@ -2,7 +2,9 @@ cassandra.cluster_name=Thingsboard Cluster
2 2
3 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 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 7
8 8 push: build
9 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 50 data:
51 51 zookeeper.enabled: "true"
52 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 57 apiVersion: apps/v1beta1
56 58 kind: StatefulSet
... ... @@ -100,11 +102,21 @@ spec:
100 102 configMapKeyRef:
101 103 name: tb-config
102 104 key: zookeeper.url
103   - - name : CASSANDRA_URL
  105 + - name : CASSANDRA_HOST
104 106 valueFrom:
105 107 configMapKeyRef:
106 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 120 - name : RPC_HOST
109 121 valueFrom:
110 122 fieldRef:
... ...
... ... @@ -8,10 +8,11 @@ COAP_BIND_PORT=5683
8 8 ZOOKEEPER_URL=zk:2181
9 9
10 10 # type of database to use: sql[DEFAULT] or cassandra
11   -DATABASE_TYPE=sql
  11 +DATABASE_TYPE=cassandra
12 12
13 13 # cassandra db config
14   -CASSANDRA_URL=cassandra:9042
  14 +CASSANDRA_HOST=cassandra
  15 +CASSANDRA_PORT=9042
15 16
16 17 # postgres db config
17 18 # SPRING_JPA_DATABASE_PLATFORM=org.hibernate.dialect.PostgreSQLDialect
... ...
... ... @@ -9,4 +9,4 @@ build:
9 9
10 10 push: build
11 11 docker push ${PROJECT}/${APP}:${VERSION}
12   - docker push ${PROJECT}/${APP}:latest
  12 + docker push ${PROJECT}/${APP}:latest
... ...
... ... @@ -19,7 +19,7 @@
19 19 dpkg -i /thingsboard.deb
20 20
21 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 23 do
24 24 echo "Wait for cassandra db to start..."
25 25 sleep 10
... ... @@ -39,7 +39,7 @@ fi
39 39 if [ "$ADD_SCHEMA_AND_SYSTEM_DATA" == "true" ]; then
40 40 echo "Creating 'Thingsboard' schema and system data..."
41 41 if [ "$ADD_DEMO_DATA" == "true" ]; then
42   - echo "Adding demo data..."
  42 + echo "plus demo data..."
43 43 /usr/share/thingsboard/bin/install/install.sh --loadDemo
44 44 elif [ "$ADD_DEMO_DATA" == "false" ]; then
45 45 /usr/share/thingsboard/bin/install/install.sh
... ...