71 changed files with 1656 additions and 1579 deletions
@ -1,13 +1,18 @@ |
|||
# cassandra environment variables |
|||
CASSANDRA_DATA_DIR=/home/docker/cassandra_volume |
|||
|
|||
# postgres environment variables |
|||
POSTGRES_DATA_DIR=/home/docker/postgres_volume |
|||
POSTGRES_DB=thingsboard |
|||
DOCKER_REPO=thingsboard |
|||
|
|||
# hsqldb environment variables |
|||
HSQLDB_DATA_DIR=/home/docker/hsqldb_volume |
|||
JS_EXECUTOR_DOCKER_NAME=tb-js-executor |
|||
TB_NODE_DOCKER_NAME=tb-node |
|||
WEB_UI_DOCKER_NAME=tb-web-ui |
|||
MQTT_TRANSPORT_DOCKER_NAME=tb-mqtt-transport |
|||
HTTP_TRANSPORT_DOCKER_NAME=tb-http-transport |
|||
COAP_TRANSPORT_DOCKER_NAME=tb-coap-transport |
|||
|
|||
# environment variables for schema init and insert system and demo data |
|||
ADD_SCHEMA_AND_SYSTEM_DATA=false |
|||
ADD_DEMO_DATA=false |
|||
TB_VERSION=latest |
|||
|
|||
# Database used by ThingsBoard, can be either local (local HSQLDB), postgres (PostgreSQL), cassandra (Cassandra). |
|||
# In case of postgres or cassandra corresponding docker service will be deployed (see docker-compose.postgres.yml, docker-compose.cassandra.yml for details). |
|||
|
|||
DATABASE=cassandra |
|||
|
|||
KAFKA_TOPICS="js.eval.requests:100:1:delete --config=retention.ms=60000 --config=segment.bytes=26214400 --config=retention.bytes=104857600,tb.transport.api.requests:30:1:delete --config=retention.ms=60000 --config=segment.bytes=26214400 --config=retention.bytes=104857600,tb.rule-engine:30:1" |
|||
|
|||
@ -0,0 +1,51 @@ |
|||
# Docker configuration for ThingsBoard Microservices |
|||
|
|||
This folder containing scripts and Docker Compose configurations to run ThingsBoard in Microservices mode. |
|||
|
|||
## Installation |
|||
|
|||
Execute the following command to run DataBase installation: |
|||
|
|||
` |
|||
$ ./docker-install-tb.sh --loadDemo |
|||
` |
|||
|
|||
- `--loadDemo` - optional argument. Whether to load additional demo data. |
|||
|
|||
## Running |
|||
|
|||
Execute the following command to run services: |
|||
|
|||
` |
|||
$ ./docker-start-services.sh |
|||
` |
|||
|
|||
Execute the following command to stop services: |
|||
|
|||
` |
|||
$ ./docker-stop-services.sh |
|||
` |
|||
|
|||
Execute the following command to stop and completely remove deployed docker containers: |
|||
|
|||
` |
|||
$ ./docker-remove-services.sh |
|||
` |
|||
|
|||
Execute the following command to update particular services (pull newer docker image and rebuild container): |
|||
|
|||
` |
|||
$ ./docker-update-service.sh [SERVICE...] |
|||
` |
|||
|
|||
## Upgrading |
|||
|
|||
In case when database upgrade is needed, execute the following commands: |
|||
|
|||
` |
|||
$ ./docker-stop-services.sh |
|||
$ ./docker-upgrade-tb.sh --fromVersion=[FROM_VERSION] |
|||
$ ./docker-start-services.sh |
|||
` |
|||
|
|||
- `FROM_VERSION` - from which version upgrade should be started. |
|||
@ -1,24 +0,0 @@ |
|||
# |
|||
# Copyright © 2016-2018 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 openjdk:8-jre |
|||
|
|||
ADD install.sh /install.sh |
|||
ADD thingsboard.deb /thingsboard.deb |
|||
|
|||
RUN apt-get update \ |
|||
&& apt-get install -y nmap \ |
|||
&& chmod +x /install.sh |
|||
@ -1,12 +0,0 @@ |
|||
VERSION=2.1.0 |
|||
PROJECT=thingsboard |
|||
APP=cassandra-setup |
|||
|
|||
build: |
|||
cp ../../application/target/thingsboard.deb . |
|||
docker build --pull -t ${PROJECT}/${APP}:${VERSION} -t ${PROJECT}/${APP}:latest . |
|||
rm thingsboard.deb |
|||
|
|||
push: build |
|||
docker push ${PROJECT}/${APP}:${VERSION} |
|||
docker push ${PROJECT}/${APP}:latest |
|||
@ -1,24 +0,0 @@ |
|||
# |
|||
# Copyright © 2016-2018 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 openjdk:8-jre |
|||
|
|||
ADD upgrade.sh /upgrade.sh |
|||
ADD thingsboard.deb /thingsboard.deb |
|||
|
|||
RUN apt-get update \ |
|||
&& apt-get install -y nmap \ |
|||
&& chmod +x /upgrade.sh |
|||
@ -1,12 +0,0 @@ |
|||
VERSION=2.1.0 |
|||
PROJECT=thingsboard |
|||
APP=cassandra-upgrade |
|||
|
|||
build: |
|||
cp ../../application/target/thingsboard.deb . |
|||
docker build --pull -t ${PROJECT}/${APP}:${VERSION} -t ${PROJECT}/${APP}:latest . |
|||
rm thingsboard.deb |
|||
|
|||
push: build |
|||
docker push ${PROJECT}/${APP}:${VERSION} |
|||
docker push ${PROJECT}/${APP}:latest |
|||
@ -1,10 +0,0 @@ |
|||
VERSION=2.1.0 |
|||
PROJECT=thingsboard |
|||
APP=cassandra |
|||
|
|||
build: |
|||
docker build --pull -t ${PROJECT}/${APP}:${VERSION} -t ${PROJECT}/${APP}:latest . |
|||
|
|||
push: build |
|||
docker push ${PROJECT}/${APP}:${VERSION} |
|||
docker push ${PROJECT}/${APP}:latest |
|||
@ -1,28 +0,0 @@ |
|||
#!/usr/bin/env bash |
|||
# |
|||
# Copyright © 2016-2018 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. |
|||
# |
|||
|
|||
if [[ $(nodetool status | grep $POD_IP) == *"UN"* ]]; then |
|||
if [[ $DEBUG ]]; then |
|||
echo "UN"; |
|||
fi |
|||
exit 0; |
|||
else |
|||
if [[ $DEBUG ]]; then |
|||
echo "Not Up"; |
|||
fi |
|||
exit 1; |
|||
fi |
|||
@ -0,0 +1,54 @@ |
|||
#!/bin/bash |
|||
# |
|||
# Copyright © 2016-2018 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. |
|||
# |
|||
|
|||
function additionalComposeArgs() { |
|||
source .env |
|||
ADDITIONAL_COMPOSE_ARGS="" |
|||
case $DATABASE in |
|||
local) |
|||
;; |
|||
postgres) |
|||
ADDITIONAL_COMPOSE_ARGS="-f docker-compose.postgres.yml" |
|||
;; |
|||
cassandra) |
|||
ADDITIONAL_COMPOSE_ARGS="-f docker-compose.cassandra.yml" |
|||
;; |
|||
*) |
|||
echo "Unknown DATABASE value specified: '${DATABASE}'. Should be either local, postgres or cassandra." >&2 |
|||
exit 1 |
|||
esac |
|||
echo $ADDITIONAL_COMPOSE_ARGS |
|||
} |
|||
|
|||
function additionalStartupServices() { |
|||
source .env |
|||
ADDITIONAL_STARTUP_SERVICES="" |
|||
case $DATABASE in |
|||
local) |
|||
;; |
|||
postgres) |
|||
ADDITIONAL_STARTUP_SERVICES=postgres |
|||
;; |
|||
cassandra) |
|||
ADDITIONAL_STARTUP_SERVICES=cassandra |
|||
;; |
|||
*) |
|||
echo "Unknown DATABASE value specified: '${DATABASE}'. Should be either local, postgres or cassandra." >&2 |
|||
exit 1 |
|||
esac |
|||
echo $ADDITIONAL_STARTUP_SERVICES |
|||
} |
|||
@ -1,27 +0,0 @@ |
|||
# |
|||
# Copyright © 2016-2018 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. |
|||
# |
|||
|
|||
version: '3.3' |
|||
services: |
|||
redis: |
|||
image: redis:4.0 |
|||
networks: |
|||
- core |
|||
ports: |
|||
- "6379:6379" |
|||
|
|||
networks: |
|||
core: |
|||
@ -0,0 +1,24 @@ |
|||
#!/bin/bash |
|||
# |
|||
# Copyright © 2016-2018 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. |
|||
# |
|||
|
|||
set -e |
|||
|
|||
source compose-utils.sh |
|||
|
|||
ADDITIONAL_COMPOSE_ARGS=$(additionalComposeArgs) || exit $? |
|||
|
|||
docker-compose -f docker-compose.yml $ADDITIONAL_COMPOSE_ARGS down -v |
|||
@ -0,0 +1,26 @@ |
|||
#!/bin/bash |
|||
# |
|||
# Copyright © 2016-2018 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. |
|||
# |
|||
|
|||
./check-dirs.sh |
|||
|
|||
set -e |
|||
|
|||
source compose-utils.sh |
|||
|
|||
ADDITIONAL_COMPOSE_ARGS=$(additionalComposeArgs) || exit $? |
|||
|
|||
docker-compose -f docker-compose.yml $ADDITIONAL_COMPOSE_ARGS up -d |
|||
@ -0,0 +1,24 @@ |
|||
#!/bin/bash |
|||
# |
|||
# Copyright © 2016-2018 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. |
|||
# |
|||
|
|||
set -e |
|||
|
|||
source compose-utils.sh |
|||
|
|||
ADDITIONAL_COMPOSE_ARGS=$(additionalComposeArgs) || exit $? |
|||
|
|||
docker-compose -f docker-compose.yml $ADDITIONAL_COMPOSE_ARGS stop |
|||
@ -0,0 +1,25 @@ |
|||
#!/bin/bash |
|||
# |
|||
# Copyright © 2016-2018 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. |
|||
# |
|||
|
|||
set -e |
|||
|
|||
source compose-utils.sh |
|||
|
|||
ADDITIONAL_COMPOSE_ARGS=$(additionalComposeArgs) || exit $? |
|||
|
|||
docker-compose -f docker-compose.yml $ADDITIONAL_COMPOSE_ARGS pull $@ |
|||
docker-compose -f docker-compose.yml $ADDITIONAL_COMPOSE_ARGS up -d --no-deps --build $@ |
|||
@ -1,43 +0,0 @@ |
|||
# |
|||
# Copyright © 2016-2018 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: cassandra-setup |
|||
spec: |
|||
containers: |
|||
- name: cassandra-setup |
|||
imagePullPolicy: Always |
|||
image: thingsboard/cassandra-setup:2.1.0 |
|||
env: |
|||
- name: ADD_DEMO_DATA |
|||
value: "true" |
|||
- name : CASSANDRA_HOST |
|||
value: "cassandra-headless" |
|||
- name : CASSANDRA_PORT |
|||
value: "9042" |
|||
- name : DATABASE_ENTITIES_TYPE |
|||
value: "cassandra" |
|||
- name : DATABASE_TS_TYPE |
|||
value: "cassandra" |
|||
- name : CASSANDRA_URL |
|||
value: "cassandra-headless:9042" |
|||
command: |
|||
- sh |
|||
- -c |
|||
- /install.sh |
|||
restartPolicy: Never |
|||
@ -1,45 +0,0 @@ |
|||
# |
|||
# Copyright © 2016-2018 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: cassandra-upgrade |
|||
spec: |
|||
containers: |
|||
- name: cassandra-upgrade |
|||
imagePullPolicy: Always |
|||
image: thingsboard/cassandra-upgrade:2.1.0 |
|||
env: |
|||
- name: ADD_DEMO_DATA |
|||
value: "true" |
|||
- name : CASSANDRA_HOST |
|||
value: "cassandra-headless" |
|||
- name : CASSANDRA_PORT |
|||
value: "9042" |
|||
- name : DATABASE_ENTITIES_TYPE |
|||
value: "cassandra" |
|||
- name : DATABASE_TS_TYPE |
|||
value: "cassandra" |
|||
- name : CASSANDRA_URL |
|||
value: "cassandra-headless:9042" |
|||
- name : UPGRADE_FROM_VERSION |
|||
value: "1.4.0" |
|||
command: |
|||
- sh |
|||
- -c |
|||
- /upgrade.sh |
|||
restartPolicy: Never |
|||
@ -1,132 +0,0 @@ |
|||
# |
|||
# Copyright © 2016-2018 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: Service |
|||
metadata: |
|||
name: cassandra-headless |
|||
labels: |
|||
app: cassandra-headless |
|||
spec: |
|||
ports: |
|||
- port: 9042 |
|||
name: cql |
|||
clusterIP: None |
|||
selector: |
|||
app: cassandra |
|||
--- |
|||
apiVersion: "apps/v1beta1" |
|||
kind: StatefulSet |
|||
metadata: |
|||
name: cassandra |
|||
spec: |
|||
serviceName: cassandra-headless |
|||
replicas: 2 |
|||
template: |
|||
metadata: |
|||
labels: |
|||
app: cassandra |
|||
spec: |
|||
nodeSelector: |
|||
machinetype: other |
|||
affinity: |
|||
podAntiAffinity: |
|||
requiredDuringSchedulingIgnoredDuringExecution: |
|||
- labelSelector: |
|||
matchExpressions: |
|||
- key: "app" |
|||
operator: In |
|||
values: |
|||
- cassandra-headless |
|||
topologyKey: "kubernetes.io/hostname" |
|||
containers: |
|||
- name: cassandra |
|||
image: thingsboard/cassandra:2.1.0 |
|||
imagePullPolicy: Always |
|||
ports: |
|||
- containerPort: 7000 |
|||
name: intra-node |
|||
- containerPort: 7001 |
|||
name: tls-intra-node |
|||
- containerPort: 7199 |
|||
name: jmx |
|||
- containerPort: 9042 |
|||
name: cql |
|||
- containerPort: 9160 |
|||
name: thrift |
|||
securityContext: |
|||
capabilities: |
|||
add: |
|||
- IPC_LOCK |
|||
lifecycle: |
|||
preStop: |
|||
exec: |
|||
command: ["/bin/sh", "-c", "PID=$(pidof java) && kill $PID && while ps -p $PID > /dev/null; do sleep 1; done"] |
|||
env: |
|||
- name: MAX_HEAP_SIZE |
|||
value: 2048M |
|||
- name: HEAP_NEWSIZE |
|||
value: 100M |
|||
- name: CASSANDRA_SEEDS |
|||
value: "cassandra-0.cassandra-headless.default.svc.cluster.local" |
|||
- name: CASSANDRA_CLUSTER_NAME |
|||
value: "Thingsboard-Cluster" |
|||
- name: CASSANDRA_DC |
|||
value: "DC1-Thingsboard-Cluster" |
|||
- name: CASSANDRA_RACK |
|||
value: "Rack-Thingsboard-Cluster" |
|||
- name: CASSANDRA_AUTO_BOOTSTRAP |
|||
value: "false" |
|||
- name: POD_IP |
|||
valueFrom: |
|||
fieldRef: |
|||
fieldPath: status.podIP |
|||
- name: POD_NAMESPACE |
|||
valueFrom: |
|||
fieldRef: |
|||
fieldPath: metadata.namespace |
|||
readinessProbe: |
|||
exec: |
|||
command: |
|||
- /bin/bash |
|||
- -c |
|||
- /ready-probe.sh |
|||
initialDelaySeconds: 15 |
|||
timeoutSeconds: 5 |
|||
volumeMounts: |
|||
- name: cassandra-data |
|||
mountPath: /var/lib/cassandra/data |
|||
- name: cassandra-commitlog |
|||
mountPath: /var/lib/cassandra/commitlog |
|||
volumeClaimTemplates: |
|||
- metadata: |
|||
name: cassandra-data |
|||
annotations: |
|||
volume.beta.kubernetes.io/storage-class: fast |
|||
spec: |
|||
accessModes: [ "ReadWriteOnce" ] |
|||
resources: |
|||
requests: |
|||
storage: 3Gi |
|||
- metadata: |
|||
name: cassandra-commitlog |
|||
annotations: |
|||
volume.beta.kubernetes.io/storage-class: fast |
|||
spec: |
|||
accessModes: [ "ReadWriteOnce" ] |
|||
resources: |
|||
requests: |
|||
storage: 2Gi |
|||
@ -1,33 +0,0 @@ |
|||
# |
|||
# Copyright © 2016-2018 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: storage.k8s.io/v1beta1 |
|||
kind: StorageClass |
|||
metadata: |
|||
name: slow |
|||
provisioner: kubernetes.io/gce-pd |
|||
parameters: |
|||
type: pd-standard |
|||
--- |
|||
apiVersion: storage.k8s.io/v1beta1 |
|||
kind: StorageClass |
|||
metadata: |
|||
name: fast |
|||
provisioner: kubernetes.io/gce-pd |
|||
parameters: |
|||
type: pd-ssd |
|||
--- |
|||
@ -1,93 +0,0 @@ |
|||
# |
|||
# Copyright © 2016-2018 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: Service |
|||
metadata: |
|||
labels: |
|||
name: redis-service |
|||
name: redis-service |
|||
spec: |
|||
ports: |
|||
- name: redis-service |
|||
protocol: TCP |
|||
port: 6379 |
|||
targetPort: 6379 |
|||
selector: |
|||
app: redis |
|||
--- |
|||
apiVersion: v1 |
|||
kind: ConfigMap |
|||
metadata: |
|||
name: redis-conf |
|||
data: |
|||
redis.conf: | |
|||
appendonly yes |
|||
protected-mode no |
|||
bind 0.0.0.0 |
|||
port 6379 |
|||
dir /var/lib/redis |
|||
--- |
|||
apiVersion: apps/v1beta1 |
|||
kind: StatefulSet |
|||
metadata: |
|||
name: redis |
|||
spec: |
|||
serviceName: redis-service |
|||
replicas: 1 |
|||
template: |
|||
metadata: |
|||
labels: |
|||
app: redis |
|||
spec: |
|||
terminationGracePeriodSeconds: 10 |
|||
containers: |
|||
- name: redis |
|||
image: redis:4.0.9 |
|||
command: |
|||
- redis-server |
|||
args: |
|||
- /etc/redis/redis.conf |
|||
resources: |
|||
requests: |
|||
cpu: 100m |
|||
memory: 100Mi |
|||
ports: |
|||
- containerPort: 6379 |
|||
name: redis |
|||
volumeMounts: |
|||
- name: redis-data |
|||
mountPath: /var/lib/redis |
|||
- name: redis-conf |
|||
mountPath: /etc/redis |
|||
volumes: |
|||
- name: redis-conf |
|||
configMap: |
|||
name: redis-conf |
|||
items: |
|||
- key: redis.conf |
|||
path: redis.conf |
|||
volumeClaimTemplates: |
|||
- metadata: |
|||
name: redis-data |
|||
annotations: |
|||
volume.beta.kubernetes.io/storage-class: fast |
|||
spec: |
|||
accessModes: [ "ReadWriteOnce" ] |
|||
resources: |
|||
requests: |
|||
storage: 1Gi |
|||
@ -1,156 +0,0 @@ |
|||
# |
|||
# Copyright © 2016-2018 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: Service |
|||
metadata: |
|||
name: tb-service |
|||
labels: |
|||
app: tb-service |
|||
spec: |
|||
ports: |
|||
- port: 8080 |
|||
name: ui |
|||
- port: 1883 |
|||
name: mqtt |
|||
- port: 5683 |
|||
name: coap |
|||
selector: |
|||
app: tb |
|||
type: LoadBalancer |
|||
--- |
|||
apiVersion: policy/v1beta1 |
|||
kind: PodDisruptionBudget |
|||
metadata: |
|||
name: tb-budget |
|||
spec: |
|||
selector: |
|||
matchLabels: |
|||
app: tb |
|||
minAvailable: 3 |
|||
--- |
|||
apiVersion: v1 |
|||
kind: ConfigMap |
|||
metadata: |
|||
name: tb-config |
|||
data: |
|||
zookeeper.enabled: "true" |
|||
zookeeper.url: "zk-headless" |
|||
cassandra.url: "cassandra-headless:9042" |
|||
cassandra.host: "cassandra-headless" |
|||
cassandra.port: "9042" |
|||
database.type: "cassandra" |
|||
cache.type: "redis" |
|||
redis.host: "redis-service" |
|||
--- |
|||
apiVersion: apps/v1beta1 |
|||
kind: StatefulSet |
|||
metadata: |
|||
name: tb |
|||
spec: |
|||
serviceName: "tb-service" |
|||
replicas: 3 |
|||
template: |
|||
metadata: |
|||
labels: |
|||
app: tb |
|||
spec: |
|||
nodeSelector: |
|||
machinetype: tb |
|||
affinity: |
|||
podAntiAffinity: |
|||
requiredDuringSchedulingIgnoredDuringExecution: |
|||
- labelSelector: |
|||
matchExpressions: |
|||
- key: "app" |
|||
operator: In |
|||
values: |
|||
- tb-service |
|||
topologyKey: "kubernetes.io/hostname" |
|||
containers: |
|||
- name: tb |
|||
imagePullPolicy: Always |
|||
image: thingsboard/application:2.1.0 |
|||
ports: |
|||
- containerPort: 8080 |
|||
name: ui |
|||
- containerPort: 1883 |
|||
name: mqtt |
|||
- containerPort: 5683 |
|||
name: coap |
|||
- containerPort: 9001 |
|||
name: rpc |
|||
env: |
|||
- name: ZOOKEEPER_ENABLED |
|||
valueFrom: |
|||
configMapKeyRef: |
|||
name: tb-config |
|||
key: zookeeper.enabled |
|||
- name: ZOOKEEPER_URL |
|||
valueFrom: |
|||
configMapKeyRef: |
|||
name: tb-config |
|||
key: zookeeper.url |
|||
- name : CASSANDRA_HOST |
|||
valueFrom: |
|||
configMapKeyRef: |
|||
name: tb-config |
|||
key: cassandra.host |
|||
- name : CASSANDRA_PORT |
|||
valueFrom: |
|||
configMapKeyRef: |
|||
name: tb-config |
|||
key: cassandra.port |
|||
- name : CASSANDRA_URL |
|||
valueFrom: |
|||
configMapKeyRef: |
|||
name: tb-config |
|||
key: cassandra.url |
|||
- name: DATABASE_ENTITIES_TYPE |
|||
valueFrom: |
|||
configMapKeyRef: |
|||
name: tb-config |
|||
key: database.type |
|||
- name: DATABASE_TS_TYPE |
|||
valueFrom: |
|||
configMapKeyRef: |
|||
name: tb-config |
|||
key: database.type |
|||
- name : RPC_HOST |
|||
valueFrom: |
|||
fieldRef: |
|||
fieldPath: status.podIP |
|||
- name: CACHE_TYPE |
|||
valueFrom: |
|||
configMapKeyRef: |
|||
name: tb-config |
|||
key: cache.type |
|||
- name: REDIS_HOST |
|||
valueFrom: |
|||
configMapKeyRef: |
|||
name: tb-config |
|||
key: redis.host |
|||
command: |
|||
- sh |
|||
- -c |
|||
- /run-application.sh |
|||
livenessProbe: |
|||
httpGet: |
|||
path: /login |
|||
port: ui-port |
|||
initialDelaySeconds: 120 |
|||
timeoutSeconds: 10 |
|||
@ -1,190 +0,0 @@ |
|||
# |
|||
# Copyright © 2016-2018 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: Service |
|||
metadata: |
|||
name: zk-headless |
|||
labels: |
|||
app: zk-headless |
|||
spec: |
|||
ports: |
|||
- port: 2888 |
|||
name: server |
|||
- port: 3888 |
|||
name: leader-election |
|||
clusterIP: None |
|||
selector: |
|||
app: zk |
|||
--- |
|||
apiVersion: v1 |
|||
kind: ConfigMap |
|||
metadata: |
|||
name: zk-config |
|||
data: |
|||
ensemble: "zk-0;zk-1;zk-2" |
|||
replicas: "3" |
|||
jvm.heap: "500m" |
|||
tick: "2000" |
|||
init: "10" |
|||
sync: "5" |
|||
client.cnxns: "60" |
|||
snap.retain: "3" |
|||
purge.interval: "1" |
|||
client.port: "2181" |
|||
server.port: "2888" |
|||
election.port: "3888" |
|||
--- |
|||
apiVersion: policy/v1beta1 |
|||
kind: PodDisruptionBudget |
|||
metadata: |
|||
name: zk-budget |
|||
spec: |
|||
selector: |
|||
matchLabels: |
|||
app: zk |
|||
minAvailable: 3 |
|||
--- |
|||
apiVersion: apps/v1beta1 |
|||
kind: StatefulSet |
|||
metadata: |
|||
name: zk |
|||
spec: |
|||
serviceName: zk-headless |
|||
replicas: 3 |
|||
template: |
|||
metadata: |
|||
labels: |
|||
app: zk |
|||
annotations: |
|||
pod.alpha.kubernetes.io/initialized: "true" |
|||
spec: |
|||
nodeSelector: |
|||
machinetype: other |
|||
affinity: |
|||
podAntiAffinity: |
|||
requiredDuringSchedulingIgnoredDuringExecution: |
|||
- labelSelector: |
|||
matchExpressions: |
|||
- key: "app" |
|||
operator: In |
|||
values: |
|||
- zk-headless |
|||
topologyKey: "kubernetes.io/hostname" |
|||
containers: |
|||
- name: zk |
|||
imagePullPolicy: Always |
|||
image: thingsboard/zk:2.1.0 |
|||
ports: |
|||
- containerPort: 2181 |
|||
name: client |
|||
- containerPort: 2888 |
|||
name: server |
|||
- containerPort: 3888 |
|||
name: leader-election |
|||
env: |
|||
- name : ZK_ENSEMBLE |
|||
valueFrom: |
|||
configMapKeyRef: |
|||
name: zk-config |
|||
key: ensemble |
|||
- name : ZK_REPLICAS |
|||
valueFrom: |
|||
configMapKeyRef: |
|||
name: zk-config |
|||
key: replicas |
|||
- name : ZK_HEAP_SIZE |
|||
valueFrom: |
|||
configMapKeyRef: |
|||
name: zk-config |
|||
key: jvm.heap |
|||
- name : ZK_TICK_TIME |
|||
valueFrom: |
|||
configMapKeyRef: |
|||
name: zk-config |
|||
key: tick |
|||
- name : ZK_INIT_LIMIT |
|||
valueFrom: |
|||
configMapKeyRef: |
|||
name: zk-config |
|||
key: init |
|||
- name : ZK_SYNC_LIMIT |
|||
valueFrom: |
|||
configMapKeyRef: |
|||
name: zk-config |
|||
key: tick |
|||
- name : ZK_MAX_CLIENT_CNXNS |
|||
valueFrom: |
|||
configMapKeyRef: |
|||
name: zk-config |
|||
key: client.cnxns |
|||
- name: ZK_SNAP_RETAIN_COUNT |
|||
valueFrom: |
|||
configMapKeyRef: |
|||
name: zk-config |
|||
key: snap.retain |
|||
- name: ZK_PURGE_INTERVAL |
|||
valueFrom: |
|||
configMapKeyRef: |
|||
name: zk-config |
|||
key: purge.interval |
|||
- name: ZK_CLIENT_PORT |
|||
valueFrom: |
|||
configMapKeyRef: |
|||
name: zk-config |
|||
key: client.port |
|||
- name: ZK_SERVER_PORT |
|||
valueFrom: |
|||
configMapKeyRef: |
|||
name: zk-config |
|||
key: server.port |
|||
- name: ZK_ELECTION_PORT |
|||
valueFrom: |
|||
configMapKeyRef: |
|||
name: zk-config |
|||
key: election.port |
|||
command: |
|||
- sh |
|||
- -c |
|||
- zk-gen-config.sh && zkServer.sh start-foreground |
|||
readinessProbe: |
|||
exec: |
|||
command: |
|||
- "zk-ok.sh" |
|||
initialDelaySeconds: 15 |
|||
timeoutSeconds: 5 |
|||
livenessProbe: |
|||
exec: |
|||
command: |
|||
- "zk-ok.sh" |
|||
initialDelaySeconds: 15 |
|||
timeoutSeconds: 5 |
|||
volumeMounts: |
|||
- name: zkdatadir |
|||
mountPath: /var/lib/zookeeper |
|||
securityContext: |
|||
runAsUser: 1000 |
|||
fsGroup: 1000 |
|||
volumeClaimTemplates: |
|||
- metadata: |
|||
name: zkdatadir |
|||
annotations: |
|||
volume.beta.kubernetes.io/storage-class: slow |
|||
spec: |
|||
accessModes: [ "ReadWriteOnce" ] |
|||
resources: |
|||
requests: |
|||
storage: 1Gi |
|||
@ -0,0 +1,3 @@ |
|||
# ThingsBoard server configuration |
|||
|
|||
TRANSPORT_TYPE=remote |
|||
@ -1,26 +0,0 @@ |
|||
#Thingsboard server configuration |
|||
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_TS_TYPE=sql |
|||
DATABASE_ENTITIES_TYPE=sql |
|||
|
|||
# cassandra db config |
|||
CASSANDRA_URL=cassandra:9042 |
|||
CASSANDRA_HOST=cassandra |
|||
CASSANDRA_PORT=9042 |
|||
|
|||
# postgres db config |
|||
POSTGRES_HOST=postgres |
|||
POSTGRES_PORT=5432 |
|||
# 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 |
|||
@ -1,26 +0,0 @@ |
|||
# |
|||
# Copyright © 2016-2018 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 openjdk:8-jre |
|||
|
|||
ADD run-application.sh /run-application.sh |
|||
ADD thingsboard.deb /thingsboard.deb |
|||
|
|||
RUN apt-get update \ |
|||
&& apt-get install --no-install-recommends -y nmap \ |
|||
&& apt-get clean \ |
|||
&& rm -r /var/lib/apt/lists/* \ |
|||
&& chmod +x /run-application.sh |
|||
@ -1,12 +0,0 @@ |
|||
VERSION=2.1.0 |
|||
PROJECT=thingsboard |
|||
APP=application |
|||
|
|||
build: |
|||
cp ../../application/target/thingsboard.deb . |
|||
docker build --pull -t ${PROJECT}/${APP}:${VERSION} -t ${PROJECT}/${APP}:latest . |
|||
rm thingsboard.deb |
|||
|
|||
push: build |
|||
docker push ${PROJECT}/${APP}:${VERSION} |
|||
docker push ${PROJECT}/${APP}:latest |
|||
@ -1,59 +0,0 @@ |
|||
#!/bin/bash |
|||
# |
|||
# Copyright © 2016-2018 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. |
|||
# |
|||
|
|||
|
|||
dpkg -i /thingsboard.deb |
|||
|
|||
# Copying env variables into conf files |
|||
printenv | awk -F "=" '{print "export " $1 "='\''" $2 "'\''"}' >> /usr/share/thingsboard/conf/thingsboard.conf |
|||
|
|||
cat /usr/share/thingsboard/conf/thingsboard.conf |
|||
|
|||
if [ "$DATABASE_ENTITIES_TYPE" == "cassandra" ]; then |
|||
until nmap $CASSANDRA_HOST -p $CASSANDRA_PORT | grep "$CASSANDRA_PORT/tcp open\|filtered" |
|||
do |
|||
echo "Wait for cassandra db to start..." |
|||
sleep 10 |
|||
done |
|||
fi |
|||
|
|||
if [ "$DATABASE_ENTITIES_TYPE" == "sql" ]; then |
|||
if [ "$SPRING_DRIVER_CLASS_NAME" == "org.postgresql.Driver" ]; then |
|||
until nmap $POSTGRES_HOST -p $POSTGRES_PORT | grep "$POSTGRES_PORT/tcp open" |
|||
do |
|||
echo "Waiting for postgres db to start..." |
|||
sleep 10 |
|||
done |
|||
fi |
|||
fi |
|||
|
|||
if [ "$ADD_SCHEMA_AND_SYSTEM_DATA" == "true" ]; then |
|||
echo "Creating 'Thingsboard' schema and system data..." |
|||
if [ "$ADD_DEMO_DATA" == "true" ]; then |
|||
echo "plus 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 |
|||
|
|||
echo "Starting 'Thingsboard' service..." |
|||
service thingsboard start |
|||
|
|||
# Wait until log file is created |
|||
sleep 10 |
|||
tail -f /var/log/thingsboard/thingsboard.log |
|||
@ -1,71 +0,0 @@ |
|||
# |
|||
# Copyright © 2016-2018 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 ubuntu:16.04 |
|||
ENV ZK_USER=zookeeper \ |
|||
ZK_DATA_DIR=/var/lib/zookeeper/data \ |
|||
ZK_DATA_LOG_DIR=/var/lib/zookeeper/log \ |
|||
ZK_LOG_DIR=/var/log/zookeeper \ |
|||
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 |
|||
|
|||
ARG GPG_KEY=C823E3E5B12AF29C67F81976F5CECB3CB5E9BD2D |
|||
ARG ZK_DIST=zookeeper-3.4.10 |
|||
RUN set -x \ |
|||
&& apt-get update \ |
|||
&& apt-get install -y openjdk-8-jre-headless wget netcat-openbsd \ |
|||
&& wget -q "http://www.apache.org/dist/zookeeper/$ZK_DIST/$ZK_DIST.tar.gz" \ |
|||
&& wget -q "http://www.apache.org/dist/zookeeper/$ZK_DIST/$ZK_DIST.tar.gz.asc" \ |
|||
&& export GNUPGHOME="$(mktemp -d)" \ |
|||
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-key "$GPG_KEY" \ |
|||
&& gpg --batch --verify "$ZK_DIST.tar.gz.asc" "$ZK_DIST.tar.gz" \ |
|||
&& tar -xzf "$ZK_DIST.tar.gz" -C /opt \ |
|||
&& rm -r "$GNUPGHOME" "$ZK_DIST.tar.gz" "$ZK_DIST.tar.gz.asc" \ |
|||
&& ln -s /opt/$ZK_DIST /opt/zookeeper \ |
|||
&& rm -rf /opt/zookeeper/CHANGES.txt \ |
|||
/opt/zookeeper/README.txt \ |
|||
/opt/zookeeper/NOTICE.txt \ |
|||
/opt/zookeeper/CHANGES.txt \ |
|||
/opt/zookeeper/README_packaging.txt \ |
|||
/opt/zookeeper/build.xml \ |
|||
/opt/zookeeper/config \ |
|||
/opt/zookeeper/contrib \ |
|||
/opt/zookeeper/dist-maven \ |
|||
/opt/zookeeper/docs \ |
|||
/opt/zookeeper/ivy.xml \ |
|||
/opt/zookeeper/ivysettings.xml \ |
|||
/opt/zookeeper/recipes \ |
|||
/opt/zookeeper/src \ |
|||
/opt/zookeeper/$ZK_DIST.jar.asc \ |
|||
/opt/zookeeper/$ZK_DIST.jar.md5 \ |
|||
/opt/zookeeper/$ZK_DIST.jar.sha1 \ |
|||
&& apt-get autoremove -y wget \ |
|||
&& rm -rf /var/lib/apt/lists/* |
|||
|
|||
#Copy configuration generator script to bin |
|||
COPY zk-gen-config.sh zk-ok.sh /opt/zookeeper/bin/ |
|||
|
|||
# Create a user for the zookeeper process and configure file system ownership |
|||
# for nessecary directories and symlink the distribution as a user executable |
|||
RUN set -x \ |
|||
&& useradd $ZK_USER \ |
|||
&& [ `id -u $ZK_USER` -eq 1000 ] \ |
|||
&& [ `id -g $ZK_USER` -eq 1000 ] \ |
|||
&& mkdir -p $ZK_DATA_DIR $ZK_DATA_LOG_DIR $ZK_LOG_DIR /usr/share/zookeeper /tmp/zookeeper /usr/etc/ \ |
|||
&& chown -R "$ZK_USER:$ZK_USER" /opt/$ZK_DIST $ZK_DATA_DIR $ZK_LOG_DIR $ZK_DATA_LOG_DIR /tmp/zookeeper \ |
|||
&& ln -s /opt/zookeeper/conf/ /usr/etc/zookeeper \ |
|||
&& ln -s /opt/zookeeper/bin/* /usr/bin \ |
|||
&& ln -s /opt/zookeeper/$ZK_DIST.jar /usr/share/zookeeper/ \ |
|||
&& ln -s /opt/zookeeper/lib/* /usr/share/zookeeper |
|||
@ -1,10 +0,0 @@ |
|||
VERSION=2.1.0 |
|||
PROJECT=thingsboard |
|||
APP=zk |
|||
|
|||
build: |
|||
docker build --pull -t ${PROJECT}/${APP}:${VERSION} -t ${PROJECT}/${APP}:latest . |
|||
|
|||
push: build |
|||
docker push ${PROJECT}/${APP}:${VERSION} |
|||
docker push ${PROJECT}/${APP}:latest |
|||
@ -1,153 +0,0 @@ |
|||
#!/usr/bin/env bash |
|||
# |
|||
# Copyright © 2016-2018 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. |
|||
# |
|||
|
|||
ZK_USER=${ZK_USER:-"zookeeper"} |
|||
ZK_LOG_LEVEL=${ZK_LOG_LEVEL:-"INFO"} |
|||
ZK_DATA_DIR=${ZK_DATA_DIR:-"/var/lib/zookeeper/data"} |
|||
ZK_DATA_LOG_DIR=${ZK_DATA_LOG_DIR:-"/var/lib/zookeeper/log"} |
|||
ZK_LOG_DIR=${ZK_LOG_DIR:-"var/log/zookeeper"} |
|||
ZK_CONF_DIR=${ZK_CONF_DIR:-"/opt/zookeeper/conf"} |
|||
ZK_CLIENT_PORT=${ZK_CLIENT_PORT:-2181} |
|||
ZK_SERVER_PORT=${ZK_SERVER_PORT:-2888} |
|||
ZK_ELECTION_PORT=${ZK_ELECTION_PORT:-3888} |
|||
ZK_TICK_TIME=${ZK_TICK_TIME:-2000} |
|||
ZK_INIT_LIMIT=${ZK_INIT_LIMIT:-10} |
|||
ZK_SYNC_LIMIT=${ZK_SYNC_LIMIT:-5} |
|||
ZK_HEAP_SIZE=${ZK_HEAP_SIZE:-2G} |
|||
ZK_MAX_CLIENT_CNXNS=${ZK_MAX_CLIENT_CNXNS:-60} |
|||
ZK_MIN_SESSION_TIMEOUT=${ZK_MIN_SESSION_TIMEOUT:- $((ZK_TICK_TIME*2))} |
|||
ZK_MAX_SESSION_TIMEOUT=${ZK_MAX_SESSION_TIMEOUT:- $((ZK_TICK_TIME*20))} |
|||
ZK_SNAP_RETAIN_COUNT=${ZK_SNAP_RETAIN_COUNT:-3} |
|||
ZK_PURGE_INTERVAL=${ZK_PURGE_INTERVAL:-0} |
|||
ID_FILE="$ZK_DATA_DIR/myid" |
|||
ZK_CONFIG_FILE="$ZK_CONF_DIR/zoo.cfg" |
|||
LOGGER_PROPS_FILE="$ZK_CONF_DIR/log4j.properties" |
|||
JAVA_ENV_FILE="$ZK_CONF_DIR/java.env" |
|||
HOST=`hostname -s` |
|||
DOMAIN=`hostname -d` |
|||
|
|||
function print_servers() { |
|||
for (( i=1; i<=$ZK_REPLICAS; i++ )) |
|||
do |
|||
echo "server.$i=$NAME-$((i-1)).$DOMAIN:$ZK_SERVER_PORT:$ZK_ELECTION_PORT" |
|||
done |
|||
} |
|||
|
|||
function validate_env() { |
|||
echo "Validating environment" |
|||
if [ -z $ZK_REPLICAS ]; then |
|||
echo "ZK_REPLICAS is a mandatory environment variable" |
|||
exit 1 |
|||
fi |
|||
|
|||
if [[ $HOST =~ (.*)-([0-9]+)$ ]]; then |
|||
NAME=${BASH_REMATCH[1]} |
|||
ORD=${BASH_REMATCH[2]} |
|||
else |
|||
echo "Failed to extract ordinal from hostname $HOST" |
|||
exit 1 |
|||
fi |
|||
MY_ID=$((ORD+1)) |
|||
echo "ZK_REPLICAS=$ZK_REPLICAS" |
|||
echo "MY_ID=$MY_ID" |
|||
echo "ZK_LOG_LEVEL=$ZK_LOG_LEVEL" |
|||
echo "ZK_DATA_DIR=$ZK_DATA_DIR" |
|||
echo "ZK_DATA_LOG_DIR=$ZK_DATA_LOG_DIR" |
|||
echo "ZK_LOG_DIR=$ZK_LOG_DIR" |
|||
echo "ZK_CLIENT_PORT=$ZK_CLIENT_PORT" |
|||
echo "ZK_SERVER_PORT=$ZK_SERVER_PORT" |
|||
echo "ZK_ELECTION_PORT=$ZK_ELECTION_PORT" |
|||
echo "ZK_TICK_TIME=$ZK_TICK_TIME" |
|||
echo "ZK_INIT_LIMIT=$ZK_INIT_LIMIT" |
|||
echo "ZK_SYNC_LIMIT=$ZK_SYNC_LIMIT" |
|||
echo "ZK_MAX_CLIENT_CNXNS=$ZK_MAX_CLIENT_CNXNS" |
|||
echo "ZK_MIN_SESSION_TIMEOUT=$ZK_MIN_SESSION_TIMEOUT" |
|||
echo "ZK_MAX_SESSION_TIMEOUT=$ZK_MAX_SESSION_TIMEOUT" |
|||
echo "ZK_HEAP_SIZE=$ZK_HEAP_SIZE" |
|||
echo "ZK_SNAP_RETAIN_COUNT=$ZK_SNAP_RETAIN_COUNT" |
|||
echo "ZK_PURGE_INTERVAL=$ZK_PURGE_INTERVAL" |
|||
echo "ENSEMBLE" |
|||
print_servers |
|||
echo "Environment validation successful" |
|||
} |
|||
|
|||
function create_config() { |
|||
rm -f $ZK_CONFIG_FILE |
|||
echo "Creating ZooKeeper configuration" |
|||
echo "#This file was autogenerated by zk DO NOT EDIT" >> $ZK_CONFIG_FILE |
|||
echo "clientPort=$ZK_CLIENT_PORT" >> $ZK_CONFIG_FILE |
|||
echo "dataDir=$ZK_DATA_DIR" >> $ZK_CONFIG_FILE |
|||
echo "dataLogDir=$ZK_DATA_LOG_DIR" >> $ZK_CONFIG_FILE |
|||
echo "tickTime=$ZK_TICK_TIME" >> $ZK_CONFIG_FILE |
|||
echo "initLimit=$ZK_INIT_LIMIT" >> $ZK_CONFIG_FILE |
|||
echo "syncLimit=$ZK_SYNC_LIMIT" >> $ZK_CONFIG_FILE |
|||
echo "maxClientCnxns=$ZK_MAX_CLIENT_CNXNS" >> $ZK_CONFIG_FILE |
|||
echo "minSessionTimeout=$ZK_MIN_SESSION_TIMEOUT" >> $ZK_CONFIG_FILE |
|||
echo "maxSessionTimeout=$ZK_MAX_SESSION_TIMEOUT" >> $ZK_CONFIG_FILE |
|||
echo "autopurge.snapRetainCount=$ZK_SNAP_RETAIN_COUNT" >> $ZK_CONFIG_FILE |
|||
echo "autopurge.purgeInteval=$ZK_PURGE_INTERVAL" >> $ZK_CONFIG_FILE |
|||
|
|||
if [ $ZK_REPLICAS -gt 1 ]; then |
|||
print_servers >> $ZK_CONFIG_FILE |
|||
fi |
|||
echo "Wrote ZooKeeper configuration file to $ZK_CONFIG_FILE" |
|||
} |
|||
|
|||
function create_data_dirs() { |
|||
echo "Creating ZooKeeper data directories and setting permissions" |
|||
if [ ! -d $ZK_DATA_DIR ]; then |
|||
mkdir -p $ZK_DATA_DIR |
|||
chown -R $ZK_USER:$ZK_USER $ZK_DATA_DIR |
|||
fi |
|||
|
|||
if [ ! -d $ZK_DATA_LOG_DIR ]; then |
|||
mkdir -p $ZK_DATA_LOG_DIR |
|||
chown -R $ZK_USER:$ZK_USER $ZK_DATA_LOG_DIR |
|||
fi |
|||
|
|||
if [ ! -d $ZK_LOG_DIR ]; then |
|||
mkdir -p $ZK_LOG_DIR |
|||
chown -R $ZK_USER:$ZK_USER $ZK_LOG_DIR |
|||
fi |
|||
if [ ! -f $ID_FILE ]; then |
|||
echo $MY_ID >> $ID_FILE |
|||
fi |
|||
echo "Created ZooKeeper data directories and set permissions in $ZK_DATA_DIR" |
|||
} |
|||
|
|||
function create_log_props () { |
|||
rm -f $LOGGER_PROPS_FILE |
|||
echo "Creating ZooKeeper log4j configuration" |
|||
echo "zookeeper.root.logger=CONSOLE" >> $LOGGER_PROPS_FILE |
|||
echo "zookeeper.console.threshold="$ZK_LOG_LEVEL >> $LOGGER_PROPS_FILE |
|||
echo "log4j.rootLogger=\${zookeeper.root.logger}" >> $LOGGER_PROPS_FILE |
|||
echo "log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender" >> $LOGGER_PROPS_FILE |
|||
echo "log4j.appender.CONSOLE.Threshold=\${zookeeper.console.threshold}" >> $LOGGER_PROPS_FILE |
|||
echo "log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout" >> $LOGGER_PROPS_FILE |
|||
echo "log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} [myid:%X{myid}] - %-5p [%t:%C{1}@%L] - %m%n" >> $LOGGER_PROPS_FILE |
|||
echo "Wrote log4j configuration to $LOGGER_PROPS_FILE" |
|||
} |
|||
|
|||
function create_java_env() { |
|||
rm -f $JAVA_ENV_FILE |
|||
echo "Creating JVM configuration file" |
|||
echo "ZOO_LOG_DIR=$ZK_LOG_DIR" >> $JAVA_ENV_FILE |
|||
echo "JVMFLAGS=\"-Xmx$ZK_HEAP_SIZE -Xms$ZK_HEAP_SIZE\"" >> $JAVA_ENV_FILE |
|||
echo "Wrote JVM configuration to $JAVA_ENV_FILE" |
|||
} |
|||
|
|||
validate_env && create_config && create_log_props && create_data_dirs && create_java_env |
|||
@ -1,28 +0,0 @@ |
|||
#!/usr/bin/env bash |
|||
# |
|||
# Copyright © 2016-2018 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. |
|||
# |
|||
|
|||
# zk-ok.sh uses the ruok ZooKeeper four letter work to determine if the instance |
|||
# is health. The $? variable will be set to 0 if server responds that it is |
|||
# healthy, or 1 if the server fails to respond. |
|||
|
|||
ZK_CLIENT_PORT=${ZK_CLIENT_PORT:-2181} |
|||
OK=$(echo ruok | nc 127.0.0.1 $ZK_CLIENT_PORT) |
|||
if [ "$OK" == "imok" ]; then |
|||
exit 0 |
|||
else |
|||
exit 1 |
|||
fi |
|||
@ -1,13 +0,0 @@ |
|||
|
|||
DOCKER_REPO=local-maven-build |
|||
|
|||
JS_EXECUTOR_DOCKER_NAME=tb-js-executor |
|||
TB_NODE_DOCKER_NAME=tb-node |
|||
WEB_UI_DOCKER_NAME=tb-web-ui |
|||
MQTT_TRANSPORT_DOCKER_NAME=tb-mqtt-transport |
|||
HTTP_TRANSPORT_DOCKER_NAME=tb-http-transport |
|||
COAP_TRANSPORT_DOCKER_NAME=tb-coap-transport |
|||
|
|||
TB_VERSION=2.2.0-SNAPSHOT |
|||
|
|||
KAFKA_TOPICS=js.eval.requests:100:1:delete --config=retention.ms=60000 --config=segment.bytes=26214400 --config=retention.bytes=104857600,tb.transport.api.requests:30:1:delete --config=retention.ms=60000 --config=segment.bytes=26214400 --config=retention.bytes=104857600,tb.rule-engine:30:1 |
|||
@ -1,177 +0,0 @@ |
|||
# |
|||
# Copyright © 2016-2018 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. |
|||
# |
|||
|
|||
|
|||
version: '2.2' |
|||
|
|||
services: |
|||
zookeeper: |
|||
restart: always |
|||
image: "wurstmeister/zookeeper" |
|||
ports: |
|||
- "2181" |
|||
kafka: |
|||
restart: always |
|||
image: "wurstmeister/kafka" |
|||
ports: |
|||
- "9092:9092" |
|||
environment: |
|||
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 |
|||
KAFKA_LISTENERS: INSIDE://:9093,OUTSIDE://:9092 |
|||
KAFKA_ADVERTISED_LISTENERS: INSIDE://:9093,OUTSIDE://kafka:9092 |
|||
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT |
|||
KAFKA_INTER_BROKER_LISTENER_NAME: INSIDE |
|||
KAFKA_CREATE_TOPICS: "${KAFKA_TOPICS}" |
|||
KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'false' |
|||
KAFKA_LOG_RETENTION_BYTES: 1073741824 |
|||
KAFKA_LOG_SEGMENT_BYTES: 268435456 |
|||
KAFKA_LOG_RETENTION_MS: 300000 |
|||
KAFKA_LOG_CLEANUP_POLICY: delete |
|||
depends_on: |
|||
- zookeeper |
|||
tb-js-executor: |
|||
restart: always |
|||
image: "${DOCKER_REPO}/${JS_EXECUTOR_DOCKER_NAME}:${TB_VERSION}" |
|||
scale: 20 |
|||
environment: |
|||
TB_KAFKA_SERVERS: kafka:9092 |
|||
env_file: |
|||
- tb-js-executor.env |
|||
depends_on: |
|||
- kafka |
|||
tb: |
|||
restart: always |
|||
image: "${DOCKER_REPO}/${TB_NODE_DOCKER_NAME}:${TB_VERSION}" |
|||
ports: |
|||
- "8080" |
|||
logging: |
|||
driver: "json-file" |
|||
options: |
|||
max-size: "200m" |
|||
max-file: "30" |
|||
env_file: |
|||
- tb-node.env |
|||
environment: |
|||
ZOOKEEPER_URL: zk:2181 |
|||
TB_KAFKA_SERVERS: kafka:9092 |
|||
JS_EVALUATOR: remote |
|||
volumes: |
|||
- ./tb-node/db:/usr/share/thingsboard/data/db |
|||
- ./tb-node/conf:/config |
|||
- ./tb-node/log:/var/log/thingsboard |
|||
depends_on: |
|||
- kafka |
|||
tb-mqtt-transport1: |
|||
restart: always |
|||
image: "${DOCKER_REPO}/${MQTT_TRANSPORT_DOCKER_NAME}:${TB_VERSION}" |
|||
ports: |
|||
- "1883" |
|||
environment: |
|||
TB_KAFKA_SERVERS: kafka:9092 |
|||
env_file: |
|||
- tb-mqtt-transport.env |
|||
depends_on: |
|||
- kafka |
|||
tb-mqtt-transport2: |
|||
restart: always |
|||
image: "${DOCKER_REPO}/${MQTT_TRANSPORT_DOCKER_NAME}:${TB_VERSION}" |
|||
ports: |
|||
- "1883" |
|||
environment: |
|||
TB_KAFKA_SERVERS: kafka:9092 |
|||
env_file: |
|||
- tb-mqtt-transport.env |
|||
depends_on: |
|||
- kafka |
|||
tb-http-transport1: |
|||
restart: always |
|||
image: "${DOCKER_REPO}/${HTTP_TRANSPORT_DOCKER_NAME}:${TB_VERSION}" |
|||
ports: |
|||
- "8081" |
|||
environment: |
|||
TB_KAFKA_SERVERS: kafka:9092 |
|||
env_file: |
|||
- tb-http-transport.env |
|||
depends_on: |
|||
- kafka |
|||
tb-http-transport2: |
|||
restart: always |
|||
image: "${DOCKER_REPO}/${HTTP_TRANSPORT_DOCKER_NAME}:${TB_VERSION}" |
|||
ports: |
|||
- "8081" |
|||
environment: |
|||
TB_KAFKA_SERVERS: kafka:9092 |
|||
env_file: |
|||
- tb-http-transport.env |
|||
depends_on: |
|||
- kafka |
|||
tb-coap-transport: |
|||
restart: always |
|||
image: "${DOCKER_REPO}/${COAP_TRANSPORT_DOCKER_NAME}:${TB_VERSION}" |
|||
ports: |
|||
- "5683:5683/udp" |
|||
environment: |
|||
TB_KAFKA_SERVERS: kafka:9092 |
|||
env_file: |
|||
- tb-coap-transport.env |
|||
depends_on: |
|||
- kafka |
|||
tb-web-ui1: |
|||
restart: always |
|||
image: "${DOCKER_REPO}/${WEB_UI_DOCKER_NAME}:${TB_VERSION}" |
|||
ports: |
|||
- "8080" |
|||
environment: |
|||
TB_HOST: tb |
|||
TB_PORT: 8080 |
|||
env_file: |
|||
- tb-web-ui.env |
|||
tb-web-ui2: |
|||
restart: always |
|||
image: "${DOCKER_REPO}/${WEB_UI_DOCKER_NAME}:${TB_VERSION}" |
|||
ports: |
|||
- "8080" |
|||
environment: |
|||
TB_HOST: tb |
|||
TB_PORT: 8080 |
|||
env_file: |
|||
- tb-web-ui.env |
|||
web: |
|||
restart: always |
|||
container_name: haproxy-certbot |
|||
image: nmarus/haproxy-certbot |
|||
volumes: |
|||
- ./haproxy/config:/config |
|||
- ./haproxy/letsencrypt:/etc/letsencrypt |
|||
- ./haproxy/certs.d:/usr/local/etc/haproxy/certs.d |
|||
ports: |
|||
- "80:80" |
|||
- "443:443" |
|||
- "1883:1883" |
|||
- "9999:9999" |
|||
cap_add: |
|||
- NET_ADMIN |
|||
environment: |
|||
HTTP_PORT: 80 |
|||
HTTPS_PORT: 443 |
|||
MQTT_PORT: 1883 |
|||
links: |
|||
- tb-web-ui1 |
|||
- tb-web-ui2 |
|||
- tb-mqtt-transport1 |
|||
- tb-mqtt-transport2 |
|||
- tb-http-transport1 |
|||
- tb-http-transport2 |
|||
@ -1,22 +0,0 @@ |
|||
# ThingsBoard server configuration |
|||
|
|||
TRANSPORT_TYPE=remote |
|||
|
|||
# type of database to use: sql[DEFAULT] or cassandra |
|||
DATABASE_TS_TYPE=sql |
|||
DATABASE_ENTITIES_TYPE=sql |
|||
SQL_DATA_FOLDER=/usr/share/thingsboard/data/db |
|||
|
|||
# cassandra db config |
|||
CASSANDRA_URL=cassandra:9042 |
|||
CASSANDRA_HOST=cassandra |
|||
CASSANDRA_PORT=9042 |
|||
|
|||
# postgres db config |
|||
POSTGRES_HOST=postgres |
|||
POSTGRES_PORT=5432 |
|||
# 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 |
|||
@ -0,0 +1,68 @@ |
|||
# ThingsBoard single docker images |
|||
|
|||
This project provides the build for the ThingsBoard single docker images. |
|||
|
|||
* `thingsboard/tb` - single instance of ThingsBoard with embedded HSQLDB database. |
|||
* `thingsboard/tb-postgres` - single instance of ThingsBoard with PostgreSQL database. |
|||
* `thingsboard/tb-cassandra` - single instance of ThingsBoard with Cassandra database. |
|||
|
|||
## Running |
|||
|
|||
Execute the following command to run this docker directly: |
|||
|
|||
` |
|||
$ docker run -it -p 9090:9090 -p 1883:1883 -p 5683:5683/udp -v ~/.mytb-data:/data --name mytb thingsboard/tb |
|||
` |
|||
|
|||
Where: |
|||
|
|||
- `docker run` - run this container |
|||
- `-it` - attach a terminal session with current ThingsBoard process output |
|||
- `-p 9090:9090` - connect local port 9090 to exposed internal HTTP port 9090 |
|||
- `-p 1883:1883` - connect local port 1883 to exposed internal MQTT port 1883 |
|||
- `-p 5683:5683` - connect local port 5683 to exposed internal COAP port 5683 |
|||
- `-v ~/.mytb-data:/data` - mounts the host's dir `~/.mytb-data` to ThingsBoard DataBase data directory |
|||
- `--name mytb` - friendly local name of this machine |
|||
- `thingsboard/tb` - docker image |
|||
|
|||
After executing this command you can open `http://{yor-host-ip}:9090` in you browser. You should see ThingsBoard login page. |
|||
Use the following default credentials: |
|||
|
|||
- **Systen Administrator**: sysadmin@thingsboard.org / sysadmin |
|||
- **Tenant Administrator**: tenant@thingsboard.org / tenant |
|||
- **Customer User**: customer@thingsboard.org / customer |
|||
|
|||
You can always change passwords for each account in account profile page. |
|||
|
|||
You can detach from session terminal with `Ctrl-p` `Ctrl-q` - the container will keep running in the background. |
|||
|
|||
To reattach to the terminal (to see ThingsBoard logs) run: |
|||
|
|||
` |
|||
$ docker attach mytb |
|||
` |
|||
|
|||
To stop the container: |
|||
|
|||
` |
|||
$ docker stop mytb |
|||
` |
|||
|
|||
To start the container: |
|||
|
|||
` |
|||
$ docker start mytb |
|||
` |
|||
|
|||
## Upgrading |
|||
|
|||
In order to update to the latest image, execute the following commands: |
|||
|
|||
` |
|||
$ docker pull thingsboard/tb |
|||
$ docker stop mytb |
|||
$ docker run -it -v ~/.mytb-data:/data --rm thingsboard/tb upgrade-tb.sh |
|||
$ docker start mytb |
|||
` |
|||
|
|||
**NOTE**: replace host's directory `~/.mytb-data` with directory used during container creation. |
|||
@ -0,0 +1,59 @@ |
|||
# |
|||
# Copyright © 2016-2018 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 openjdk:8-jre |
|||
|
|||
RUN apt-get update |
|||
RUN apt-get install -y curl nmap procps |
|||
RUN echo 'deb http://www.apache.org/dist/cassandra/debian 311x main' | tee --append /etc/apt/sources.list.d/cassandra.list > /dev/null |
|||
RUN curl https://www.apache.org/dist/cassandra/KEYS | apt-key add - |
|||
RUN apt-get update |
|||
RUN apt-get install -y cassandra cassandra-tools |
|||
RUN update-rc.d cassandra disable |
|||
RUN sed -i.old '/ulimit/d' /etc/init.d/cassandra |
|||
|
|||
COPY logback.xml ${pkg.name}.conf start-db.sh stop-db.sh start-tb.sh upgrade-tb.sh install-tb.sh ${pkg.name}.deb /tmp/ |
|||
|
|||
RUN chmod a+x /tmp/*.sh \ |
|||
&& mv /tmp/start-tb.sh /usr/bin \ |
|||
&& mv /tmp/upgrade-tb.sh /usr/bin \ |
|||
&& mv /tmp/install-tb.sh /usr/bin \ |
|||
&& mv /tmp/start-db.sh /usr/bin \ |
|||
&& mv /tmp/stop-db.sh /usr/bin |
|||
|
|||
RUN dpkg -i /tmp/${pkg.name}.deb |
|||
|
|||
RUN update-rc.d ${pkg.name} disable |
|||
|
|||
RUN mv /tmp/logback.xml ${pkg.installFolder}/conf \ |
|||
&& mv /tmp/${pkg.name}.conf ${pkg.installFolder}/conf |
|||
|
|||
ENV DATA_FOLDER=/data |
|||
|
|||
ENV HTTP_BIND_PORT=9090 |
|||
ENV DATABASE_TS_TYPE=cassandra |
|||
ENV DATABASE_ENTITIES_TYPE=cassandra |
|||
|
|||
ENV CASSANDRA_HOST=localhost |
|||
ENV CASSANDRA_PORT=9042 |
|||
|
|||
EXPOSE 9090 |
|||
EXPOSE 1883 |
|||
EXPOSE 5683/udp |
|||
|
|||
VOLUME ["/data"] |
|||
|
|||
CMD ["start-tb.sh"] |
|||
@ -0,0 +1,62 @@ |
|||
# |
|||
# Copyright © 2016-2018 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 openjdk:8-jre |
|||
|
|||
RUN apt-get update |
|||
RUN apt-get install -y postgresql postgresql-contrib |
|||
RUN update-rc.d postgresql disable |
|||
|
|||
RUN mkdir -p /var/log/postgres |
|||
RUN chown -R postgres:postgres /var/log/postgres |
|||
|
|||
COPY logback.xml ${pkg.name}.conf start-db.sh stop-db.sh start-tb.sh upgrade-tb.sh install-tb.sh ${pkg.name}.deb /tmp/ |
|||
|
|||
RUN chmod a+x /tmp/*.sh \ |
|||
&& mv /tmp/start-tb.sh /usr/bin \ |
|||
&& mv /tmp/upgrade-tb.sh /usr/bin \ |
|||
&& mv /tmp/install-tb.sh /usr/bin \ |
|||
&& mv /tmp/start-db.sh /usr/bin \ |
|||
&& mv /tmp/stop-db.sh /usr/bin |
|||
|
|||
RUN dpkg -i /tmp/${pkg.name}.deb |
|||
|
|||
RUN update-rc.d ${pkg.name} disable |
|||
|
|||
RUN mv /tmp/logback.xml ${pkg.installFolder}/conf \ |
|||
&& mv /tmp/${pkg.name}.conf ${pkg.installFolder}/conf |
|||
|
|||
ENV DATA_FOLDER=/data |
|||
|
|||
ENV HTTP_BIND_PORT=9090 |
|||
ENV DATABASE_TS_TYPE=sql |
|||
ENV DATABASE_ENTITIES_TYPE=sql |
|||
|
|||
ENV PGDATA=/data/db |
|||
|
|||
ENV SPRING_JPA_DATABASE_PLATFORM=org.hibernate.dialect.PostgreSQLDialect |
|||
ENV SPRING_DRIVER_CLASS_NAME=org.postgresql.Driver |
|||
ENV SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/thingsboard |
|||
ENV SPRING_DATASOURCE_USERNAME=postgres |
|||
ENV SPRING_DATASOURCE_PASSWORD=postgres |
|||
|
|||
EXPOSE 9090 |
|||
EXPOSE 1883 |
|||
EXPOSE 5683/udp |
|||
|
|||
VOLUME ["/data"] |
|||
|
|||
CMD ["start-tb.sh"] |
|||
@ -0,0 +1,48 @@ |
|||
# |
|||
# Copyright © 2016-2018 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 openjdk:8-jre |
|||
|
|||
COPY logback.xml ${pkg.name}.conf start-db.sh stop-db.sh start-tb.sh upgrade-tb.sh install-tb.sh ${pkg.name}.deb /tmp/ |
|||
|
|||
RUN chmod a+x /tmp/*.sh \ |
|||
&& mv /tmp/start-tb.sh /usr/bin \ |
|||
&& mv /tmp/upgrade-tb.sh /usr/bin \ |
|||
&& mv /tmp/install-tb.sh /usr/bin \ |
|||
&& mv /tmp/start-db.sh /usr/bin \ |
|||
&& mv /tmp/stop-db.sh /usr/bin |
|||
|
|||
RUN dpkg -i /tmp/${pkg.name}.deb |
|||
|
|||
RUN update-rc.d ${pkg.name} disable |
|||
|
|||
RUN mv /tmp/logback.xml ${pkg.installFolder}/conf \ |
|||
&& mv /tmp/${pkg.name}.conf ${pkg.installFolder}/conf |
|||
|
|||
ENV DATA_FOLDER=/data |
|||
|
|||
ENV HTTP_BIND_PORT=9090 |
|||
ENV DATABASE_TS_TYPE=sql |
|||
ENV DATABASE_ENTITIES_TYPE=sql |
|||
ENV SQL_DATA_FOLDER=/data/db |
|||
|
|||
EXPOSE 9090 |
|||
EXPOSE 1883 |
|||
EXPOSE 5683/udp |
|||
|
|||
VOLUME ["/data"] |
|||
|
|||
CMD ["start-tb.sh"] |
|||
@ -0,0 +1,56 @@ |
|||
#!/bin/bash |
|||
# |
|||
# Copyright © 2016-2018 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. |
|||
# |
|||
|
|||
while [[ $# -gt 0 ]] |
|||
do |
|||
key="$1" |
|||
|
|||
case $key in |
|||
--loadDemo) |
|||
LOAD_DEMO=true |
|||
shift # past argument |
|||
;; |
|||
*) |
|||
# unknown option |
|||
;; |
|||
esac |
|||
shift # past argument or value |
|||
done |
|||
|
|||
if [ "$LOAD_DEMO" == "true" ]; then |
|||
loadDemo=true |
|||
else |
|||
loadDemo=false |
|||
fi |
|||
|
|||
CONF_FOLDER="${pkg.installFolder}/conf" |
|||
jarfile=${pkg.installFolder}/bin/${pkg.name}.jar |
|||
configfile=${pkg.name}.conf |
|||
upgradeversion=${DATA_FOLDER}/.upgradeversion |
|||
|
|||
source "${CONF_FOLDER}/${configfile}" |
|||
|
|||
echo "Starting ThingsBoard installation ..." |
|||
|
|||
java -cp ${jarfile} $JAVA_OPTS -Dloader.main=org.thingsboard.server.ThingsboardInstallApplication \ |
|||
-Dinstall.load_demo=${loadDemo} \ |
|||
-Dspring.jpa.hibernate.ddl-auto=none \ |
|||
-Dinstall.upgrade=false \ |
|||
-Dlogging.config=/usr/share/thingsboard/bin/install/logback.xml \ |
|||
org.springframework.boot.loader.PropertiesLauncher |
|||
|
|||
echo "${pkg.upgradeVersion}" > ${upgradeversion} |
|||
@ -0,0 +1,51 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!-- |
|||
|
|||
Copyright © 2016-2018 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. |
|||
|
|||
--> |
|||
<!DOCTYPE configuration> |
|||
<configuration scan="true" scanPeriod="10 seconds"> |
|||
|
|||
<appender name="fileLogAppender" |
|||
class="ch.qos.logback.core.rolling.RollingFileAppender"> |
|||
<file>/var/log/thingsboard/thingsboard.log</file> |
|||
<rollingPolicy |
|||
class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
|||
<fileNamePattern>/var/log/thingsboard/thingsboard.%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
|||
<maxFileSize>100MB</maxFileSize> |
|||
<maxHistory>30</maxHistory> |
|||
<totalSizeCap>3GB</totalSizeCap> |
|||
</rollingPolicy> |
|||
<encoder> |
|||
<pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern> |
|||
</encoder> |
|||
</appender> |
|||
|
|||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> |
|||
<encoder> |
|||
<pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern> |
|||
</encoder> |
|||
</appender> |
|||
|
|||
<logger name="org.thingsboard.server" level="INFO" /> |
|||
<logger name="akka" level="INFO" /> |
|||
|
|||
<root level="INFO"> |
|||
<appender-ref ref="fileLogAppender"/> |
|||
<appender-ref ref="STDOUT"/> |
|||
</root> |
|||
|
|||
</configuration> |
|||
@ -0,0 +1,39 @@ |
|||
#!/bin/bash |
|||
# |
|||
# Copyright © 2016-2018 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. |
|||
# |
|||
|
|||
start-db.sh |
|||
|
|||
CONF_FOLDER="${pkg.installFolder}/conf" |
|||
jarfile=${pkg.installFolder}/bin/${pkg.name}.jar |
|||
configfile=${pkg.name}.conf |
|||
firstlaunch=${DATA_FOLDER}/.firstlaunch |
|||
|
|||
source "${CONF_FOLDER}/${configfile}" |
|||
|
|||
if [ ! -f ${firstlaunch} ]; then |
|||
install-tb.sh --loadDemo |
|||
touch ${firstlaunch} |
|||
fi |
|||
|
|||
echo "Starting ThingsBoard ..." |
|||
|
|||
java -cp ${jarfile} $JAVA_OPTS -Dloader.main=org.thingsboard.server.ThingsboardServerApplication \ |
|||
-Dspring.jpa.hibernate.ddl-auto=none \ |
|||
-Dlogging.config=${CONF_FOLDER}/logback.xml \ |
|||
org.springframework.boot.loader.PropertiesLauncher |
|||
|
|||
stop-db.sh |
|||
@ -0,0 +1,24 @@ |
|||
# |
|||
# Copyright © 2016-2018 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. |
|||
# |
|||
|
|||
export JAVA_OPTS="$JAVA_OPTS -Dplatform=deb -Dinstall.data_dir=/usr/share/thingsboard/data" |
|||
export JAVA_OPTS="$JAVA_OPTS -Xloggc:/var/log/thingsboard/gc.log -XX:+IgnoreUnrecognizedVMOptions -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDetails -XX:+PrintGCDateStamps" |
|||
export JAVA_OPTS="$JAVA_OPTS -XX:+PrintHeapAtGC -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10" |
|||
export JAVA_OPTS="$JAVA_OPTS -XX:GCLogFileSize=10M -XX:-UseBiasedLocking -XX:+UseTLAB -XX:+ResizeTLAB -XX:+PerfDisableSharedMem -XX:+UseCondCardMark" |
|||
export JAVA_OPTS="$JAVA_OPTS -XX:CMSWaitDuration=10000 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+CMSParallelInitialMarkEnabled" |
|||
export JAVA_OPTS="$JAVA_OPTS -XX:+CMSEdenChunksRecordAlways -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+ExitOnOutOfMemoryError" |
|||
export LOG_FILENAME=thingsboard.out |
|||
export LOADER_PATH=/usr/share/thingsboard/conf,/usr/share/thingsboard/extensions |
|||
@ -0,0 +1,47 @@ |
|||
#!/bin/bash |
|||
# |
|||
# Copyright © 2016-2018 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. |
|||
# |
|||
|
|||
start-db.sh |
|||
|
|||
CONF_FOLDER="${pkg.installFolder}/conf" |
|||
jarfile=${pkg.installFolder}/bin/${pkg.name}.jar |
|||
configfile=${pkg.name}.conf |
|||
upgradeversion=${DATA_FOLDER}/.upgradeversion |
|||
|
|||
source "${CONF_FOLDER}/${configfile}" |
|||
|
|||
FROM_VERSION=`cat ${upgradeversion}` |
|||
|
|||
echo "Starting ThingsBoard upgrade ..." |
|||
|
|||
if [[ -z "${FROM_VERSION// }" ]]; then |
|||
echo "FROM_VERSION variable is invalid or unspecified!" |
|||
exit 1 |
|||
else |
|||
fromVersion="${FROM_VERSION// }" |
|||
fi |
|||
|
|||
java -cp ${jarfile} $JAVA_OPTS -Dloader.main=org.thingsboard.server.ThingsboardInstallApplication \ |
|||
-Dspring.jpa.hibernate.ddl-auto=none \ |
|||
-Dinstall.upgrade=true \ |
|||
-Dinstall.upgrade.from_version=${fromVersion} \ |
|||
-Dlogging.config=/usr/share/thingsboard/bin/install/logback.xml \ |
|||
org.springframework.boot.loader.PropertiesLauncher |
|||
|
|||
echo "${pkg.upgradeVersion}" > ${upgradeversion} |
|||
|
|||
stop-db.sh |
|||
@ -0,0 +1,370 @@ |
|||
<!-- |
|||
|
|||
Copyright © 2016-2018 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. |
|||
|
|||
--> |
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
<parent> |
|||
<groupId>org.thingsboard</groupId> |
|||
<version>2.2.0-SNAPSHOT</version> |
|||
<artifactId>msa</artifactId> |
|||
</parent> |
|||
<groupId>org.thingsboard.msa</groupId> |
|||
<artifactId>tb</artifactId> |
|||
<packaging>pom</packaging> |
|||
|
|||
<name>ThingsBoard Docker Images</name> |
|||
<url>https://thingsboard.io</url> |
|||
<description>ThingsBoard Docker Images</description> |
|||
|
|||
<properties> |
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
|||
<main.dir>${basedir}/../..</main.dir> |
|||
<pkg.name>thingsboard</pkg.name> |
|||
<tb.docker.name>tb</tb.docker.name> |
|||
<tb-postgres.docker.name>tb-postgres</tb-postgres.docker.name> |
|||
<tb-cassandra.docker.name>tb-cassandra</tb-cassandra.docker.name> |
|||
<pkg.user>thingsboard</pkg.user> |
|||
<pkg.installFolder>/usr/share/${pkg.name}</pkg.installFolder> |
|||
<pkg.upgradeVersion>2.1.1</pkg.upgradeVersion> |
|||
</properties> |
|||
|
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>org.thingsboard</groupId> |
|||
<artifactId>application</artifactId> |
|||
<version>${project.version}</version> |
|||
<classifier>deb</classifier> |
|||
<type>deb</type> |
|||
<scope>provided</scope> |
|||
</dependency> |
|||
</dependencies> |
|||
|
|||
<build> |
|||
<plugins> |
|||
<plugin> |
|||
<groupId>org.apache.maven.plugins</groupId> |
|||
<artifactId>maven-dependency-plugin</artifactId> |
|||
<executions> |
|||
<execution> |
|||
<id>copy-tb-deb</id> |
|||
<phase>package</phase> |
|||
<goals> |
|||
<goal>copy</goal> |
|||
</goals> |
|||
<configuration> |
|||
<artifactItems> |
|||
<artifactItem> |
|||
<groupId>org.thingsboard</groupId> |
|||
<artifactId>application</artifactId> |
|||
<classifier>deb</classifier> |
|||
<type>deb</type> |
|||
<destFileName>${pkg.name}.deb</destFileName> |
|||
<outputDirectory>${project.build.directory}/docker-tb</outputDirectory> |
|||
</artifactItem> |
|||
</artifactItems> |
|||
</configuration> |
|||
</execution> |
|||
<execution> |
|||
<id>copy-tb-postgres-deb</id> |
|||
<phase>package</phase> |
|||
<goals> |
|||
<goal>copy</goal> |
|||
</goals> |
|||
<configuration> |
|||
<artifactItems> |
|||
<artifactItem> |
|||
<groupId>org.thingsboard</groupId> |
|||
<artifactId>application</artifactId> |
|||
<classifier>deb</classifier> |
|||
<type>deb</type> |
|||
<destFileName>${pkg.name}.deb</destFileName> |
|||
<outputDirectory>${project.build.directory}/docker-postgres</outputDirectory> |
|||
</artifactItem> |
|||
</artifactItems> |
|||
</configuration> |
|||
</execution> |
|||
<execution> |
|||
<id>copy-tb-cassandra-deb</id> |
|||
<phase>package</phase> |
|||
<goals> |
|||
<goal>copy</goal> |
|||
</goals> |
|||
<configuration> |
|||
<artifactItems> |
|||
<artifactItem> |
|||
<groupId>org.thingsboard</groupId> |
|||
<artifactId>application</artifactId> |
|||
<classifier>deb</classifier> |
|||
<type>deb</type> |
|||
<destFileName>${pkg.name}.deb</destFileName> |
|||
<outputDirectory>${project.build.directory}/docker-cassandra</outputDirectory> |
|||
</artifactItem> |
|||
</artifactItems> |
|||
</configuration> |
|||
</execution> |
|||
</executions> |
|||
</plugin> |
|||
<plugin> |
|||
<groupId>org.apache.maven.plugins</groupId> |
|||
<artifactId>maven-resources-plugin</artifactId> |
|||
<executions> |
|||
<execution> |
|||
<id>copy-docker-tb-config</id> |
|||
<phase>process-resources</phase> |
|||
<goals> |
|||
<goal>copy-resources</goal> |
|||
</goals> |
|||
<configuration> |
|||
<outputDirectory>${project.build.directory}/docker-tb</outputDirectory> |
|||
<resources> |
|||
<resource> |
|||
<directory>docker</directory> |
|||
<filtering>true</filtering> |
|||
</resource> |
|||
<resource> |
|||
<directory>docker-tb</directory> |
|||
<filtering>true</filtering> |
|||
</resource> |
|||
</resources> |
|||
</configuration> |
|||
</execution> |
|||
<execution> |
|||
<id>copy-docker-tb-postgres-config</id> |
|||
<phase>process-resources</phase> |
|||
<goals> |
|||
<goal>copy-resources</goal> |
|||
</goals> |
|||
<configuration> |
|||
<outputDirectory>${project.build.directory}/docker-postgres</outputDirectory> |
|||
<resources> |
|||
<resource> |
|||
<directory>docker</directory> |
|||
<filtering>true</filtering> |
|||
</resource> |
|||
<resource> |
|||
<directory>docker-postgres</directory> |
|||
<filtering>true</filtering> |
|||
</resource> |
|||
</resources> |
|||
</configuration> |
|||
</execution> |
|||
<execution> |
|||
<id>copy-docker-tb-cassandra-config</id> |
|||
<phase>process-resources</phase> |
|||
<goals> |
|||
<goal>copy-resources</goal> |
|||
</goals> |
|||
<configuration> |
|||
<outputDirectory>${project.build.directory}/docker-cassandra</outputDirectory> |
|||
<resources> |
|||
<resource> |
|||
<directory>docker</directory> |
|||
<filtering>true</filtering> |
|||
</resource> |
|||
<resource> |
|||
<directory>docker-cassandra</directory> |
|||
<filtering>true</filtering> |
|||
</resource> |
|||
</resources> |
|||
</configuration> |
|||
</execution> |
|||
</executions> |
|||
</plugin> |
|||
<plugin> |
|||
<groupId>com.spotify</groupId> |
|||
<artifactId>dockerfile-maven-plugin</artifactId> |
|||
<executions> |
|||
<execution> |
|||
<id>build-docker-tb-image</id> |
|||
<phase>pre-integration-test</phase> |
|||
<goals> |
|||
<goal>build</goal> |
|||
</goals> |
|||
<configuration> |
|||
<skip>${dockerfile.skip}</skip> |
|||
<repository>${docker.repo}/${tb.docker.name}</repository> |
|||
<verbose>true</verbose> |
|||
<googleContainerRegistryEnabled>false</googleContainerRegistryEnabled> |
|||
<contextDirectory>${project.build.directory}/docker-tb</contextDirectory> |
|||
</configuration> |
|||
</execution> |
|||
<execution> |
|||
<id>tag-docker-tb-image</id> |
|||
<phase>pre-integration-test</phase> |
|||
<goals> |
|||
<goal>tag</goal> |
|||
</goals> |
|||
<configuration> |
|||
<skip>${dockerfile.skip}</skip> |
|||
<repository>${docker.repo}/${tb.docker.name}</repository> |
|||
<tag>${project.version}</tag> |
|||
</configuration> |
|||
</execution> |
|||
<execution> |
|||
<id>build-docker-tb-postgres-image</id> |
|||
<phase>pre-integration-test</phase> |
|||
<goals> |
|||
<goal>build</goal> |
|||
</goals> |
|||
<configuration> |
|||
<skip>${dockerfile.skip}</skip> |
|||
<repository>${docker.repo}/${tb-postgres.docker.name}</repository> |
|||
<verbose>true</verbose> |
|||
<googleContainerRegistryEnabled>false</googleContainerRegistryEnabled> |
|||
<contextDirectory>${project.build.directory}/docker-postgres</contextDirectory> |
|||
</configuration> |
|||
</execution> |
|||
<execution> |
|||
<id>tag-docker-tb-postgres-image</id> |
|||
<phase>pre-integration-test</phase> |
|||
<goals> |
|||
<goal>tag</goal> |
|||
</goals> |
|||
<configuration> |
|||
<skip>${dockerfile.skip}</skip> |
|||
<repository>${docker.repo}/${tb-postgres.docker.name}</repository> |
|||
<tag>${project.version}</tag> |
|||
</configuration> |
|||
</execution> |
|||
<execution> |
|||
<id>build-docker-tb-cassandra-image</id> |
|||
<phase>pre-integration-test</phase> |
|||
<goals> |
|||
<goal>build</goal> |
|||
</goals> |
|||
<configuration> |
|||
<skip>${dockerfile.skip}</skip> |
|||
<repository>${docker.repo}/${tb-cassandra.docker.name}</repository> |
|||
<verbose>true</verbose> |
|||
<googleContainerRegistryEnabled>false</googleContainerRegistryEnabled> |
|||
<contextDirectory>${project.build.directory}/docker-cassandra</contextDirectory> |
|||
</configuration> |
|||
</execution> |
|||
<execution> |
|||
<id>tag-docker-tb-cassandra-image</id> |
|||
<phase>pre-integration-test</phase> |
|||
<goals> |
|||
<goal>tag</goal> |
|||
</goals> |
|||
<configuration> |
|||
<skip>${dockerfile.skip}</skip> |
|||
<repository>${docker.repo}/${tb-cassandra.docker.name}</repository> |
|||
<tag>${project.version}</tag> |
|||
</configuration> |
|||
</execution> |
|||
</executions> |
|||
</plugin> |
|||
</plugins> |
|||
</build> |
|||
<profiles> |
|||
<profile> |
|||
<id>push-docker-image</id> |
|||
<activation> |
|||
<property> |
|||
<name>push-docker-image</name> |
|||
</property> |
|||
</activation> |
|||
<build> |
|||
<plugins> |
|||
<plugin> |
|||
<groupId>com.spotify</groupId> |
|||
<artifactId>dockerfile-maven-plugin</artifactId> |
|||
<executions> |
|||
<execution> |
|||
<id>push-latest-docker-tb-image</id> |
|||
<phase>pre-integration-test</phase> |
|||
<goals> |
|||
<goal>push</goal> |
|||
</goals> |
|||
<configuration> |
|||
<tag>latest</tag> |
|||
<repository>${docker.repo}/${tb.docker.name}</repository> |
|||
</configuration> |
|||
</execution> |
|||
<execution> |
|||
<id>push-version-docker-tb-image</id> |
|||
<phase>pre-integration-test</phase> |
|||
<goals> |
|||
<goal>push</goal> |
|||
</goals> |
|||
<configuration> |
|||
<tag>${project.version}</tag> |
|||
<repository>${docker.repo}/${tb.docker.name}</repository> |
|||
</configuration> |
|||
</execution> |
|||
<execution> |
|||
<id>push-latest-docker-tb-postgres-image</id> |
|||
<phase>pre-integration-test</phase> |
|||
<goals> |
|||
<goal>push</goal> |
|||
</goals> |
|||
<configuration> |
|||
<tag>latest</tag> |
|||
<repository>${docker.repo}/${tb-postgres.docker.name}</repository> |
|||
</configuration> |
|||
</execution> |
|||
<execution> |
|||
<id>push-version-docker-tb-postgres-image</id> |
|||
<phase>pre-integration-test</phase> |
|||
<goals> |
|||
<goal>push</goal> |
|||
</goals> |
|||
<configuration> |
|||
<tag>${project.version}</tag> |
|||
<repository>${docker.repo}/${tb-postgres.docker.name}</repository> |
|||
</configuration> |
|||
</execution> |
|||
<execution> |
|||
<id>push-latest-docker-tb-cassandra-image</id> |
|||
<phase>pre-integration-test</phase> |
|||
<goals> |
|||
<goal>push</goal> |
|||
</goals> |
|||
<configuration> |
|||
<tag>latest</tag> |
|||
<repository>${docker.repo}/${tb-cassandra.docker.name}</repository> |
|||
</configuration> |
|||
</execution> |
|||
<execution> |
|||
<id>push-version-docker-tb-cassandra-image</id> |
|||
<phase>pre-integration-test</phase> |
|||
<goals> |
|||
<goal>push</goal> |
|||
</goals> |
|||
<configuration> |
|||
<tag>${project.version}</tag> |
|||
<repository>${docker.repo}/${tb-cassandra.docker.name}</repository> |
|||
</configuration> |
|||
</execution> |
|||
</executions> |
|||
</plugin> |
|||
</plugins> |
|||
</build> |
|||
</profile> |
|||
</profiles> |
|||
<repositories> |
|||
<repository> |
|||
<id>jenkins</id> |
|||
<name>Jenkins Repository</name> |
|||
<url>http://repo.jenkins-ci.org/releases</url> |
|||
<snapshots> |
|||
<enabled>false</enabled> |
|||
</snapshots> |
|||
</repository> |
|||
</repositories> |
|||
</project> |
|||
Loading…
Reference in new issue