feat: Amplify Gen 2 CDK backend — CloudFront + Lambda for Accept: text/markdown#330
Open
Nonnyjoe wants to merge 2 commits into
Open
feat: Amplify Gen 2 CDK backend — CloudFront + Lambda for Accept: text/markdown#330Nonnyjoe wants to merge 2 commits into
Nonnyjoe wants to merge 2 commits into
Conversation
8e1bcba to
684a373
Compare
…t: text/markdown content negotiation
… CDN cache headers
684a373 to
61ef2a8
Compare
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
Adds the Amplify Gen 2 CDK backend that powers HTTP content negotiation for the docs site.
amplify/functions/markdown-negotiation/— Amplify-managed Lambda (docs-markdown-negotiation) visible in Amplify Console → Functions. RewritesAccept: text/markdownrequests to.mdpaths and proxies to the Amplify origin.amplify/custom/markdown-negotiation/— CDK construct that creates a CloudFront distribution with the Lambda Function URL as its origin. Cache policy varies on theAcceptheader so HTML and Markdown variants cache separately.amplify/backend.ts— wires Lambda and CloudFront together, attaches a Function URL, passes the hostname to the CloudFront construct, and emits the distribution domain as a CloudFormation output.amplify.yml— adds thebackend.phases.buildCDK deploy step alongside the existing frontend build. Also includes rewrite rules and CDN cache headers (superset of whatfeat/llm-readabilityadded).package-lock.json(project uses yarn); adds Amplify Gen 2 and AWS CDK dependencies topackage.jsonandyarn.lock.Dependencies
This PR is currently deployed and being monitored on staging. Merge
feat/llm-readability(#329) first.Infrastructure notes
MarkdownNegotiationDomainin theMarkdownNegotiationStackCloudFormation stack.DOCS_DOMAINenv var drives both the CloudFront alternate domain andllms.txtbase URLs. Defaults tostaging.docs.cartesi.iowhen unset.DOCS_CERT_ARNis optional — omit for staging (no custom domain), set to an ACM cert ARN (us-east-1) for production.Test plan
docs-markdown-negotiationLambda visible in Amplify Console → FunctionsMarkdownNegotiationStackappears in CloudFormation withCREATE_COMPLETEorUPDATE_COMPLETEcurl -H "Accept: text/markdown" https://docs.cartesi.io/cartesi-rollups/overviewreturns200 OKwithContent-Type: text/markdownhttps://docs.cartesi.io/cartesi-rollups/overviewreturns HTML (no regression)Closes #328