MSA docker improvements.

This commit is contained in:
Igor Kulikov 2018-10-03 18:58:17 +03:00
parent 8af8b27e7e
commit ee3d75bb4f
17 changed files with 61 additions and 40 deletions

View File

@ -3,5 +3,3 @@ DOCKER_REPO=local-maven-build
TB_VERSION=2.2.0-SNAPSHOT TB_VERSION=2.2.0-SNAPSHOT
KAFKA_TOPICS=js.eval.requests:100:1 KAFKA_TOPICS=js.eval.requests:100:1
HTTP_PORT=80
HTTPS_PORT=80

View File

@ -1,4 +1,5 @@
haproxy/certs.d/** haproxy/certs.d/**
haproxy/letsencrypt/** haproxy/letsencrypt/**
tb-node/log/** tb-node/log/**
tb-node/db/**
!.env !.env

26
msa/docker/check-dirs.sh Executable file
View File

@ -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.
#
dirsArray=("./haproxy/certs.d" "./haproxy/letsencrypt" "./tb-node/db" "./tb-node/log")
for dir in ${dirsArray[@]}
do
if [ ! -d "$dir" ]; then
echo creating dir $dir
mkdir -p $dir
fi
done

View File

@ -61,7 +61,7 @@ services:
TB_KAFKA_SERVERS: kafka:9092 TB_KAFKA_SERVERS: kafka:9092
JS_EVALUATOR: remote JS_EVALUATOR: remote
volumes: volumes:
- ./tb-node/db:/usr/share/thingsboard/data/db" - ./tb-node/db:/usr/share/thingsboard/data/db
- ./tb-node/conf:/config - ./tb-node/conf:/config
- ./tb-node/log:/var/log/thingsboard - ./tb-node/log:/var/log/thingsboard
depends_on: depends_on:
@ -86,16 +86,6 @@ services:
TB_PORT: 8080 TB_PORT: 8080
env_file: env_file:
- tb-web-ui.env - tb-web-ui.env
tb-web-ui3:
restart: always
image: "${DOCKER_REPO}/tb-web-ui:${TB_VERSION}"
ports:
- "8080"
environment:
TB_HOST: tb
TB_PORT: 8080
env_file:
- tb-web-ui.env
web: web:
restart: always restart: always
container_name: haproxy-certbot container_name: haproxy-certbot
@ -111,9 +101,8 @@ services:
cap_add: cap_add:
- NET_ADMIN - NET_ADMIN
environment: environment:
HTTP_PORT: ${HTTP_PORT} HTTP_PORT: 80
HTTPS_PORT: ${HTTPS_PORT} HTTPS_PORT: 443
links: links:
- tb-web-ui1 - tb-web-ui1
- tb-web-ui2 - tb-web-ui2
- tb-web-ui3

View File

@ -15,6 +15,8 @@
# limitations under the License. # limitations under the License.
# #
./check-dirs.sh
while [[ $# -gt 0 ]] while [[ $# -gt 0 ]]
do do
key="$1" key="$1"
@ -37,6 +39,6 @@ else
loadDemo=false loadDemo=false
fi fi
docker-compose run --rm -e INSTALL_TB=true -e LOAD_DEMO=${loadDemo} tb docker-compose run --no-deps --rm -e INSTALL_TB=true -e LOAD_DEMO=${loadDemo} tb

View File

@ -15,4 +15,6 @@
# limitations under the License. # limitations under the License.
# #
docker-compose up -d ./check-dirs.sh
docker-compose up -d --scale tb-js-executor=20

View File

@ -15,4 +15,4 @@
# limitations under the License. # limitations under the License.
# #
docker-compose down docker-compose stop

View File

@ -0,0 +1,18 @@
#!/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.
#
docker-compose up -d --no-deps --build $@

View File

@ -15,6 +15,8 @@
# limitations under the License. # limitations under the License.
# #
./check-dirs.sh
for i in "$@" for i in "$@"
do do
case $i in case $i in
@ -36,4 +38,4 @@ else
fromVersion="${FROM_VERSION// }" fromVersion="${FROM_VERSION// }"
fi fi
docker-compose run --rm -e UPGRADE_TB=true -e FROM_VERSION=${fromVersion} tb docker-compose run --no-deps --rm -e UPGRADE_TB=true -e FROM_VERSION=${fromVersion} tb

View File

@ -1,4 +0,0 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@ -57,5 +57,4 @@ backend tb-web-backend
option log-health-checks option log-health-checks
server tbWeb1 tb-web-ui1:8080 check server tbWeb1 tb-web-ui1:8080 check
server tbWeb2 tb-web-ui2:8080 check server tbWeb2 tb-web-ui2:8080 check
server tbWeb3 tb-web-ui3:8080 check
http-request set-header X-Forwarded-Port %[dst_port] http-request set-header X-Forwarded-Port %[dst_port]

View File

@ -1,4 +0,0 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@ -1,7 +1,7 @@
REMOTE_JS_EVAL_REQUEST_TOPIC=js.eval.requests REMOTE_JS_EVAL_REQUEST_TOPIC=js.eval.requests
TB_KAFKA_SERVERS=localhost:9092 TB_KAFKA_SERVERS=localhost:9092
LOGGER_LEVEL=debug LOGGER_LEVEL=info
LOG_FOLDER=logs LOG_FOLDER=logs
LOGGER_FILENAME=tb-js-executor-%DATE%.log LOGGER_FILENAME=tb-js-executor-%DATE%.log
DOCKER_MODE=true DOCKER_MODE=true

View File

@ -1,4 +0,0 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@ -1,4 +0,0 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@ -3,7 +3,7 @@ HTTP_BIND_ADDRESS=0.0.0.0
HTTP_BIND_PORT=8080 HTTP_BIND_PORT=8080
TB_HOST=localhost TB_HOST=localhost
TB_PORT=8080 TB_PORT=8080
LOGGER_LEVEL=debug LOGGER_LEVEL=info
LOG_FOLDER=logs LOG_FOLDER=logs
LOGGER_FILENAME=tb-web-ui-%DATE%.log LOGGER_FILENAME=tb-web-ui-%DATE%.log
DOCKER_MODE=true DOCKER_MODE=true

View File

@ -71,7 +71,7 @@ var server;
const staticDir = path.join(root, 'static'); const staticDir = path.join(root, 'static');
app.all('/api/*', (req, res) => { app.all('/api/*', (req, res) => {
logger.info(req.method + ' ' + req.originalUrl); logger.debug(req.method + ' ' + req.originalUrl);
apiProxy.web(req, res); apiProxy.web(req, res);
}); });