Browse Source

MSA docker improvements.

pull/1150/head
Igor Kulikov 8 years ago
parent
commit
ee3d75bb4f
  1. 2
      msa/docker/.env
  2. 1
      msa/docker/.gitignore
  3. 26
      msa/docker/check-dirs.sh
  4. 17
      msa/docker/docker-compose.yml
  5. 4
      msa/docker/docker-install-tb.sh
  6. 4
      msa/docker/docker-start-services.sh
  7. 2
      msa/docker/docker-stop-services.sh
  8. 18
      msa/docker/docker-update-service.sh
  9. 4
      msa/docker/docker-upgrade-tb.sh
  10. 4
      msa/docker/haproxy/certs.d/.gitignore
  11. 1
      msa/docker/haproxy/config/haproxy.cfg
  12. 4
      msa/docker/haproxy/letsencrypt/.gitignore
  13. 2
      msa/docker/tb-js-executor.env
  14. 4
      msa/docker/tb-node/db/.gitignore
  15. 4
      msa/docker/tb-node/log/.gitignore
  16. 2
      msa/docker/tb-web-ui.env
  17. 2
      msa/web-ui/server.js

2
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

1
msa/docker/.gitignore

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

26
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

17
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

4
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

4
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

2
msa/docker/docker-stop-services.sh

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

18
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 $@

4
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

4
msa/docker/haproxy/certs.d/.gitignore

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

1
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]

4
msa/docker/haproxy/letsencrypt/.gitignore

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

2
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

4
msa/docker/tb-node/db/.gitignore

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

4
msa/docker/tb-node/log/.gitignore

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

2
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

2
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);
});

Loading…
Cancel
Save