Docker updates to new release features
This commit is contained in:
parent
f87e5d66bf
commit
49feb9132c
@ -233,7 +233,7 @@ spring:
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: "validate"
|
||||
database-platform: "org.hibernate.dialect.HSQLDialect"
|
||||
database-platform: "${SPRING_JPA_DATABASE_PLATFORM:org.hibernate.dialect.HSQLDialect}"
|
||||
datasource:
|
||||
driverClassName: "${SPRING_DRIVER_CLASS_NAME:org.hsqldb.jdbc.JDBCDriver}"
|
||||
url: "${SPRING_DATASOURCE_URL:jdbc:hsqldb:file:${SQL_DATA_FOLDER:/tmp}/thingsboardDb;sql.enforce_size=false}"
|
||||
@ -250,7 +250,7 @@ spring:
|
||||
# jpa:
|
||||
# hibernate:
|
||||
# ddl-auto: "validate"
|
||||
# database-platform: "org.hibernate.dialect.PostgreSQLDialect"
|
||||
# database-platform: "${SPRING_JPA_DATABASE_PLATFORM:org.hibernate.dialect.PostgreSQLDialect}"
|
||||
# datasource:
|
||||
# driverClassName: "${SPRING_DRIVER_CLASS_NAME:org.postgresql.Driver}"
|
||||
# url: "${SPRING_DATASOURCE_URL:jdbc:postgresql://localhost:5432/thingsboard}"
|
||||
|
||||
10
docker/.env
10
docker/.env
@ -1,15 +1,13 @@
|
||||
# cassandra environment variables
|
||||
CASSANDRA_DATA_DIR=/home/docker/cassandra_volume
|
||||
CASSANDRA_URL=cassandra
|
||||
|
||||
# postgres environment variables
|
||||
POSTGRES_DATA_DIR=/home/docker/postgres_volume
|
||||
POSTGRES_DB=thingsboard
|
||||
POSTGRES_USER=postgres
|
||||
POSTGRES_PASSWORD=postgres
|
||||
POSTGRES_URL=postgres
|
||||
|
||||
# hsqldb environment variables
|
||||
HSQLDB_DATA_DIR=/home/docker/hsqldb_volume
|
||||
|
||||
# environment variables for schema init and insert system and demo data
|
||||
CREATE_SCHEMA=true
|
||||
ADD_SYSTEM_DATA=false
|
||||
ADD_SCHEMA_AND_SYSTEM_DATA=false
|
||||
ADD_DEMO_DATA=false
|
||||
@ -25,15 +25,12 @@ services:
|
||||
- "5683:5683/udp"
|
||||
env_file:
|
||||
- tb.env
|
||||
entrypoint: /run-application.sh
|
||||
tb-cassandra-schema:
|
||||
image: "thingsboard/tb-cassandra-schema:1.2.4"
|
||||
environment:
|
||||
- CREATE_SCHEMA=${CREATE_SCHEMA}
|
||||
- ADD_SYSTEM_DATA=${ADD_SYSTEM_DATA}
|
||||
- ADD_SCHEMA_AND_SYSTEM_DATA=${ADD_SCHEMA_AND_SYSTEM_DATA}
|
||||
- ADD_DEMO_DATA=${ADD_DEMO_DATA}
|
||||
- CASSANDRA_URL=${CASSANDRA_URL}
|
||||
entrypoint: /install-schema.sh
|
||||
volumes:
|
||||
- "${HSQLDB_DATA_DIR}:/usr/share/thingsboard/data/sql"
|
||||
entrypoint: /run-application.sh
|
||||
cassandra:
|
||||
image: "cassandra:3.9"
|
||||
ports:
|
||||
@ -52,18 +49,5 @@ services:
|
||||
- "5432"
|
||||
environment:
|
||||
- POSTGRES_DB=${POSTGRES_DB}
|
||||
- POSTGRES_USER=${POSTGRES_USER}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||
volumes:
|
||||
- "${POSTGRES_DATA_DIR}:/var/lib/postgresql/data"
|
||||
tb-postgres-schema:
|
||||
image: "thingsboard/tb-postgres-schema:1.2.4"
|
||||
environment:
|
||||
- POSTGRES_URL=${POSTGRES_URL}
|
||||
- POSTGRES_DB=${POSTGRES_DB}
|
||||
- POSTGRES_USER=${POSTGRES_USER}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||
- CREATE_SCHEMA=${CREATE_SCHEMA}
|
||||
- ADD_SYSTEM_DATA=${ADD_SYSTEM_DATA}
|
||||
- ADD_DEMO_DATA=${ADD_DEMO_DATA}
|
||||
entrypoint: /install-schema.sh
|
||||
@ -1,28 +0,0 @@
|
||||
#
|
||||
# Copyright © 2016-2017 The Thingsboard Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
FROM cassandra:3.9
|
||||
|
||||
ADD install-schema.sh /install-schema.sh
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y nmap \
|
||||
&& chmod +x /install-schema.sh
|
||||
|
||||
ADD schema.cql /schema.cql
|
||||
ADD demo-data.cql /demo-data.cql
|
||||
ADD system-data.cql /system-data.cql
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
VERSION=1.2.4
|
||||
PROJECT=thingsboard
|
||||
APP=tb-cassandra-schema
|
||||
|
||||
build:
|
||||
cp ../../dao/src/main/resources/cassandra/schema.cql .
|
||||
cp ../../dao/src/main/resources/cassandra/demo-data.cql .
|
||||
cp ../../dao/src/main/resources/cassandra/system-data.cql .
|
||||
docker build --pull -t ${PROJECT}/${APP}:${VERSION} -t ${PROJECT}/${APP}:latest .
|
||||
rm schema.cql demo-data.cql system-data.cql
|
||||
|
||||
push: build
|
||||
docker push ${PROJECT}/${APP}:${VERSION}
|
||||
docker push ${PROJECT}/${APP}:latest
|
||||
@ -1,53 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright © 2016-2017 The Thingsboard Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
|
||||
until nmap $CASSANDRA_URL -p 9042 | grep "9042/tcp open"
|
||||
do
|
||||
echo "Wait for $CASSANDRA_URL..."
|
||||
sleep 10
|
||||
done
|
||||
|
||||
if [ "$CREATE_SCHEMA" == "true" ]; then
|
||||
echo "Creating 'Thingsboard' keyspace..."
|
||||
cqlsh $CASSANDRA_URL -f /schema.cql
|
||||
if [ "$?" -eq 0 ]; then
|
||||
echo "'Thingsboard' keyspace was successfully created!"
|
||||
else
|
||||
echo "There were issues while creating 'Thingsboard' keyspace!"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$ADD_SYSTEM_DATA" == "true" ]; then
|
||||
echo "Adding system data..."
|
||||
cqlsh $CASSANDRA_URL -f /system-data.cql
|
||||
if [ "$?" -eq 0 ]; then
|
||||
echo "System data was successfully added!"
|
||||
else
|
||||
echo "There were issues while adding System data!"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$ADD_DEMO_DATA" == "true" ]; then
|
||||
echo "Adding demo data..."
|
||||
cqlsh $CASSANDRA_URL -f /demo-data.cql
|
||||
if [ "$?" -eq 0 ]; then
|
||||
echo "Demo data was successfully added!"
|
||||
else
|
||||
echo "There were issues while adding Demo data!"
|
||||
fi
|
||||
fi
|
||||
@ -1,39 +0,0 @@
|
||||
#
|
||||
# Copyright © 2016-2017 The Thingsboard Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: tb-cassandra-schema
|
||||
spec:
|
||||
containers:
|
||||
- name: tb-cassandra-schema
|
||||
imagePullPolicy: Always
|
||||
image: thingsboard/tb-cassandra-schema:1.2.4
|
||||
env:
|
||||
- name: CREATE_SCHEMA
|
||||
value: "true"
|
||||
- name: ADD_SYSTEM_DATA
|
||||
value: "true"
|
||||
- name : ADD_DEMO_DATA
|
||||
value: "true"
|
||||
- name : CASSANDRA_URL
|
||||
value: "cassandra-headless"
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- /install-schema.sh
|
||||
restartPolicy: Never
|
||||
@ -1,27 +0,0 @@
|
||||
#
|
||||
# Copyright © 2016-2017 The Thingsboard Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
FROM postgres:9.6
|
||||
|
||||
ADD install-schema.sh /install-schema.sh
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y nmap \
|
||||
&& chmod +x /install-schema.sh
|
||||
|
||||
ADD schema.sql /schema.sql
|
||||
ADD system-data.sql /system-data.sql
|
||||
ADD demo-data.sql /demo-data.sql
|
||||
@ -1,14 +0,0 @@
|
||||
VERSION=1.2.4
|
||||
PROJECT=thingsboard
|
||||
APP=tb-postgres-schema
|
||||
|
||||
build:
|
||||
cp ../../dao/src/main/resources/postgres/schema.sql .
|
||||
cp ../../dao/src/main/resources/postgres/demo-data.sql .
|
||||
cp ../../dao/src/main/resources/postgres/system-data.sql .
|
||||
docker build --pull -t ${PROJECT}/${APP}:${VERSION} -t ${PROJECT}/${APP}:latest .
|
||||
rm schema.sql demo-data.sql system-data.sql
|
||||
|
||||
push: build
|
||||
docker push ${PROJECT}/${APP}:${VERSION}
|
||||
docker push ${PROJECT}/${APP}:latest
|
||||
@ -1,52 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright © 2016-2017 The Thingsboard Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
until nmap $POSTGRES_URL -p 5432 | grep "5432/tcp open"
|
||||
do
|
||||
echo "Waiting for $POSTGRES_URL..."
|
||||
sleep 10
|
||||
done
|
||||
|
||||
if [ "$CREATE_SCHEMA" == "true" ]; then
|
||||
echo "Creating 'Thingsboard' database schema..."
|
||||
PGPASSWORD="$POSTGRES_PASSWORD" psql -h "$POSTGRES_URL" -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" -f /schema.sql
|
||||
if [ "$?" -eq 0 ]; then
|
||||
echo "'Thingsboard' database schema was successfully created!"
|
||||
else
|
||||
echo "There were issues while creating 'Thingsboard' database schema!"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$ADD_SYSTEM_DATA" == "true" ]; then
|
||||
echo "Adding system data..."
|
||||
PGPASSWORD="$POSTGRES_PASSWORD" psql -h "$POSTGRES_URL" -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" -f /system-data.sql
|
||||
if [ "$?" -eq 0 ]; then
|
||||
echo "System data was successfully added!"
|
||||
else
|
||||
echo "There were issues while adding System data!"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$ADD_DEMO_DATA" == "true" ]; then
|
||||
echo "Adding demo data..."
|
||||
PGPASSWORD="$POSTGRES_PASSWORD" psql -h "$POSTGRES_URL" -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" -f /demo-data.sql
|
||||
if [ "$?" -eq 0 ]; then
|
||||
echo "Demo data was successfully added!"
|
||||
else
|
||||
echo "There were issues while adding Demo data!"
|
||||
fi
|
||||
fi
|
||||
@ -1,9 +1,21 @@
|
||||
#Thingsboard server configuration
|
||||
|
||||
TB_CASSANDRA_SCHEMA_URL=tb-cassandra-schema
|
||||
CASSANDRA_URL=cassandra:9042
|
||||
ZOOKEEPER_URL=zk:2181
|
||||
MQTT_BIND_ADDRESS=0.0.0.0
|
||||
MQTT_BIND_PORT=1883
|
||||
COAP_BIND_ADDRESS=0.0.0.0
|
||||
COAP_BIND_PORT=5683
|
||||
|
||||
# zk config
|
||||
ZOOKEEPER_URL=zk:2181
|
||||
|
||||
# type of database to use: sql[DEFAULT] or cassandra
|
||||
DATABASE_TYPE=sql
|
||||
|
||||
# cassandra db config
|
||||
CASSANDRA_URL=cassandra:9042
|
||||
|
||||
# postgres db config
|
||||
# SPRING_JPA_DATABASE_PLATFORM=org.hibernate.dialect.PostgreSQLDialect
|
||||
# SPRING_DRIVER_CLASS_NAME=org.postgresql.Driver
|
||||
# SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/thingsboard
|
||||
# SPRING_DATASOURCE_USERNAME=postgres
|
||||
# SPRING_DATASOURCE_PASSWORD=postgres
|
||||
|
||||
@ -19,4 +19,6 @@ FROM openjdk:8-jre
|
||||
ADD run-application.sh /run-application.sh
|
||||
ADD thingsboard.deb /thingsboard.deb
|
||||
|
||||
RUN chmod +x /run-application.sh
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y nmap \
|
||||
&& chmod +x /run-application.sh
|
||||
|
||||
@ -18,18 +18,34 @@
|
||||
|
||||
dpkg -i /thingsboard.deb
|
||||
|
||||
reachable=0
|
||||
while [ $reachable -eq 0 ];
|
||||
do
|
||||
echo "$TB_CASSANDRA_SCHEMA_URL container is still in progress. waiting until it completed..."
|
||||
sleep 3
|
||||
ping -q -c 1 $TB_CASSANDRA_SCHEMA_URL > /dev/null 2>&1
|
||||
if [ "$?" -ne 0 ];
|
||||
then
|
||||
echo "$TB_CASSANDRA_SCHEMA_URL container completed!"
|
||||
reachable=1
|
||||
if [ "$DATABASE_TYPE" == "cassandra" ]; then
|
||||
until nmap cassandra -p 9042 | grep "9042/tcp open"
|
||||
do
|
||||
echo "Wait for cassandra db to start..."
|
||||
sleep 10
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "$DATABASE_TYPE" == "sql" ]; then
|
||||
if [ "$SPRING_DRIVER_CLASS_NAME" == "org.postgresql.Driver" ]; then
|
||||
until nmap postgres -p 5432 | grep "5432/tcp open"
|
||||
do
|
||||
echo "Waiting for postgres db to start..."
|
||||
sleep 10
|
||||
done
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "$ADD_SCHEMA_AND_SYSTEM_DATA" == "true" ]; then
|
||||
echo "Creating 'Thingsboard' schema and system data..."
|
||||
if [ "$ADD_DEMO_DATA" == "true" ]; then
|
||||
echo "Adding demo data..."
|
||||
/usr/share/thingsboard/bin/install/install.sh --loadDemo
|
||||
elif [ "$ADD_DEMO_DATA" == "false" ]; then
|
||||
/usr/share/thingsboard/bin/install/install.sh
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Copying env variables into conf files
|
||||
printenv | awk -F "=" '{print "export " $1 "='\''" $2 "'\''"}' >> /usr/share/thingsboard/conf/thingsboard.conf
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user