diff --git a/msa/docker/.env b/msa/docker/.env index b3c8ff66bb..3b0b91d353 100644 --- a/msa/docker/.env +++ b/msa/docker/.env @@ -3,5 +3,3 @@ DOCKER_REPO=local-maven-build TB_VERSION=2.2.0-SNAPSHOT KAFKA_TOPICS=js.eval.requests:100:1 -HTTP_PORT=80 -HTTPS_PORT=80 \ No newline at end of file diff --git a/msa/docker/.gitignore b/msa/docker/.gitignore index 473a5a6ead..c9843dc5a5 100644 --- a/msa/docker/.gitignore +++ b/msa/docker/.gitignore @@ -1,4 +1,5 @@ haproxy/certs.d/** haproxy/letsencrypt/** tb-node/log/** +tb-node/db/** !.env diff --git a/msa/docker/check-dirs.sh b/msa/docker/check-dirs.sh new file mode 100755 index 0000000000..9c683e6a51 --- /dev/null +++ b/msa/docker/check-dirs.sh @@ -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 diff --git a/msa/docker/docker-compose.yml b/msa/docker/docker-compose.yml index 876646f16d..9ddbea3a04 100644 --- a/msa/docker/docker-compose.yml +++ b/msa/docker/docker-compose.yml @@ -61,7 +61,7 @@ services: TB_KAFKA_SERVERS: kafka:9092 JS_EVALUATOR: remote volumes: - - ./tb-node/db:/usr/share/thingsboard/data/db" + - ./tb-node/db:/usr/share/thingsboard/data/db - ./tb-node/conf:/config - ./tb-node/log:/var/log/thingsboard depends_on: @@ -86,16 +86,6 @@ services: TB_PORT: 8080 env_file: - 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: restart: always container_name: haproxy-certbot @@ -111,9 +101,8 @@ services: cap_add: - NET_ADMIN environment: - HTTP_PORT: ${HTTP_PORT} - HTTPS_PORT: ${HTTPS_PORT} + HTTP_PORT: 80 + HTTPS_PORT: 443 links: - tb-web-ui1 - tb-web-ui2 - - tb-web-ui3 diff --git a/msa/docker/docker-install-tb.sh b/msa/docker/docker-install-tb.sh index d17ba305d1..5f34cc345f 100755 --- a/msa/docker/docker-install-tb.sh +++ b/msa/docker/docker-install-tb.sh @@ -15,6 +15,8 @@ # limitations under the License. # +./check-dirs.sh + while [[ $# -gt 0 ]] do key="$1" @@ -37,6 +39,6 @@ else loadDemo=false 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 diff --git a/msa/docker/docker-start-services.sh b/msa/docker/docker-start-services.sh index 3b07efb4a2..560c4351c0 100755 --- a/msa/docker/docker-start-services.sh +++ b/msa/docker/docker-start-services.sh @@ -15,4 +15,6 @@ # limitations under the License. # -docker-compose up -d +./check-dirs.sh + +docker-compose up -d --scale tb-js-executor=20 diff --git a/msa/docker/docker-stop-services.sh b/msa/docker/docker-stop-services.sh index a388bf1391..673a0b2dfc 100755 --- a/msa/docker/docker-stop-services.sh +++ b/msa/docker/docker-stop-services.sh @@ -15,4 +15,4 @@ # limitations under the License. # -docker-compose down +docker-compose stop diff --git a/msa/docker/docker-update-service.sh b/msa/docker/docker-update-service.sh new file mode 100755 index 0000000000..795146aa27 --- /dev/null +++ b/msa/docker/docker-update-service.sh @@ -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 $@ diff --git a/msa/docker/docker-upgrade-tb.sh b/msa/docker/docker-upgrade-tb.sh index 69cb4faa9e..51202a6b0b 100755 --- a/msa/docker/docker-upgrade-tb.sh +++ b/msa/docker/docker-upgrade-tb.sh @@ -15,6 +15,8 @@ # limitations under the License. # +./check-dirs.sh + for i in "$@" do case $i in @@ -36,4 +38,4 @@ else fromVersion="${FROM_VERSION// }" 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 diff --git a/msa/docker/haproxy/certs.d/.gitignore b/msa/docker/haproxy/certs.d/.gitignore deleted file mode 100644 index 86d0cb2726..0000000000 --- a/msa/docker/haproxy/certs.d/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# Ignore everything in this directory -* -# Except this file -!.gitignore \ No newline at end of file diff --git a/msa/docker/haproxy/config/haproxy.cfg b/msa/docker/haproxy/config/haproxy.cfg index 67e3f563a7..2499686b87 100644 --- a/msa/docker/haproxy/config/haproxy.cfg +++ b/msa/docker/haproxy/config/haproxy.cfg @@ -57,5 +57,4 @@ backend tb-web-backend option log-health-checks server tbWeb1 tb-web-ui1: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] diff --git a/msa/docker/haproxy/letsencrypt/.gitignore b/msa/docker/haproxy/letsencrypt/.gitignore deleted file mode 100644 index 86d0cb2726..0000000000 --- a/msa/docker/haproxy/letsencrypt/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# Ignore everything in this directory -* -# Except this file -!.gitignore \ No newline at end of file diff --git a/msa/docker/tb-js-executor.env b/msa/docker/tb-js-executor.env index f562c3aa28..cf455243ee 100644 --- a/msa/docker/tb-js-executor.env +++ b/msa/docker/tb-js-executor.env @@ -1,7 +1,7 @@ REMOTE_JS_EVAL_REQUEST_TOPIC=js.eval.requests TB_KAFKA_SERVERS=localhost:9092 -LOGGER_LEVEL=debug +LOGGER_LEVEL=info LOG_FOLDER=logs LOGGER_FILENAME=tb-js-executor-%DATE%.log DOCKER_MODE=true \ No newline at end of file diff --git a/msa/docker/tb-node/db/.gitignore b/msa/docker/tb-node/db/.gitignore deleted file mode 100644 index 86d0cb2726..0000000000 --- a/msa/docker/tb-node/db/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# Ignore everything in this directory -* -# Except this file -!.gitignore \ No newline at end of file diff --git a/msa/docker/tb-node/log/.gitignore b/msa/docker/tb-node/log/.gitignore deleted file mode 100644 index 86d0cb2726..0000000000 --- a/msa/docker/tb-node/log/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# Ignore everything in this directory -* -# Except this file -!.gitignore \ No newline at end of file diff --git a/msa/docker/tb-web-ui.env b/msa/docker/tb-web-ui.env index e78c80c86e..5c52681798 100644 --- a/msa/docker/tb-web-ui.env +++ b/msa/docker/tb-web-ui.env @@ -3,7 +3,7 @@ HTTP_BIND_ADDRESS=0.0.0.0 HTTP_BIND_PORT=8080 TB_HOST=localhost TB_PORT=8080 -LOGGER_LEVEL=debug +LOGGER_LEVEL=info LOG_FOLDER=logs LOGGER_FILENAME=tb-web-ui-%DATE%.log DOCKER_MODE=true \ No newline at end of file diff --git a/msa/web-ui/server.js b/msa/web-ui/server.js index 46d9bfd7a9..44e175a84c 100644 --- a/msa/web-ui/server.js +++ b/msa/web-ui/server.js @@ -71,7 +71,7 @@ var server; const staticDir = path.join(root, 'static'); app.all('/api/*', (req, res) => { - logger.info(req.method + ' ' + req.originalUrl); + logger.debug(req.method + ' ' + req.originalUrl); apiProxy.web(req, res); });