From 713033216dd5e3167892faaa0290a35e39fc013f Mon Sep 17 00:00:00 2001 From: Christopher Lo <46541035+topher-lo@users.noreply.github.com> Date: Mon, 18 Mar 2024 05:24:00 +0000 Subject: [PATCH] ci: Set default target to api container --- aws/stack.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/aws/stack.py b/aws/stack.py index f0000d77b..f1a93f56b 100644 --- a/aws/stack.py +++ b/aws/stack.py @@ -162,13 +162,25 @@ def __init__(self, scope: Construct, id: str, **kwargs) -> None: # Add routing based on hostname or path with the single listern listener = ecs_service.load_balancer.listeners[0] - listener.default_action = elbv2.ListenerAction.fixed_response(status_code=404) # API target + listener.add_targets( + "DefaultTarget", + priority=1, + protocol=elbv2.ApplicationProtocol.HTTP, + conditions=[ + elbv2.ListenerCondition.path_patterns(["/", "/*"]), + ], + targets=[ + ecs_service.service.load_balancer_target( + container_name="TracecatApiContainer", container_port=8000 + ) + ], + ) + listener.add_targets( "TracecatApiTarget", priority=10, - port=8000, protocol=elbv2.ApplicationProtocol.HTTP, health_check=elbv2.HealthCheck( path="/api", @@ -192,7 +204,6 @@ def __init__(self, scope: Construct, id: str, **kwargs) -> None: listener.add_targets( "TracecatRunnerTarget", priority=20, - port=8001, protocol=elbv2.ApplicationProtocol.HTTP, health_check=elbv2.HealthCheck( path="/runner",