Skip to content

Commit

Permalink
Expose haproxy services on all interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
wyattrees committed Aug 22, 2024
1 parent 1ce64e9 commit 34ec538
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions anvil-python/anvil/commands/haproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,7 @@ def extra_tfvars(self) -> dict[str, Any]:
with open(key_filepath) as key_file:
variables["ssl_key_content"] = key_file.read()
variables["haproxy_port"] = 443
variables["haproxy_services_yaml"] = self.get_tls_services_yaml(
variables["virtual_ip"]
)
variables["haproxy_services_yaml"] = self.get_tls_services_yaml()
else:
variables["haproxy_port"] = 80

Expand All @@ -218,15 +216,12 @@ def get_management_cidrs(self) -> list[str]:
)
return answers["bootstrap"]["management_cidr"].split(",")

def get_tls_services_yaml(self, vip: str) -> str:
def get_tls_services_yaml(self) -> str:
"""Get the HAProxy services.yaml for TLS, inserting the VIP for the frontend bind"""
cidrs = self.get_management_cidrs()
services: str = (
"""- service_name: haproxy_service
service_host: """
""
+ vip
+ """
service_host: 0.0.0.0
service_port: 443
service_options:
- balance leastconn
Expand All @@ -235,9 +230,7 @@ def get_tls_services_yaml(self, vip: str) -> str:
server_options: maxconn 100 cookie S{i} check
crts: [DEFAULT]
- service_name: agent-service
service_host: """
+ get_local_ip_by_default_route()
+ """
service_host: 0.0.0.0
service_port: 80
service_options:
- balance leastconn
Expand Down

0 comments on commit 34ec538

Please sign in to comment.