Skip to content

Commit

Permalink
Change ApplicationLoadBalancedFargateService to a regular FargateService
Browse files Browse the repository at this point in the history
  • Loading branch information
jonodrew committed Jun 2, 2023
1 parent 1faa950 commit 92c9444
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions mentor_match_infra/mentor_match_infra/mentor_match_stack.py
@@ -1,6 +1,6 @@
import aws_cdk as cdk
from aws_cdk import aws_ec2 as ec2, aws_ecs as ecs
from aws_cdk.aws_ecs import ContainerImage
from aws_cdk.aws_ecs import ContainerImage, TaskDefinition
from aws_cdk.aws_ecs_patterns import (
ApplicationLoadBalancedFargateService,
ApplicationLoadBalancedTaskImageOptions,
Expand Down Expand Up @@ -121,6 +121,7 @@ def __init__(
),
container_port=80,
environment={"FLASK_DEBUG": "1" if debug else "0", **broker_vars},
container_name="web",
),
)
web_service.target_group.configure_health_check(path="/login")
Expand All @@ -130,21 +131,28 @@ def __init__(
)
backend.connections.allow_from_any_ipv4(port_range=ec2.Port.tcp(6379))

celery_worker = ApplicationLoadBalancedFargateService(
celery_task_definition = TaskDefinition(
self,
"MentorMatchCeleryWorker",
security_groups=backend.cluster.cache_security_group_names,
"MentorMatchCeleryTask",
cpu=256,
memory_limit_mib=512,
assign_public_ip=False,
cluster=cluster,
desired_count=1,
task_image_options=ApplicationLoadBalancedTaskImageOptions(
image=ContainerImage.from_registry(
f"ghcr.io/mentor-matching-online/mentor-match/worker:{image_tag}"
),
environment=broker_vars,
memory_mib=512,
)

celery_task_definition.add_container(
self,
"MentorMatchCeleryContainer",
image=ecs.ContainerImage.from_registry(
f"ghcr.io/mentor-matching-online/mentor-match/worker:{image_tag}"
),
container_name="worker",
environment=broker_vars,
)

celery_worker = ecs.FargateService(
self,
"MentorMatchCeleryWorker",
task_definition=celery_task_definition,
cluster=cluster,
)

backend.connections.allow_from(
Expand Down

0 comments on commit 92c9444

Please sign in to comment.