fix(infra): JARL1188 — restore the /ssr/* behaviour on the repointed VPC origin - #117
Merged
Merged
Conversation
…VPC origin The VPC origin now addresses the EC2 instance, so the distribution can carry the behaviour again: uncached, whole viewer request forwarded, GET/HEAD/OPTIONS, no directory-index rewrite. The synthesized templates match what the distribution held before the behaviour was detached. JarlSsr takes the distribution back as a prop, so JarlStaticSite's template references it again and CloudFormation orders the two on its own; the explicit dependency that stood in for that now closes a cycle and has to go. infra/README.md keeps the constraint that forced the split, as a property of the origin rather than of one deploy: repointing it takes two. Ticket: 1188
Uh 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.
Restores the
/ssr/*behaviour on the distribution, pointing at the VPC origin that now addresses the EC2 instance directly — uncached (CACHING_DISABLED), whole viewer request forwarded (ALL_VIEWER), GET/HEAD/OPTIONS, no directory-index function. All three synthesized templates come out byte-identical to the ones from before the behaviour was detached.That completes the cutover: the origin is repointed, the load balancer is gone, and
/ssr/*leaves S3 again.Stack order
ssr.addDependency(staticSite)is removed, and keeping it was not an option:JarlStaticSite's template references the origin again, so the explicit edge now fails synth withAdding this dependency (JarlStaticSite -> JarlSsr/SsrInstance/Resource.PrivateDnsName) would create a cyclic reference. The natural edge is back and points the other way — fromcdk.out/manifest.json:So
cdk deploy --allrunsJarlDomainandJarlSsrfirst andJarlStaticSitelast — the orderinfra/README.mddocuments, which the detach deploy had inverted.Will the post-deploy
/ssr/200 check passI believe so, and the three preconditions hold independently of this diff:
packages/docs/src/prod-server.tshandles/ssr/by rendering/, a route that matches, so it returns 200 rather than the 404 an unmatched path gets. The roll step waits for/healthzon the instance before it curls the distribution, so a server that failed to start fails earlier and more legibly.CloudFront-VPCOrigins-Service-SGon 3000 went out with the origin repoint and is live; this change does not touch it.AWS::CloudFront::Distributionupdate complete until the distribution reachesDeployed, socdk deploy --allhas already blocked on edge propagation before the workflow moves on. Two further steps run in between, and the check itself retries 24 times at 5s.The one thing that could have raced is stale negative caching —
/ssr/currently serves the distribution-wide 404 with a 5 minute TTL.Publish site contentinvalidates/*immediately beforehand, and the restored behaviour isCACHING_DISABLEDregardless, so an edge holding that 404 will not still be serving it inside the check's 2 minute budget.The residual risk is unrelated to reattaching:
MachineImage.latestAmazonLinux2023()re-resolves every deploy, so a new AMI replaces the instance andssm send-commandcan arrive before the SSM agent has registered. That is the hazardinfra/README.mdalready sets out, not one this introduces.Scaffolding removed
The mid-cutover blockquote and the comment beside the
VpcOriginare gone.infra/README.mdkeeps the two-deploy constraint, rewritten as a property of the origin rather than a note about this particular cutover, since anyone repointing it again meets the same 409.SsrPathPattern's description needed no edit — "Distribution paths served by the SSR instance rather than S3" is exactly the sentence that was stale during the window and is true again now. The traffic-path prose already readviewer → CloudFront → VPC origin → instance:3000.Checks:
tsc --noEmit -p infra/tsconfig.json,oxfmt --check,oxlintandcdk synthunderenv -iwith an emptyHOMEall pass.