Skip to content

Commit

Permalink
ci: Add warning that ApplicationMultipleTargetGroupsFargateService
Browse files Browse the repository at this point in the history
…is broken

See aws/aws-cdk#24013
  • Loading branch information
topher-lo committed Mar 18, 2024
1 parent 355c6fb commit c174cf8
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions aws/stack.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
"""WARNING: the following code has an unresolved issue with multi-container deployments.
See https://github.com/aws/aws-cdk/issues/24013.
You must manually:
- Delete the silently added port mapping in the API container task definition
- Change the container name under fargate service load balancer to "RunnerContainer".
"""

import os

from aws_cdk import Duration, Stack
Expand Down Expand Up @@ -71,11 +79,6 @@ def __init__(self, scope: Construct, id: str, **kwargs) -> None:
roles=[execution_role],
)

# Create task definition
task_definition = ecs.FargateTaskDefinition(
self, "TaskDefinition", execution_role=execution_role
)

# Secrets
tracecat_secret = secretsmanager.Secret.from_secret_complete_arn(
self, "Secret", secret_complete_arn=AWS_SECRET__ARN
Expand All @@ -100,6 +103,11 @@ def __init__(self, scope: Construct, id: str, **kwargs) -> None:
)
}

# Create task definition
task_definition = ecs.FargateTaskDefinition(
self, "TaskDefinition", execution_role=execution_role
)

# Tracecat API
task_definition.add_container(
"ApiContainer",
Expand Down Expand Up @@ -153,13 +161,13 @@ def __init__(self, scope: Construct, id: str, **kwargs) -> None:
task_definition=task_definition,
load_balancers=[
ecs_patterns.ApplicationLoadBalancerProps(
name="alb",
name="Alb",
domain_name=AWS_ROUTE53__HOSTED_ZONE_NAME,
domain_zone=hosted_zone,
public_load_balancer=True,
listeners=[
ecs_patterns.ApplicationListenerProps(
name="listener", certificate=cert
name="Listener", port=443, certificate=cert
)
],
)
Expand All @@ -169,13 +177,13 @@ def __init__(self, scope: Construct, id: str, **kwargs) -> None:
container_port=8000,
priority=10,
path_pattern="/api/*",
listener="listener",
listener="Listener",
),
ecs_patterns.ApplicationTargetProps(
container_port=8001,
priority=20,
path_pattern="/runner/*",
listener="listener",
listener="Listener",
),
],
)
Expand Down

0 comments on commit c174cf8

Please sign in to comment.