Commit 9a5d7776fd5fff14577eb572ce2654999480bfb2
1 parent
dc61052b
MSA Docker: tb-node REST API loadbalancing.
Showing
3 changed files
with
18 additions
and
8 deletions
@@ -134,9 +134,6 @@ services: | @@ -134,9 +134,6 @@ services: | ||
134 | image: "${DOCKER_REPO}/${WEB_UI_DOCKER_NAME}:${TB_VERSION}" | 134 | image: "${DOCKER_REPO}/${WEB_UI_DOCKER_NAME}:${TB_VERSION}" |
135 | ports: | 135 | ports: |
136 | - "8080" | 136 | - "8080" |
137 | - environment: | ||
138 | - TB_HOST: tb1 | ||
139 | - TB_PORT: 8080 | ||
140 | env_file: | 137 | env_file: |
141 | - tb-web-ui.env | 138 | - tb-web-ui.env |
142 | tb-web-ui2: | 139 | tb-web-ui2: |
@@ -144,12 +141,9 @@ services: | @@ -144,12 +141,9 @@ services: | ||
144 | image: "${DOCKER_REPO}/${WEB_UI_DOCKER_NAME}:${TB_VERSION}" | 141 | image: "${DOCKER_REPO}/${WEB_UI_DOCKER_NAME}:${TB_VERSION}" |
145 | ports: | 142 | ports: |
146 | - "8080" | 143 | - "8080" |
147 | - environment: | ||
148 | - TB_HOST: tb2 | ||
149 | - TB_PORT: 8080 | ||
150 | env_file: | 144 | env_file: |
151 | - tb-web-ui.env | 145 | - tb-web-ui.env |
152 | - web: | 146 | + haproxy: |
153 | restart: always | 147 | restart: always |
154 | container_name: haproxy-certbot | 148 | container_name: haproxy-certbot |
155 | image: nmarus/haproxy-certbot | 149 | image: nmarus/haproxy-certbot |
@@ -159,6 +153,7 @@ services: | @@ -159,6 +153,7 @@ services: | ||
159 | - ./haproxy/certs.d:/usr/local/etc/haproxy/certs.d | 153 | - ./haproxy/certs.d:/usr/local/etc/haproxy/certs.d |
160 | ports: | 154 | ports: |
161 | - "80:80" | 155 | - "80:80" |
156 | + - "8080" | ||
162 | - "443:443" | 157 | - "443:443" |
163 | - "1883:1883" | 158 | - "1883:1883" |
164 | - "9999:9999" | 159 | - "9999:9999" |
@@ -168,8 +163,11 @@ services: | @@ -168,8 +163,11 @@ services: | ||
168 | HTTP_PORT: 80 | 163 | HTTP_PORT: 80 |
169 | HTTPS_PORT: 443 | 164 | HTTPS_PORT: 443 |
170 | MQTT_PORT: 1883 | 165 | MQTT_PORT: 1883 |
166 | + TB_API_PORT: 8080 | ||
171 | FORCE_HTTPS_REDIRECT: "false" | 167 | FORCE_HTTPS_REDIRECT: "false" |
172 | links: | 168 | links: |
169 | + - tb1 | ||
170 | + - tb2 | ||
173 | - tb-web-ui1 | 171 | - tb-web-ui1 |
174 | - tb-web-ui2 | 172 | - tb-web-ui2 |
175 | - tb-mqtt-transport1 | 173 | - tb-mqtt-transport1 |
@@ -69,6 +69,11 @@ frontend https_in | @@ -69,6 +69,11 @@ frontend https_in | ||
69 | 69 | ||
70 | default_backend tb-web-backend | 70 | default_backend tb-web-backend |
71 | 71 | ||
72 | +frontend http-api-in | ||
73 | + bind *:${TB_API_PORT} | ||
74 | + | ||
75 | + default_backend tb-api-backend | ||
76 | + | ||
72 | backend letsencrypt_http | 77 | backend letsencrypt_http |
73 | server letsencrypt_http_srv 127.0.0.1:8080 | 78 | server letsencrypt_http_srv 127.0.0.1:8080 |
74 | 79 | ||
@@ -86,3 +91,10 @@ backend tb-http-backend | @@ -86,3 +91,10 @@ backend tb-http-backend | ||
86 | option log-health-checks | 91 | option log-health-checks |
87 | server tbHttp1 tb-http-transport1:8081 check | 92 | server tbHttp1 tb-http-transport1:8081 check |
88 | server tbHttp2 tb-http-transport2:8081 check | 93 | server tbHttp2 tb-http-transport2:8081 check |
94 | + | ||
95 | +backend tb-api-backend | ||
96 | + balance leastconn | ||
97 | + option tcp-check | ||
98 | + option log-health-checks | ||
99 | + server tbApi1 tb1:8080 check | ||
100 | + server tbApi2 tb2:8080 check |