feat(deploy): API task 1 vCPU/2 GB + container health check#1288
Merged
Conversation
… check - dev (us-east-1 + ap-south-1) tfvars override api_cpu=1024 / api_memory=2048 (1 vCPU / 2 GB — Fargate's minimum memory at 1 vCPU). - Define a container-level healthCheck on the API task so ECS reports Healthy/Unhealthy instead of "Unknown" and restarts a wedged task. The noble image ships no curl/wget, so it uses bash's built-in /dev/tcp to confirm Kestrel is accepting connections; app-level health stays covered by the ALB probing /health/live. Verified /dev/tcp works in mcr aspnet:10.0-noble. REQUIRES the full `noble` API image (has bash); the chiseled image has no shell, so rebuild with `deploy --build-api` when rolling this out. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two ECS task-definition changes for the API service.
1. Size the API task to 1 vCPU / 2 GB (dev)
api_cpu = "1024",api_memory = "2048"in bothdev/us-east-1anddev/ap-south-1tfvars (was the256/512default). 2 GB is Fargate''s minimum memory at 1 vCPU, so it''s a valid pairing with no wasted allocation.2. Container-level health check (fixes ECS "Unknown" status)
The task had no container
healthCheck, so the ECS console showed "...health checks are still being evaluated or there are no container health checks defined" → health status Unknown.Added a
container_health_checkon theapi_servicemodule call (the module already supported it; onlyapp_stackwasn''t passing one — no change to the protected module).Why
/dev/tcpand not curl: I inspected the real images. Thenobleimage (what the csproj builds) ships no curl/wget, but does havebash. So the check uses bash''s built-in/dev/tcpto confirm Kestrel is accepting connections on the container port:App-level health is already covered by the ALB target group probing
/health/live; this container check is process liveness so ECS restarts a wedged task. Verified/dev/tcpworks inmcr.microsoft.com/dotnet/aspnet:10.0-noble(realconnect(),Connection refusedon a dead port).nobleimageThe currently-deployed image at the pinned tag is chiseled (no shell, no bash) — a shell health check can''t run there. The csproj already targets
ContainerFamily=noble, so roll this out with a rebuild:Applying against a chiseled image would mark the container unhealthy; the deployment circuit breaker would roll back (not a permanent crash loop, but the deploy fails).
terraform validatepasses.🤖 Generated with Claude Code