Commit 868f5d3ca12513cc3abc08b94787b5d18464dddc

Authored by Volodymyr Babak
1 parent 08e5feea

Renaming + refactoring

@@ -3,4 +3,5 @@ CASSANDRA_DATA_DIR=/home/docker/cassandra_volume @@ -3,4 +3,5 @@ CASSANDRA_DATA_DIR=/home/docker/cassandra_volume
3 # cassandra schema container environment variables 3 # cassandra schema container environment variables
4 SKIP_SCHEMA_CREATION=false 4 SKIP_SCHEMA_CREATION=false
5 SKIP_SYSTEM_DATA=true 5 SKIP_SYSTEM_DATA=true
6 -SKIP_DEMO_DATA=true  
  6 +SKIP_DEMO_DATA=true
  7 +CASSANDRA_URL=cassandra
@@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
17 version: '2' 17 version: '2'
18 18
19 services: 19 services:
20 - db: 20 + cassandra:
21 ports: 21 ports:
22 - "9042" 22 - "9042"
23 - "9160" 23 - "9160"
@@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
17 version: '2' 17 version: '2'
18 18
19 services: 19 services:
20 - db: 20 + cassandra:
21 ports: 21 ports:
22 - "9042:9042" 22 - "9042:9042"
23 - "9160:9160" 23 - "9160:9160"
@@ -17,26 +17,27 @@ @@ -17,26 +17,27 @@
17 version: '2' 17 version: '2'
18 18
19 services: 19 services:
20 - thingsboard:  
21 - image: "thingsboard/application:1.2.3" 20 + tb:
  21 + image: "thingsboard/application:k8stest"
22 ports: 22 ports:
23 - "8080:8080" 23 - "8080:8080"
24 - - "1883:1883" 24 + - "1884:1883"
25 - "5683:5683/udp" 25 - "5683:5683/udp"
26 env_file: 26 env_file:
27 - - thingsboard.env  
28 - entrypoint: ./run_thingsboard.sh  
29 - thingsboard-db-schema:  
30 - image: "thingsboard/thingsboard-db-schema:1.2.3" 27 + - tb.env
  28 + entrypoint: ./run-application.sh
  29 + tb-cassandra-schema:
  30 + image: "thingsboard/tb-cassandra-schema:k8stest"
31 environment: 31 environment:
32 - SKIP_SCHEMA_CREATION=${SKIP_SCHEMA_CREATION} 32 - SKIP_SCHEMA_CREATION=${SKIP_SCHEMA_CREATION}
33 - SKIP_SYSTEM_DATA=${SKIP_SYSTEM_DATA} 33 - SKIP_SYSTEM_DATA=${SKIP_SYSTEM_DATA}
34 - SKIP_DEMO_DATA=${SKIP_DEMO_DATA} 34 - SKIP_DEMO_DATA=${SKIP_DEMO_DATA}
35 - entrypoint: ./install_schema.sh  
36 - db:  
37 - image: "cassandra:3.9" 35 + - CASSANDRA_URL=${CASSANDRA_URL}
  36 + entrypoint: ./install-schema.sh
  37 + cassandra:
  38 + image: "thingsboard/cassandra:k8stest"
38 volumes: 39 volumes:
39 - "${CASSANDRA_DATA_DIR}:/var/lib/cassandra" 40 - "${CASSANDRA_DATA_DIR}:/var/lib/cassandra"
40 zk: 41 zk:
41 - image: "zookeeper:3.4.9" 42 + image: "thingsboard/zk:k8stest"
42 restart: always 43 restart: always
docker/tb-cassandra-schema/Dockerfile renamed from docker/thingsboard-db-schema/Dockerfile
@@ -16,12 +16,12 @@ @@ -16,12 +16,12 @@
16 16
17 FROM cassandra:3.9 17 FROM cassandra:3.9
18 18
19 -ADD install_schema.sh /root/install_schema.sh 19 +ADD install-schema.sh /root/install-schema.sh
20 20
21 RUN apt-get update \ 21 RUN apt-get update \
22 && apt-get install -y nmap 22 && apt-get install -y nmap
23 23
24 -RUN chmod +x /root/install_schema.sh 24 +RUN chmod +x /root/install-schema.sh
25 25
26 ADD schema.cql /root/schema.cql 26 ADD schema.cql /root/schema.cql
27 ADD demo-data.cql /root/demo-data.cql 27 ADD demo-data.cql /root/demo-data.cql
docker/tb-cassandra-schema/Makefile renamed from docker/thingsboard-db-schema/Makefile
1 VERSION=k8stest 1 VERSION=k8stest
2 PROJECT=thingsboard 2 PROJECT=thingsboard
3 -APP=thingsboard-db-schema 3 +APP=tb-cassandra-schema
4 4
5 build: 5 build:
6 cp ../../dao/src/main/resources/schema.cql . 6 cp ../../dao/src/main/resources/schema.cql .
docker/tb-cassandra-schema/install-schema.sh renamed from docker/thingsboard-db-schema/install_schema.sh
docker/tb-cassandra-schema/tb-cassandra-schema.yaml renamed from docker/thingsboard-db-schema/thingsboard-db-schema.yaml
@@ -17,12 +17,12 @@ @@ -17,12 +17,12 @@
17 apiVersion: v1 17 apiVersion: v1
18 kind: Pod 18 kind: Pod
19 metadata: 19 metadata:
20 - name: tb-db-schema 20 + name: tb-cassandra-schema
21 spec: 21 spec:
22 containers: 22 containers:
23 - - name: tb-db-schema 23 + - name: tb-cassandra-schema
24 imagePullPolicy: Always 24 imagePullPolicy: Always
25 - image: thingsboard/thingsboard-db-schema:k8stest 25 + image: thingsboard/tb-cassandra-schema:k8stest
26 env: 26 env:
27 - name: SKIP_SCHEMA_CREATION 27 - name: SKIP_SCHEMA_CREATION
28 value: "false" 28 value: "false"
@@ -35,5 +35,5 @@ spec: @@ -35,5 +35,5 @@ spec:
35 command: 35 command:
36 - sh 36 - sh
37 - -c 37 - -c
38 - - ./install_schema.sh 38 + - ./install-schema.sh
39 restartPolicy: Never 39 restartPolicy: Never
docker/tb.env renamed from docker/thingsboard.env
1 #Thingsboard server configuration 1 #Thingsboard server configuration
2 2
3 -CASSANDRA_URL=db:9042 3 +CASSANDRA_URL=cassandra:9042
4 ZOOKEEPER_URL=zk:2181 4 ZOOKEEPER_URL=zk:2181
5 MQTT_BIND_ADDRESS=0.0.0.0 5 MQTT_BIND_ADDRESS=0.0.0.0
6 MQTT_BIND_PORT=1883 6 MQTT_BIND_PORT=1883
docker/tb/Dockerfile renamed from docker/thingsboard/Dockerfile
@@ -16,9 +16,9 @@ @@ -16,9 +16,9 @@
16 16
17 FROM openjdk:8-jre 17 FROM openjdk:8-jre
18 18
19 -ADD run_thingsboard.sh /root/run_thingsboard.sh 19 +ADD run-application.sh /root/run-application.sh
20 ADD thingsboard.deb /root/thingsboard.deb 20 ADD thingsboard.deb /root/thingsboard.deb
21 21
22 -RUN chmod +x /root/run_thingsboard.sh 22 +RUN chmod +x /root/run-application.sh
23 23
24 WORKDIR /root 24 WORKDIR /root
docker/tb/Makefile renamed from docker/thingsboard/Makefile
docker/tb/run-application.sh renamed from docker/thingsboard/run_thingsboard.sh
@@ -21,12 +21,12 @@ dpkg -i /root/thingsboard.deb @@ -21,12 +21,12 @@ dpkg -i /root/thingsboard.deb
21 reachable=0 21 reachable=0
22 while [ $reachable -eq 0 ]; 22 while [ $reachable -eq 0 ];
23 do 23 do
24 - echo "thingsboard-db-schema container is still in progress. waiting until it completed..." 24 + echo "tb-cassandra-schema container is still in progress. waiting until it completed..."
25 sleep 3 25 sleep 3
26 - ping -q -c 1 thingsboard-db-schema > /dev/null 2>&1 26 + ping -q -c 1 tb-cassandra-schema > /dev/null 2>&1
27 if [ "$?" -ne 0 ]; 27 if [ "$?" -ne 0 ];
28 then 28 then
29 - echo "thingsboard-db-schema container completed!" 29 + echo "tb-cassandra-schema container completed!"
30 reachable=1 30 reachable=1
31 fi 31 fi
32 done 32 done
docker/tb/tb.yaml renamed from docker/thingsboard/thingsboard.yaml
@@ -112,7 +112,7 @@ spec: @@ -112,7 +112,7 @@ spec:
112 command: 112 command:
113 - sh 113 - sh
114 - -c 114 - -c
115 - - ./run_thingsboard.sh 115 + - ./run-application.sh
116 livenessProbe: 116 livenessProbe:
117 httpGet: 117 httpGet:
118 path: /login 118 path: /login
@@ -55,7 +55,7 @@ RUN set -x \ @@ -55,7 +55,7 @@ RUN set -x \
55 && rm -rf /var/lib/apt/lists/* 55 && rm -rf /var/lib/apt/lists/*
56 56
57 #Copy configuration generator script to bin 57 #Copy configuration generator script to bin
58 -COPY zkGenConfig.sh zkOk.sh /opt/zookeeper/bin/ 58 +COPY zk-gen-config.sh zk-ok.sh /opt/zookeeper/bin/
59 59
60 # Create a user for the zookeeper process and configure file system ownership 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 61 # for nessecary directories and symlink the distribution as a user executable
docker/zookeeper/zk-gen-config.sh renamed from docker/zookeeper/zkGenConfig.sh
docker/zookeeper/zk-ok.sh renamed from docker/zookeeper/zkOk.sh
@@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
15 # limitations under the License. 15 # limitations under the License.
16 # 16 #
17 17
18 -# zkOk.sh uses the ruok ZooKeeper four letter work to determine if the instance 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 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. 20 # healthy, or 1 if the server fails to respond.
21 21
@@ -159,17 +159,17 @@ spec: @@ -159,17 +159,17 @@ spec:
159 command: 159 command:
160 - sh 160 - sh
161 - -c 161 - -c
162 - - zkGenConfig.sh && zkServer.sh start-foreground 162 + - zk-gen-config.sh && zkServer.sh start-foreground
163 readinessProbe: 163 readinessProbe:
164 exec: 164 exec:
165 command: 165 command:
166 - - "zkOk.sh" 166 + - "zk-ok.sh"
167 initialDelaySeconds: 15 167 initialDelaySeconds: 15
168 timeoutSeconds: 5 168 timeoutSeconds: 5
169 livenessProbe: 169 livenessProbe:
170 exec: 170 exec:
171 command: 171 command:
172 - - "zkOk.sh" 172 + - "zk-ok.sh"
173 initialDelaySeconds: 15 173 initialDelaySeconds: 15
174 timeoutSeconds: 5 174 timeoutSeconds: 5
175 volumeMounts: 175 volumeMounts: