MSA Docker: tb-node REST API loadbalancing.

This commit is contained in:
Igor Kulikov 2018-10-26 12:49:20 +03:00
parent dc61052bd5
commit 9a5d7776fd
3 changed files with 18 additions and 8 deletions

View File

@ -134,9 +134,6 @@ services:
image: "${DOCKER_REPO}/${WEB_UI_DOCKER_NAME}:${TB_VERSION}"
ports:
- "8080"
environment:
TB_HOST: tb1
TB_PORT: 8080
env_file:
- tb-web-ui.env
tb-web-ui2:
@ -144,12 +141,9 @@ services:
image: "${DOCKER_REPO}/${WEB_UI_DOCKER_NAME}:${TB_VERSION}"
ports:
- "8080"
environment:
TB_HOST: tb2
TB_PORT: 8080
env_file:
- tb-web-ui.env
web:
haproxy:
restart: always
container_name: haproxy-certbot
image: nmarus/haproxy-certbot
@ -159,6 +153,7 @@ services:
- ./haproxy/certs.d:/usr/local/etc/haproxy/certs.d
ports:
- "80:80"
- "8080"
- "443:443"
- "1883:1883"
- "9999:9999"
@ -168,8 +163,11 @@ services:
HTTP_PORT: 80
HTTPS_PORT: 443
MQTT_PORT: 1883
TB_API_PORT: 8080
FORCE_HTTPS_REDIRECT: "false"
links:
- tb1
- tb2
- tb-web-ui1
- tb-web-ui2
- tb-mqtt-transport1

View File

@ -69,6 +69,11 @@ frontend https_in
default_backend tb-web-backend
frontend http-api-in
bind *:${TB_API_PORT}
default_backend tb-api-backend
backend letsencrypt_http
server letsencrypt_http_srv 127.0.0.1:8080
@ -86,3 +91,10 @@ backend tb-http-backend
option log-health-checks
server tbHttp1 tb-http-transport1:8081 check
server tbHttp2 tb-http-transport2:8081 check
backend tb-api-backend
balance leastconn
option tcp-check
option log-health-checks
server tbApi1 tb1:8080 check
server tbApi2 tb2:8080 check

View File

@ -1,7 +1,7 @@
HTTP_BIND_ADDRESS=0.0.0.0
HTTP_BIND_PORT=8080
TB_HOST=localhost
TB_HOST=haproxy
TB_PORT=8080
LOGGER_LEVEL=info
LOG_FOLDER=logs