17 changed files with 58 additions and 273 deletions
@ -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 |
|||
@ -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 |
|||
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 |
|||
|
|||
Loading…
Reference in new issue