added example
This commit is contained in:
38
examples/loadbalancertest/config.yaml
Normal file
38
examples/loadbalancertest/config.yaml
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
healthcheck_addr: "10.0.1.10:9000"
|
||||||
|
|
||||||
|
iperf_addr: "10.0.1.10:5201"
|
||||||
|
|
||||||
|
backends:
|
||||||
|
- id: "srv-1"
|
||||||
|
ip: "10.0.1.11:8081"
|
||||||
|
- id: "srv-2"
|
||||||
|
ip: "10.0.1.12:8082"
|
||||||
|
- id: "srv-3"
|
||||||
|
ip: "10.0.1.13:8083"
|
||||||
|
- id: "srv-4"
|
||||||
|
ip: "10.0.1.14:8084"
|
||||||
|
|
||||||
|
clusters:
|
||||||
|
main-api:
|
||||||
|
- "srv-1"
|
||||||
|
- "srv-2"
|
||||||
|
priority-api:
|
||||||
|
- "srv-3"
|
||||||
|
- "srv-4"
|
||||||
|
|
||||||
|
rules:
|
||||||
|
- clients:
|
||||||
|
- "0.0.0.0/0:8080"
|
||||||
|
targets:
|
||||||
|
- "main-api"
|
||||||
|
strategy:
|
||||||
|
type: "RoundRobin"
|
||||||
|
|
||||||
|
- clients:
|
||||||
|
- "10.0.0.0/24:8080"
|
||||||
|
- "10.0.0.0/24:25565"
|
||||||
|
targets:
|
||||||
|
- "main-api"
|
||||||
|
- "priority-api"
|
||||||
|
strategy:
|
||||||
|
type: "RoundRobin"
|
||||||
110
examples/loadbalancertest/docker-compose.yml
Normal file
110
examples/loadbalancertest/docker-compose.yml
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
services:
|
||||||
|
load-balancer:
|
||||||
|
image: enginewhy
|
||||||
|
container_name: load-balancer
|
||||||
|
tty: true
|
||||||
|
cap_add:
|
||||||
|
- NET_ADMIN
|
||||||
|
- SYS_ADMIN
|
||||||
|
volumes:
|
||||||
|
- ./config.yaml:/enginewhy/config.yaml
|
||||||
|
networks:
|
||||||
|
net_1:
|
||||||
|
ipv4_address: 10.0.1.10
|
||||||
|
net_2:
|
||||||
|
ipv4_address: 10.0.0.10
|
||||||
|
net_3:
|
||||||
|
ipv4_address: 10.0.2.10
|
||||||
|
|
||||||
|
srv-1:
|
||||||
|
image: nicolaka/netshoot
|
||||||
|
container_name: srv-1
|
||||||
|
tty: true
|
||||||
|
command: ["python3", "-m", "http.server", "8081", "--directory", "/root/www"]
|
||||||
|
networks:
|
||||||
|
net_1:
|
||||||
|
ipv4_address: 10.0.1.11
|
||||||
|
ports:
|
||||||
|
- "8081:8081"
|
||||||
|
volumes:
|
||||||
|
- ./srv1:/root/www
|
||||||
|
cap_add: [ NET_ADMIN ]
|
||||||
|
|
||||||
|
srv-2:
|
||||||
|
image: nicolaka/netshoot
|
||||||
|
container_name: srv-2
|
||||||
|
tty: true
|
||||||
|
command: ["python3", "-m", "http.server", "8082", "--directory", "/root/www"]
|
||||||
|
networks:
|
||||||
|
net_1:
|
||||||
|
ipv4_address: 10.0.1.12
|
||||||
|
ports:
|
||||||
|
- "8082:8082"
|
||||||
|
volumes:
|
||||||
|
- ./srv2:/root/www
|
||||||
|
cap_add: [ NET_ADMIN ]
|
||||||
|
|
||||||
|
srv-3:
|
||||||
|
image: nicolaka/netshoot
|
||||||
|
container_name: srv-3
|
||||||
|
tty: true
|
||||||
|
command: ["python3", "-m", "http.server", "8083", "--directory", "/root/www"]
|
||||||
|
networks:
|
||||||
|
net_1:
|
||||||
|
ipv4_address: 10.0.1.13
|
||||||
|
ports:
|
||||||
|
- "8083:8083"
|
||||||
|
volumes:
|
||||||
|
- ./srv3:/root/www
|
||||||
|
cap_add: [ NET_ADMIN ]
|
||||||
|
|
||||||
|
srv-4:
|
||||||
|
image: nicolaka/netshoot
|
||||||
|
container_name: srv-4
|
||||||
|
tty: true
|
||||||
|
command: ["python3", "-m", "http.server", "8084", "--directory", "/root/www"]
|
||||||
|
networks:
|
||||||
|
net_1:
|
||||||
|
ipv4_address: 10.0.1.14
|
||||||
|
ports:
|
||||||
|
- "8084:8084"
|
||||||
|
volumes:
|
||||||
|
- ./srv4:/root/www
|
||||||
|
cap_add: [ NET_ADMIN ]
|
||||||
|
|
||||||
|
client-net2:
|
||||||
|
image: nicolaka/netshoot
|
||||||
|
container_name: client-net2
|
||||||
|
tty: true
|
||||||
|
networks:
|
||||||
|
net_2:
|
||||||
|
ipv4_address: 10.0.0.11
|
||||||
|
cap_add: [ NET_ADMIN ]
|
||||||
|
|
||||||
|
client-net3:
|
||||||
|
image: nicolaka/netshoot
|
||||||
|
container_name: client-net3
|
||||||
|
tty: true
|
||||||
|
networks:
|
||||||
|
net_3:
|
||||||
|
ipv4_address: 10.0.2.11
|
||||||
|
cap_add: [ NET_ADMIN ]
|
||||||
|
|
||||||
|
networks:
|
||||||
|
net_1:
|
||||||
|
driver: bridge
|
||||||
|
ipam:
|
||||||
|
config:
|
||||||
|
- subnet: 10.0.1.0/24
|
||||||
|
|
||||||
|
net_2:
|
||||||
|
driver: bridge
|
||||||
|
ipam:
|
||||||
|
config:
|
||||||
|
- subnet: 10.0.0.0/24
|
||||||
|
|
||||||
|
net_3:
|
||||||
|
driver: bridge
|
||||||
|
ipam:
|
||||||
|
config:
|
||||||
|
- subnet: 10.0.2.0/24
|
||||||
1
examples/loadbalancertest/srv1/index.html
Normal file
1
examples/loadbalancertest/srv1/index.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Hello from server 1!
|
||||||
1
examples/loadbalancertest/srv2/index.html
Normal file
1
examples/loadbalancertest/srv2/index.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Hello from server 2!
|
||||||
1
examples/loadbalancertest/srv3/index.html
Normal file
1
examples/loadbalancertest/srv3/index.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Hello from server 3!
|
||||||
1
examples/loadbalancertest/srv4/index.html
Normal file
1
examples/loadbalancertest/srv4/index.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Hello from server 4!
|
||||||
Reference in New Issue
Block a user