diff --git a/deploy/terraform/apps/starter/app_stack/main.tf b/deploy/terraform/apps/starter/app_stack/main.tf index f2424689c8..ee4eece47d 100644 --- a/deploy/terraform/apps/starter/app_stack/main.tf +++ b/deploy/terraform/apps/starter/app_stack/main.tf @@ -588,6 +588,20 @@ module "api_service" { health_check_healthy_threshold = var.api_health_check_healthy_threshold deregistration_delay = var.api_deregistration_delay + # Container-level liveness so ECS reports Healthy/Unhealthy instead of "Unknown" + # and restarts a wedged task. The `noble` image ships no curl/wget, so we use + # bash's built-in /dev/tcp to confirm Kestrel is accepting connections on the + # container port; app-level health is already covered by the ALB probing + # /health/live above. REQUIRES the full `noble` image — the chiseled image has + # no shell, so rebuild the API image (deploy --build-api) before applying this. + container_health_check = { + command = ["CMD", "bash", "-c", "exec 3<>/dev/tcp/127.0.0.1/${var.api_container_port}"] + interval = 30 + timeout = 5 + retries = 3 + start_period = 60 + } + task_role_arn = aws_iam_role.api_task.arn enable_circuit_breaker = var.api_enable_circuit_breaker diff --git a/deploy/terraform/apps/starter/envs/dev/ap-south-1/terraform.tfvars b/deploy/terraform/apps/starter/envs/dev/ap-south-1/terraform.tfvars index 89c1c8835d..7087e7991e 100644 --- a/deploy/terraform/apps/starter/envs/dev/ap-south-1/terraform.tfvars +++ b/deploy/terraform/apps/starter/envs/dev/ap-south-1/terraform.tfvars @@ -89,5 +89,7 @@ migrator_command = ["apply", "--seed"] # Services (Fargate Spot for cost savings) ################################################################################ +api_cpu = "1024" # 1 vCPU +api_memory = "2048" # 2 GB — Fargate's minimum memory for 1 vCPU api_desired_count = 1 api_use_fargate_spot = true diff --git a/deploy/terraform/apps/starter/envs/dev/us-east-1/terraform.tfvars b/deploy/terraform/apps/starter/envs/dev/us-east-1/terraform.tfvars index 8226991e64..404d735b4b 100644 --- a/deploy/terraform/apps/starter/envs/dev/us-east-1/terraform.tfvars +++ b/deploy/terraform/apps/starter/envs/dev/us-east-1/terraform.tfvars @@ -84,5 +84,7 @@ migrator_command = ["apply", "--seed"] # Services (Fargate Spot for cost savings) ################################################################################ +api_cpu = "1024" # 1 vCPU +api_memory = "2048" # 2 GB — Fargate's minimum memory for 1 vCPU api_desired_count = 1 api_use_fargate_spot = true