Skip to content

Commit

Permalink
ci: Set default target to api container
Browse files Browse the repository at this point in the history
  • Loading branch information
topher-lo committed Mar 18, 2024
1 parent 639c8a2 commit 7130332
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions aws/stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit 7130332

Please sign in to comment.