fixes2
This commit is contained in:
parent
737cb42116
commit
24044b65c6
21
main.py
21
main.py
@ -4,7 +4,8 @@ from pathlib import Path
|
||||
from hcloud import Client
|
||||
from hcloud.images.domain import Image
|
||||
from hcloud.load_balancer_types.domain import LoadBalancerType
|
||||
from hcloud.load_balancers.domain import LoadBalancerTarget, LoadBalancerService, LoadBalancerHealthCheck
|
||||
from hcloud.load_balancers.domain import LoadBalancerTarget, LoadBalancerService, LoadBalancerHealthCheck, \
|
||||
LoadBalancerHealtCheckHttp
|
||||
from hcloud.locations.domain import Location
|
||||
from hcloud.networks.domain import NetworkSubnet
|
||||
from hcloud.server_types.domain import ServerType
|
||||
@ -64,7 +65,19 @@ lb = client.load_balancers.create(
|
||||
protocol="http",
|
||||
listen_port=8080,
|
||||
destination_port=8080,
|
||||
proxyprotocol=False
|
||||
proxyprotocol=False,
|
||||
health_check=LoadBalancerHealthCheck(
|
||||
protocol="http",
|
||||
port="8080",
|
||||
interval=15,
|
||||
timeout=10,
|
||||
retries=3,
|
||||
http=LoadBalancerHealtCheckHttp(
|
||||
path="/factors/10",
|
||||
status_codes=["2??", "3??"],
|
||||
tls=False
|
||||
)
|
||||
),
|
||||
)
|
||||
],
|
||||
targets=lb_targets,
|
||||
@ -75,5 +88,5 @@ lb = client.load_balancers.create(
|
||||
lb.action.wait_until_finished()
|
||||
print(f"Mechanizm równoważenia obciążenia został utworzony: {lb.action.complete}")
|
||||
|
||||
|
||||
print(f"Webserwis pod adresem http://{lb.load_balancer.data_model.public_net.ipv4.ip}:8080/factors/")
|
||||
load_balancer = client.load_balancers.get_by_name(load_balancer_name)
|
||||
print(f"Webserwis pod adresem http://{load_balancer.data_model.public_net.ipv4.ip}:8080/factors/")
|
||||
|
Loading…
Reference in New Issue
Block a user