fix(infra): JARL1183 — reach the SSR instance directly, dropping the load balancer - #115
Merged
Merged
Conversation
randomdevpeteforce-pushed
the
task-1183-drop-the-load-balancer
branch
from
August 30, 2026 11:59
ec2b7af to
9fa06a8Compare…load balancer The distribution's VPC origin now points at the EC2 instance on port 3000 instead of at an internal Application Load Balancer that balanced across a single target and terminated nothing. The load balancer, its listener, its target group and its security group go with it. The instance's ingress moves from the load balancer's security group to the one CloudFront creates and attaches to its own VPC origin network interfaces. The source has to be a security group rather than an address range: the instance holds a public IPv4 address for its outbound access, so a rule written against CloudFront's origin-facing prefix list would admit that address from the internet as well, and one written against the VPC CIDR matches nothing, because the origin sees a CloudFront address rather than the interface's private one. That group's id is not an attribute of the VPC origin, so it is resolved by name at deploy time, by a custom resource that fails naming the group when an account has none, and leaves synth free of credentials. Nothing health-checks the instance now that the target group has gone, so the origin's connection timeout drops to 2 seconds: an unreachable instance costs a viewer three attempts and a 504 in 6 seconds rather than the default 30. The origin's address is the instance's private DNS name, and the AMI is re-resolved on every deploy, so an instance replacement changes it and leaves /ssr/* pointing at an instance that has gone until JarlStaticSite deploys too. A load balancer's DNS name did not move. Nothing here mitigates that; infra/README.md says so. CI typechecks and synthesizes infra/ from here on. Nothing did before — infra/ sits outside the root workspaces and the root tsconfig — and the lookup handler is a template literal that tsc, oxlint and oxfmt cannot read, so a typo in it would first have run during a production deploy. Ticket: 1183
randomdevpeteforce-pushed
the
task-1183-drop-the-load-balancer
branch
from
August 30, 2026 12:17
9fa06a8 to
8fce2cbCompareUh oh!
There was an error while loading. Please reload this page.
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 freeto 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.
Waiting on decision:
first: pin the AMI, or always deploy
JarlSsrandJarlStaticSitetogether.CloudFront now reaches the SSR instance directly as a VPC origin. The internal load balancer, its
listener, its target group and its security group are gone; it balanced one target and terminated
nothing.
Also a bugfix. The instance's ingress admitted the VPC CIDR, and a CIDR rule never matches here —
the origin sees a CloudFront address, not the private one on the interface.
/ssr/answers 504 on thelive site today, and the last three
masterdeploys failed on that check, going back to2026-08-19. The rule now names
CloudFront-VPCOrigins-Service-SG, resolved at deploy time by a customresource that fails naming the group when an account has none.
cdk synthstill needs no credentials.The cost, and it bites at exactly one instance. The origin is the instance's private DNS name, and
the AMI is re-resolved on every deploy, so an instance replacement changes it and
/ssr/*points at aninstance that has gone until
JarlStaticSitedeploys too.cdk deploy --alldoes both in order andcloses the gap; deploying
JarlSsralone does not. Health-check draining and round-robin need morethan one instance to matter — this does not. Nothing here mitigates it.
CI now typechecks and synthesizes
infra/. Nothing did before:infra/is outside the rootworkspacesand the roottsconfig.json, and the lookup handler is a template literal thattsc,oxlintandoxfmtcannot read — so a typo in it would first have run during a production deploy.The step is credential-free, which is also the property being checked. The wider gap (no infra tests,
no
cdk diffon a PR) is a separate piece of work, not this one.Design, the security-group reasoning, the fresh-account
ROLLBACK_FAILEDhazard and theUPDATE_ROLLBACK_FAILEDone the re-runnable lookup buys are all ininfra/README.md.Not verifiable without deploying: that the ingress rule admits CloudFront, and the brief window
inside
cdk deploy --allwhere/ssr/*still names the load balancer that has gone.Checks:
tsc --noEmitandcdk synthininfra/(the latter underenv -iwith an emptyHOME,so no credentials at all),
oxfmt --check,oxlint. Nothing was deployed. No style exceptions.