MSA Docker: tb-node REST API loadbalancing.
This commit is contained in:
		
							parent
							
								
									dc61052bd5
								
							
						
					
					
						commit
						9a5d7776fd
					
				@ -134,9 +134,6 @@ services:
 | 
				
			|||||||
    image: "${DOCKER_REPO}/${WEB_UI_DOCKER_NAME}:${TB_VERSION}"
 | 
					    image: "${DOCKER_REPO}/${WEB_UI_DOCKER_NAME}:${TB_VERSION}"
 | 
				
			||||||
    ports:
 | 
					    ports:
 | 
				
			||||||
      - "8080"
 | 
					      - "8080"
 | 
				
			||||||
    environment:
 | 
					 | 
				
			||||||
      TB_HOST: tb1
 | 
					 | 
				
			||||||
      TB_PORT: 8080
 | 
					 | 
				
			||||||
    env_file:
 | 
					    env_file:
 | 
				
			||||||
      - tb-web-ui.env
 | 
					      - tb-web-ui.env
 | 
				
			||||||
  tb-web-ui2:
 | 
					  tb-web-ui2:
 | 
				
			||||||
@ -144,12 +141,9 @@ services:
 | 
				
			|||||||
    image: "${DOCKER_REPO}/${WEB_UI_DOCKER_NAME}:${TB_VERSION}"
 | 
					    image: "${DOCKER_REPO}/${WEB_UI_DOCKER_NAME}:${TB_VERSION}"
 | 
				
			||||||
    ports:
 | 
					    ports:
 | 
				
			||||||
      - "8080"
 | 
					      - "8080"
 | 
				
			||||||
    environment:
 | 
					 | 
				
			||||||
      TB_HOST: tb2
 | 
					 | 
				
			||||||
      TB_PORT: 8080
 | 
					 | 
				
			||||||
    env_file:
 | 
					    env_file:
 | 
				
			||||||
      - tb-web-ui.env
 | 
					      - tb-web-ui.env
 | 
				
			||||||
  web:
 | 
					  haproxy:
 | 
				
			||||||
    restart: always
 | 
					    restart: always
 | 
				
			||||||
    container_name: haproxy-certbot
 | 
					    container_name: haproxy-certbot
 | 
				
			||||||
    image: nmarus/haproxy-certbot
 | 
					    image: nmarus/haproxy-certbot
 | 
				
			||||||
@ -159,6 +153,7 @@ services:
 | 
				
			|||||||
     - ./haproxy/certs.d:/usr/local/etc/haproxy/certs.d
 | 
					     - ./haproxy/certs.d:/usr/local/etc/haproxy/certs.d
 | 
				
			||||||
    ports:
 | 
					    ports:
 | 
				
			||||||
     - "80:80"
 | 
					     - "80:80"
 | 
				
			||||||
 | 
					     - "8080"
 | 
				
			||||||
     - "443:443"
 | 
					     - "443:443"
 | 
				
			||||||
     - "1883:1883"
 | 
					     - "1883:1883"
 | 
				
			||||||
     - "9999:9999"
 | 
					     - "9999:9999"
 | 
				
			||||||
@ -168,8 +163,11 @@ services:
 | 
				
			|||||||
      HTTP_PORT: 80
 | 
					      HTTP_PORT: 80
 | 
				
			||||||
      HTTPS_PORT: 443
 | 
					      HTTPS_PORT: 443
 | 
				
			||||||
      MQTT_PORT: 1883
 | 
					      MQTT_PORT: 1883
 | 
				
			||||||
 | 
					      TB_API_PORT: 8080
 | 
				
			||||||
      FORCE_HTTPS_REDIRECT: "false"
 | 
					      FORCE_HTTPS_REDIRECT: "false"
 | 
				
			||||||
    links:
 | 
					    links:
 | 
				
			||||||
 | 
					        - tb1
 | 
				
			||||||
 | 
					        - tb2
 | 
				
			||||||
        - tb-web-ui1
 | 
					        - tb-web-ui1
 | 
				
			||||||
        - tb-web-ui2
 | 
					        - tb-web-ui2
 | 
				
			||||||
        - tb-mqtt-transport1
 | 
					        - tb-mqtt-transport1
 | 
				
			||||||
 | 
				
			|||||||
@ -69,6 +69,11 @@ frontend https_in
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  default_backend tb-web-backend
 | 
					  default_backend tb-web-backend
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					frontend http-api-in
 | 
				
			||||||
 | 
					 bind *:${TB_API_PORT}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 default_backend tb-api-backend
 | 
				
			||||||
 | 
					
 | 
				
			||||||
backend letsencrypt_http
 | 
					backend letsencrypt_http
 | 
				
			||||||
  server letsencrypt_http_srv 127.0.0.1:8080
 | 
					  server letsencrypt_http_srv 127.0.0.1:8080
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -86,3 +91,10 @@ backend tb-http-backend
 | 
				
			|||||||
  option log-health-checks
 | 
					  option log-health-checks
 | 
				
			||||||
  server tbHttp1 tb-http-transport1:8081 check
 | 
					  server tbHttp1 tb-http-transport1:8081 check
 | 
				
			||||||
  server tbHttp2 tb-http-transport2: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
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
HTTP_BIND_ADDRESS=0.0.0.0
 | 
					HTTP_BIND_ADDRESS=0.0.0.0
 | 
				
			||||||
HTTP_BIND_PORT=8080
 | 
					HTTP_BIND_PORT=8080
 | 
				
			||||||
TB_HOST=localhost
 | 
					TB_HOST=haproxy
 | 
				
			||||||
TB_PORT=8080
 | 
					TB_PORT=8080
 | 
				
			||||||
LOGGER_LEVEL=info
 | 
					LOGGER_LEVEL=info
 | 
				
			||||||
LOG_FOLDER=logs
 | 
					LOG_FOLDER=logs
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user