Commit a1d7715b211ce58520d6cbc4b7d902c4517cc282

Authored by Igor Kulikov
1 parent b2aed2f3

Update Docker loadbalancer config. Use signle instance COAP transport.

... ... @@ -117,22 +117,11 @@ services:
117 117 - tb-http-transport.env
118 118 depends_on:
119 119 - kafka
120   - tb-coap-transport1:
  120 + tb-coap-transport:
121 121 restart: always
122 122 image: "${DOCKER_REPO}/${COAP_TRANSPORT_DOCKER_NAME}:${TB_VERSION}"
123 123 ports:
124   - - "5683"
125   - environment:
126   - TB_KAFKA_SERVERS: kafka:9092
127   - env_file:
128   - - tb-coap-transport.env
129   - depends_on:
130   - - kafka
131   - tb-coap-transport2:
132   - restart: always
133   - image: "${DOCKER_REPO}/${COAP_TRANSPORT_DOCKER_NAME}:${TB_VERSION}"
134   - ports:
135   - - "5683"
  124 + - "5683:5683/udp"
136 125 environment:
137 126 TB_KAFKA_SERVERS: kafka:9092
138 127 env_file:
... ... @@ -159,16 +148,6 @@ services:
159 148 TB_PORT: 8080
160 149 env_file:
161 150 - tb-web-ui.env
162   - coap-lb:
163   - restart: always
164   - container_name: coap-loadbalancer
165   - image: instantlinux/udp-nginx-proxy
166   - ports:
167   - - "5683:5683/udp"
168   - environment:
169   - BACKENDS: tb-coap-transport1 tb-coap-transport2
170   - PORT_BACKEND: 5683
171   - PORT_LISTEN: 5683
172 151 web:
173 152 restart: always
174 153 container_name: haproxy-certbot
... ...
1 1 #HA Proxy Config
2 2 global
3   - maxconn 4096
  3 + ulimit-n 500000
  4 + maxconn 99999
  5 + maxpipes 99999
  6 + tune.maxaccept 500
4 7
5 8 log 127.0.0.1 local0
6 9 log 127.0.0.1 local1 notice
... ... @@ -13,8 +16,6 @@ global
13 16
14 17 defaults
15 18
16   - option forwardfor
17   -
18 19 log global
19 20
20 21 mode http
... ... @@ -30,9 +31,22 @@ listen stats
30 31 stats uri /stats
31 32 stats auth admin:admin@123
32 33
  34 +listen mqtt-in
  35 + bind *:${MQTT_PORT}
  36 + mode tcp
  37 + option clitcpka # For TCP keep-alive
  38 + timeout client 3h
  39 + timeout server 3h
  40 + option tcplog
  41 + balance leastconn
  42 + server tbMqtt1 tb-mqtt-transport1:1883 check
  43 + server tbMqtt2 tb-mqtt-transport2:1883 check
  44 +
33 45 frontend http-in
34 46 bind *:${HTTP_PORT}
35 47
  48 + option forwardfor
  49 +
36 50 reqadd X-Forwarded-Proto:\ http
37 51
38 52 acl transport_http_acl path_beg /api/v1/
... ... @@ -46,15 +60,14 @@ frontend http-in
46 60 frontend https_in
47 61 bind *:${HTTPS_PORT} ssl crt /usr/local/etc/haproxy/default.pem crt /usr/local/etc/haproxy/certs.d ciphers ECDHE-RSA-AES256-SHA:RC4-SHA:RC4:HIGH:!MD5:!aNULL:!EDH:!AESGCM
48 62
49   - reqadd X-Forwarded-Proto:\ https
  63 + option forwardfor
50 64
51   - default_backend tb-web-backend
  65 + reqadd X-Forwarded-Proto:\ https
52 66
53   -frontend mqtt-in
54   - mode tcp
55   - bind *:${MQTT_PORT}
  67 + acl transport_http_acl path_beg /api/v1/
  68 + use_backend tb-http-backend if transport_http_acl
56 69
57   - default_backend tb-mqtt-backend
  70 + default_backend tb-web-backend
58 71
59 72 backend letsencrypt_http
60 73 server letsencrypt_http_srv 127.0.0.1:8080
... ... @@ -67,13 +80,6 @@ backend tb-web-backend
67 80 server tbWeb2 tb-web-ui2:8080 check
68 81 http-request set-header X-Forwarded-Port %[dst_port]
69 82
70   -backend tb-mqtt-backend
71   - balance leastconn
72   - option tcp-check
73   - option log-health-checks
74   - server tbMqtt1 tb-mqtt-transport1:1883 check
75   - server tbMqtt2 tb-mqtt-transport2:1883 check
76   -
77 83 backend tb-http-backend
78 84 balance leastconn
79 85 option tcp-check
... ...