Commit 868f5d3ca12513cc3abc08b94787b5d18464dddc

Authored by Volodymyr Babak
1 parent 08e5feea

Renaming + refactoring

... ... @@ -3,4 +3,5 @@ CASSANDRA_DATA_DIR=/home/docker/cassandra_volume
3 3 # cassandra schema container environment variables
4 4 SKIP_SCHEMA_CREATION=false
5 5 SKIP_SYSTEM_DATA=true
6   -SKIP_DEMO_DATA=true
\ No newline at end of file
  6 +SKIP_DEMO_DATA=true
  7 +CASSANDRA_URL=cassandra
\ No newline at end of file
... ...
... ... @@ -17,7 +17,7 @@
17 17 version: '2'
18 18
19 19 services:
20   - db:
  20 + cassandra:
21 21 ports:
22 22 - "9042"
23 23 - "9160"
... ...
... ... @@ -17,7 +17,7 @@
17 17 version: '2'
18 18
19 19 services:
20   - db:
  20 + cassandra:
21 21 ports:
22 22 - "9042:9042"
23 23 - "9160:9160"
... ...
... ... @@ -17,26 +17,27 @@
17 17 version: '2'
18 18
19 19 services:
20   - thingsboard:
21   - image: "thingsboard/application:1.2.3"
  20 + tb:
  21 + image: "thingsboard/application:k8stest"
22 22 ports:
23 23 - "8080:8080"
24   - - "1883:1883"
  24 + - "1884:1883"
25 25 - "5683:5683/udp"
26 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 31 environment:
32 32 - SKIP_SCHEMA_CREATION=${SKIP_SCHEMA_CREATION}
33 33 - SKIP_SYSTEM_DATA=${SKIP_SYSTEM_DATA}
34 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 39 volumes:
39 40 - "${CASSANDRA_DATA_DIR}:/var/lib/cassandra"
40 41 zk:
41   - image: "zookeeper:3.4.9"
  42 + image: "thingsboard/zk:k8stest"
42 43 restart: always
... ...
docker/tb-cassandra-schema/Dockerfile renamed from docker/thingsboard-db-schema/Dockerfile
... ... @@ -16,12 +16,12 @@
16 16
17 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 21 RUN apt-get update \
22 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 26 ADD schema.cql /root/schema.cql
27 27 ADD demo-data.cql /root/demo-data.cql
... ...
docker/tb-cassandra-schema/Makefile renamed from docker/thingsboard-db-schema/Makefile
1 1 VERSION=k8stest
2 2 PROJECT=thingsboard
3   -APP=thingsboard-db-schema
  3 +APP=tb-cassandra-schema
4 4
5 5 build:
6 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 17 apiVersion: v1
18 18 kind: Pod
19 19 metadata:
20   - name: tb-db-schema
  20 + name: tb-cassandra-schema
21 21 spec:
22 22 containers:
23   - - name: tb-db-schema
  23 + - name: tb-cassandra-schema
24 24 imagePullPolicy: Always
25   - image: thingsboard/thingsboard-db-schema:k8stest
  25 + image: thingsboard/tb-cassandra-schema:k8stest
26 26 env:
27 27 - name: SKIP_SCHEMA_CREATION
28 28 value: "false"
... ... @@ -35,5 +35,5 @@ spec:
35 35 command:
36 36 - sh
37 37 - -c
38   - - ./install_schema.sh
  38 + - ./install-schema.sh
39 39 restartPolicy: Never
\ No newline at end of file
... ...
docker/tb.env renamed from docker/thingsboard.env
1 1 #Thingsboard server configuration
2 2
3   -CASSANDRA_URL=db:9042
  3 +CASSANDRA_URL=cassandra:9042
4 4 ZOOKEEPER_URL=zk:2181
5 5 MQTT_BIND_ADDRESS=0.0.0.0
6 6 MQTT_BIND_PORT=1883
... ...
docker/tb/Dockerfile renamed from docker/thingsboard/Dockerfile
... ... @@ -16,9 +16,9 @@
16 16
17 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 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 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 21 reachable=0
22 22 while [ $reachable -eq 0 ];
23 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 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 27 if [ "$?" -ne 0 ];
28 28 then
29   - echo "thingsboard-db-schema container completed!"
  29 + echo "tb-cassandra-schema container completed!"
30 30 reachable=1
31 31 fi
32 32 done
... ...
docker/tb/tb.yaml renamed from docker/thingsboard/thingsboard.yaml
... ... @@ -112,7 +112,7 @@ spec:
112 112 command:
113 113 - sh
114 114 - -c
115   - - ./run_thingsboard.sh
  115 + - ./run-application.sh
116 116 livenessProbe:
117 117 httpGet:
118 118 path: /login
... ...
... ... @@ -55,7 +55,7 @@ RUN set -x \
55 55 && rm -rf /var/lib/apt/lists/*
56 56
57 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 60 # Create a user for the zookeeper process and configure file system ownership
61 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 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 19 # is health. The $? variable will be set to 0 if server responds that it is
20 20 # healthy, or 1 if the server fails to respond.
21 21
... ...
... ... @@ -159,17 +159,17 @@ spec:
159 159 command:
160 160 - sh
161 161 - -c
162   - - zkGenConfig.sh && zkServer.sh start-foreground
  162 + - zk-gen-config.sh && zkServer.sh start-foreground
163 163 readinessProbe:
164 164 exec:
165 165 command:
166   - - "zkOk.sh"
  166 + - "zk-ok.sh"
167 167 initialDelaySeconds: 15
168 168 timeoutSeconds: 5
169 169 livenessProbe:
170 170 exec:
171 171 command:
172   - - "zkOk.sh"
  172 + - "zk-ok.sh"
173 173 initialDelaySeconds: 15
174 174 timeoutSeconds: 5
175 175 volumeMounts:
... ...