Repository navigation
feat(cloudformation): serve BuildBot through API Gateway on the internal load balancer - #433
Conversation
Roslyn analyzer findings
|
…ter and Settings mapping format (#427) The template now follows the shared format: parameters are cut to those the deploy action passes and the template uses, and all other values move to a Settings / Values mapping. The image uses ${AwsContainerRegistry}/${Owner}/..., and secrets use long-form Fn::Sub. All 96 resolved values are unchanged from main. Only deploy-workflow-supplied values remain parameters.
Point the Settings LoadBalancerListenerArn at the internal ALB listener. Remove the Name property from TargetGroup. A named target group cannot be replaced or attached to a second load balancer, so the fixed name blocks the move to the internal load balancer. This is the same fix that funfair-ethereum-proxy-server needed.
|
Live-chat answers from the repository owner:
Resolved:
|
|
Repository owner in live chat: "q18 yes". The three subnets' AZs are supported for VPC Link V2 in eu-west-1. Q19 (whether |
|
Repository owner in live chat: "q19 there's ONLY one zone". |
AWS::ECS::Service has no settable Name property, so the service name was never applied. Setting ServiceName applies it. Changing ServiceName replaces the ECS service on the next deploy. Construct: ECS service name set with the unsupported Name property Swept: none
|
Correcting the PR body: the previous body said the Route 53 record would be imported into the stack. That is no longer the plan. CloudFormation cannot import |
|
Simplify clean - advancing to code review |
Coding ResearcherQuestion 1: Does HTTP API (API Gateway v2) access logging to CloudWatch need the account-level API Gateway CloudWatch role ( Outcome: No (high confidence). HTTP APIs use CloudWatch Logs vended-log delivery. The service principal Question 2: Does Outcome: Yes (medium-high confidence). AWS's SAM |
Rename the Settings.Values key ApiAccessLogRetentionInDays to LogRetentionInDays and use it for both the API Gateway access log group and the /ecs/<ApplicationName>/ application log group, which now sets RetentionInDays. README.md notes the ECS log group retention.
…#421) The awslogs-group option now references LogGroup with Ref instead of building the name with Fn::Sub. The resolved value is unchanged, and the task definition now has an implicit dependency on the log group.
Fixed: the ECS application log group is now created before the tasks and removed after them, so new stacks no longer fail with a 'log group does not exist' error and final task logs are kept on stack deletion.
|
Coverage ratchet passed - advancing to Human Review (.NET overall 99.2%, equal to main) |
AI Review Loop: reviewed 4191813 |
Super-linter summary
All files and directories linted successfully For more information, see the GitHub Actions workflow run Powered by Super-linter |
Summary
Moves BuildBot from the
testingApplication Load Balancer to theinternalone, and puts an API Gateway HTTP API in front of it, created by the stack. Clients call the API Gateway custom domain forApiHost. It forwards only the six application routes through a stack-owned VPC Link to the internal ALB listener, which routes to the ECS service as before.The change also restructures
cloudformation.jsoninto the shared template format (#427) and sets the ECS service name explicitly.Resolved values are unchanged from main; the shared-format work only moves where they are declared.
Changes
1. Shared template format (#427)
.github/actions/cloudformation-deploy/action.ymlpasses them:ApplicationName,ApplicationContainer,ApplicationVersion,ApiHost,LoadBalancerHostName,LoadBalancerPriorityandAwsContainerRegistry.Settingsmapping, which replacesDeployment.Fn::Sub, with aFn::FindInMapfor the Secrets Manager ARN, because the short form cannot read a mapping.2. Internal load balancer
ListenerRulemoves to the internal listener (arn:aws:elasticloadbalancing:eu-west-1:117769150821:listener/app/internal/fbd77c1a39a60f7f/e01c11e315c3ff6e) at priority 50, taken fromLoadBalancerPriority.TargetGroupno longer has aName, so CloudFormation can replace it. The ECS service'sLoadBalancersblock points at the replacement.3. API Gateway HTTP API
AWS::ApiGatewayV2::VpcLinkon the service's subnets, with its own security group. The only rule is egress TCP 443 to172.31.0.0/16, with no ingress.HTTP_PROXYintegration over the VPC Link to the internal listener. It overwritesHostwithLoadBalancerHostNameandX-Client-Ipwith$context.identity.sourceIp, so a client cannot spoof either. TLS is verified againstbuildbot.funfair.io(TlsConfig.ServerNameToVerify).GET /ping,POST /github/ping,POST /github/push,POST /github/status,POST /watchtower/deployandPOST /cloudformation/deploy. Any other path gets API Gateway's own 404.$default, with auto-deploy.ApiHostusing the existing ACM certificate, plus an API mapping to the stage.Aalias record infunfair.io.pointing at the custom domain. It hasDeletionPolicyandUpdateReplacePolicyset toRetain. Route 53 record sets cannot be imported, so the existingbuildbot.funfair.iorecord is deleted by hand before the first deploy (see the Deploy checklist).4.
X-Client-Ipin the webhook rejection logGitHubWebhookSignatureMiddlewarereads theX-Client-Ipheader and logs it asClientIp, sanitised like the other client-supplied values. The rejection message gainsclient ip: {ClientIp}.X-Forwarded-Foronly holds the VPC Link's private address, soX-Client-Ipis the real caller.5. ECS
ServiceNamefixECSServicenow setsServiceNametoApplicationNameexplicitly.6. README
X-Client-Ip, authentication guidance (use theAuthorizationheader, neverX-Api-Key), the VPC Link's 60-day inactivity limit, and the DNS cut-over steps.Deploy checklist
For the owner:
buildbot.funfair.iorecord just before the first deploy, keeping its values (the alias target andEvaluateTargetHealth, plus anyAAAArecord for the name). The README has the commands.buildbot.funfair.iorecord again before retrying, because theRetainpolicy leaves it in place and the retry would otherwise fail.Closes #421
Closes #427