Skip to content

Commit

Permalink
ci(test): Disable runner
Browse files Browse the repository at this point in the history
  • Loading branch information
topher-lo committed Mar 18, 2024
1 parent 7130332 commit 0eb35ea
Showing 1 changed file with 47 additions and 61 deletions.
108 changes: 47 additions & 61 deletions aws/stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ def __init__(self, scope: Construct, id: str, **kwargs) -> None:
tracecat_secret, field="openai-api-key"
),
}
runner_secrets = {
"OPENAI_API_KEY": ecs.Secret.from_secrets_manager(
tracecat_secret, field="openai-api-key"
)
}
# runner_secrets = {
# "OPENAI_API_KEY": ecs.Secret.from_secrets_manager(
# tracecat_secret, field="openai-api-key"
# )
# }

# Tracecat API
api_container = task_definition.add_container(
Expand All @@ -124,26 +124,26 @@ def __init__(self, scope: Construct, id: str, **kwargs) -> None:
)
api_container.add_port_mappings(ecs.PortMapping(container_port=8000))

# Tracecat Runner
runner_container = task_definition.add_container(
"TracecatRunnerContainer",
image=ecs.ContainerImage.from_asset(
directory=".",
file="Dockerfile",
build_args={"API_MODULE": "tracecat.runner.app:app"},
),
health_check=ecs.HealthCheck(
command=["CMD-SHELL", "curl -f http://localhost:8000"],
interval=Duration.seconds(120),
retries=5,
start_period=Duration.seconds(60),
timeout=Duration.seconds(10),
),
memory_limit_mib=512,
environment={"API_MODULE": "tracecat.runner.app:app"},
secrets=runner_secrets,
)
runner_container.add_port_mappings(ecs.PortMapping(container_port=8001))
# # Tracecat Runner
# runner_container = task_definition.add_container(
# "TracecatRunnerContainer",
# image=ecs.ContainerImage.from_asset(
# directory=".",
# file="Dockerfile",
# build_args={"API_MODULE": "tracecat.runner.app:app"},
# ),
# health_check=ecs.HealthCheck(
# command=["CMD-SHELL", "curl -f http://localhost:8000"],
# interval=Duration.seconds(120),
# retries=5,
# start_period=Duration.seconds(60),
# timeout=Duration.seconds(10),
# ),
# memory_limit_mib=512,
# environment={"API_MODULE": "tracecat.runner.app:app"},
# secrets=runner_secrets,
# )
# runner_container.add_port_mappings(ecs.PortMapping(container_port=8001))

# Create Fargate service
ecs_service = ecs_patterns.ApplicationLoadBalancedFargateService(
Expand All @@ -164,20 +164,6 @@ def __init__(self, scope: Construct, id: str, **kwargs) -> None:
listener = ecs_service.load_balancer.listeners[0]

# 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,
Expand All @@ -200,28 +186,28 @@ def __init__(self, scope: Construct, id: str, **kwargs) -> None:
],
)

# Runner target
listener.add_targets(
"TracecatRunnerTarget",
priority=20,
protocol=elbv2.ApplicationProtocol.HTTP,
health_check=elbv2.HealthCheck(
path="/runner",
enabled=True,
interval=Duration.seconds(120),
unhealthy_threshold_count=3,
healthy_threshold_count=5,
timeout=Duration.seconds(10),
),
conditions=[
elbv2.ListenerCondition.path_patterns(["/runner", "/runner/*"]),
],
targets=[
ecs_service.service.load_balancer_target(
container_name="TracecatRunnerContainer", container_port=8001
)
],
)
# # Runner target
# listener.add_targets(
# "TracecatRunnerTarget",
# priority=20,
# protocol=elbv2.ApplicationProtocol.HTTP,
# health_check=elbv2.HealthCheck(
# path="/runner",
# enabled=True,
# interval=Duration.seconds(120),
# unhealthy_threshold_count=3,
# healthy_threshold_count=5,
# timeout=Duration.seconds(10),
# ),
# conditions=[
# elbv2.ListenerCondition.path_patterns(["/runner", "/runner/*"]),
# ],
# targets=[
# ecs_service.service.load_balancer_target(
# container_name="TracecatRunnerContainer", container_port=8001
# )
# ],
# )

# # Add WAF to block all traffic not from platform.tracecat.com
# # NOTE: Please change this to the domain you deployed Tracecat frontend to
Expand Down

0 comments on commit 0eb35ea

Please sign in to comment.