Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prerender Fargate: Recaching implementation #1107

Merged
merged 4 commits into from
Oct 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,14 @@
"ecmaVersion": "latest"
},
"plugins": ["@typescript-eslint", "prettier"],
"rules": {}
"rules": {
"@typescript-eslint/no-unused-vars": [
"warn", // or "error"
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"
}
]
}
}
4,528 changes: 3,357 additions & 1,171 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions packages/prerender-fargate/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { PrerenderFargate, PrerenderOptions } from "./lib/prerender-fargate";
import { PrerenderFargate } from "./lib/prerender-fargate";
import { PrerenderFargateOptions } from "./lib/prerender-fargate-options";

export { PrerenderFargate, PrerenderOptions };
export { PrerenderFargate, PrerenderFargateOptions };
81 changes: 81 additions & 0 deletions packages/prerender-fargate/lib/prerender-fargate-options.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import { PrerenderTokenUrlAssociationProps } from "./recaching/prerender-tokens";

/**
* Options for configuring the Prerender Fargate construct.
*/
export interface PrerenderFargateOptions {
/**
* The name of the Prerender service.
*/
prerenderName: string;
/**
* The domain name to prerender.
*/
domainName: string;
/**
* The ID of the VPC to deploy the Fargate service in.
*/
vpcId?: string;
/**
* The name of the S3 bucket to store prerendered pages in.
*/
bucketName?: string;
/**
* The number of days to keep prerendered pages in the S3 bucket before expiring them.
*/
expirationDays?: number;
/**
* A list of tokens to use for authentication with the Prerender service.
* This parameter is deprecated and will be removed in a future release.
* Please use the `tokenUrlAssociation` parameter instead.
* *If `tokenUrlAssociation` is provided, `tokenList` will be ignored*
*/
tokenList: Array<string>;
/**
* The ARN of the SSL certificate to use for HTTPS connections.
*/
certificateArn: string;
/**
* The desired number of Fargate instances to run.
*/
desiredInstanceCount?: number;
/**
* The maximum number of Fargate instances to run.
*/
maxInstanceCount?: number;
/**
* The amount of CPU to allocate to each Fargate instance.
*/
instanceCPU?: number;
/**
* The amount of memory to allocate to each Fargate instance.
*/
instanceMemory?: number;
/**
* Whether to enable caching of HTTP redirects.
*/
enableRedirectCache?: string;
/**
* Whether to enable the S3 endpoint for the VPC.
*/
enableS3Endpoint?: boolean;
/**
* Configuration for associating tokens with specific domain URLs.
* During the reacaching process, these tokens will be used to validate the request.
* ### Example:
* ```typescript
* {
* tokenUrlAssociation: {
* token1: [
* "https://example.com",
* "https://acme.example.com"],
* token2: [
* "https://example1.com",
* "https://acme.example1.com"]
* },
* ssmPathPrefix: "/prerender/recache/tokens"
* }
* ```
*/
tokenUrlAssociation?: PrerenderTokenUrlAssociationProps;
}
Loading
Loading