canopycms-cdk 0.0.61-int.75 → 0.0.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constructs/asset-support.d.ts +41 -2
- package/dist/constructs/asset-support.d.ts.map +1 -1
- package/dist/constructs/asset-support.js +83 -3
- package/dist/constructs/asset-support.js.map +1 -1
- package/dist/constructs/cms-service.d.ts +67 -7
- package/dist/constructs/cms-service.d.ts.map +1 -1
- package/dist/constructs/cms-service.js +267 -16
- package/dist/constructs/cms-service.js.map +1 -1
- package/lambda/asset-transform/dist/.deployable +5 -0
- package/lambda/asset-transform/dist/handler.js +83 -9
- package/lambda/asset-transform/dist/node_modules/.package-lock.json +33 -6
- package/lambda/asset-transform/dist/node_modules/@emnapi/runtime/LICENSE +21 -0
- package/lambda/asset-transform/dist/node_modules/@emnapi/runtime/README.md +1 -0
- package/lambda/asset-transform/dist/node_modules/@emnapi/runtime/dist/emnapi.cjs.js +1398 -0
- package/lambda/asset-transform/dist/node_modules/@emnapi/runtime/dist/emnapi.cjs.min.d.ts +671 -0
- package/lambda/asset-transform/dist/node_modules/@emnapi/runtime/dist/emnapi.cjs.min.js +1 -0
- package/lambda/asset-transform/dist/node_modules/@emnapi/runtime/dist/emnapi.d.mts +671 -0
- package/lambda/asset-transform/dist/node_modules/@emnapi/runtime/dist/emnapi.d.ts +673 -0
- package/lambda/asset-transform/dist/node_modules/@emnapi/runtime/dist/emnapi.esm-bundler.js +1457 -0
- package/lambda/asset-transform/dist/node_modules/@emnapi/runtime/dist/emnapi.iife.d.ts +426 -0
- package/lambda/asset-transform/dist/node_modules/@emnapi/runtime/dist/emnapi.iife.js +1528 -0
- package/lambda/asset-transform/dist/node_modules/@emnapi/runtime/dist/emnapi.js +1529 -0
- package/lambda/asset-transform/dist/node_modules/@emnapi/runtime/dist/emnapi.min.d.mts +671 -0
- package/lambda/asset-transform/dist/node_modules/@emnapi/runtime/dist/emnapi.min.js +1 -0
- package/lambda/asset-transform/dist/node_modules/@emnapi/runtime/dist/emnapi.min.mjs +1 -0
- package/lambda/asset-transform/dist/node_modules/@emnapi/runtime/dist/emnapi.mjs +1367 -0
- package/lambda/asset-transform/dist/node_modules/@emnapi/runtime/index.js +5 -0
- package/lambda/asset-transform/dist/node_modules/@emnapi/runtime/package.json +48 -0
- package/lambda/asset-transform/dist/node_modules/@img/sharp-wasm32/LICENSE +191 -0
- package/lambda/asset-transform/dist/node_modules/@img/sharp-wasm32/README.md +50 -0
- package/lambda/asset-transform/dist/node_modules/@img/sharp-wasm32/index.cjs +1 -0
- package/lambda/asset-transform/dist/node_modules/@img/sharp-wasm32/lib/sharp-wasm32-0.35.3.node.js +1 -0
- package/lambda/asset-transform/dist/node_modules/@img/sharp-wasm32/lib/sharp-wasm32-0.35.3.node.wasm +0 -0
- package/lambda/asset-transform/dist/node_modules/@img/sharp-wasm32/package.json +37 -0
- package/lambda/asset-transform/dist/node_modules/@img/sharp-wasm32/versions.json +21 -0
- package/lambda/asset-transform/dist/node_modules/tslib/CopyrightNotice.txt +15 -0
- package/lambda/asset-transform/dist/node_modules/tslib/LICENSE.txt +12 -0
- package/lambda/asset-transform/dist/node_modules/tslib/README.md +164 -0
- package/lambda/asset-transform/dist/node_modules/tslib/SECURITY.md +41 -0
- package/lambda/asset-transform/dist/node_modules/tslib/modules/index.d.ts +38 -0
- package/lambda/asset-transform/dist/node_modules/tslib/modules/index.js +70 -0
- package/lambda/asset-transform/dist/node_modules/tslib/modules/package.json +3 -0
- package/lambda/asset-transform/dist/node_modules/tslib/package.json +47 -0
- package/lambda/asset-transform/dist/node_modules/tslib/tslib.d.ts +460 -0
- package/lambda/asset-transform/dist/node_modules/tslib/tslib.es6.html +1 -0
- package/lambda/asset-transform/dist/node_modules/tslib/tslib.es6.js +402 -0
- package/lambda/asset-transform/dist/node_modules/tslib/tslib.es6.mjs +401 -0
- package/lambda/asset-transform/dist/node_modules/tslib/tslib.html +1 -0
- package/lambda/asset-transform/dist/node_modules/tslib/tslib.js +484 -0
- package/package.json +9 -8
- package/worker/dist/index.js +32325 -31305
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Construct } from 'constructs';
|
|
2
|
-
import { RemovalPolicy, aws_cloudfront as cloudfront, aws_iam as iam, aws_lambda as lambda, aws_s3 as s3 } from 'aws-cdk-lib';
|
|
2
|
+
import { RemovalPolicy, aws_cloudfront as cloudfront, aws_iam as iam, aws_lambda as lambda, aws_logs as logs, aws_s3 as s3 } from 'aws-cdk-lib';
|
|
3
3
|
export interface AssetSupportProps {
|
|
4
4
|
/**
|
|
5
5
|
* Use an existing bucket (BYO mode - e.g. a site's existing content
|
|
@@ -52,6 +52,40 @@ export interface AssetSupportProps {
|
|
|
52
52
|
* @default false
|
|
53
53
|
*/
|
|
54
54
|
readonly autoDeleteObjects?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Require the transform Lambda's code asset to carry proof that it was
|
|
57
|
+
* built with its native sharp binary (the `.deployable` marker written by
|
|
58
|
+
* `build:lambda`). Leave this ON for anything that can reach a real
|
|
59
|
+
* deploy.
|
|
60
|
+
*
|
|
61
|
+
* Set to `false` ONLY in this package's own tests, which deliberately
|
|
62
|
+
* synth against the cheap `--skip-native` fixture bundle that
|
|
63
|
+
* `build:test-fixtures` produces - the suite never executes the handler,
|
|
64
|
+
* so the binary is irrelevant to what it asserts, and requiring a real
|
|
65
|
+
* build would put a live `npm install sharp` back in front of every test
|
|
66
|
+
* run (which is what kept these tests out of CI in the first place).
|
|
67
|
+
*
|
|
68
|
+
* Adopters never need this: the published package's asset is built by
|
|
69
|
+
* `prepack`'s full `build:lambda`, so the marker is always present.
|
|
70
|
+
*
|
|
71
|
+
* @default true
|
|
72
|
+
*/
|
|
73
|
+
readonly requireDeployableBundle?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Retention for the transform Lambda's CloudWatch log group (default:
|
|
76
|
+
* three months / 90 days).
|
|
77
|
+
*/
|
|
78
|
+
readonly transformLogRetention?: logs.RetentionDays;
|
|
79
|
+
/**
|
|
80
|
+
* Name for the transform Lambda's CloudWatch log group (default:
|
|
81
|
+
* `/canopycms/<stackName>/transform`). Deliberately NOT
|
|
82
|
+
* `/aws/lambda/<function-name>` - see `transformLogGroup`'s comment in the
|
|
83
|
+
* constructor for why a CDK-managed group must avoid that exact name once
|
|
84
|
+
* the function has ever been deployed without one. Override to follow an
|
|
85
|
+
* org naming convention, or when instantiating this construct twice in one
|
|
86
|
+
* stack (the default name would collide).
|
|
87
|
+
*/
|
|
88
|
+
readonly transformLogGroupName?: string;
|
|
55
89
|
}
|
|
56
90
|
/**
|
|
57
91
|
* The two CloudFront behavior configs the asset system needs, keyed by the
|
|
@@ -107,7 +141,10 @@ export interface AssetCloudFrontBehaviors {
|
|
|
107
141
|
* - The bucket's asset-prefix lifecycle rule + CORS (standalone mode only).
|
|
108
142
|
* - The transform Lambda (`../../lambda/asset-transform/handler.ts`, built
|
|
109
143
|
* via `pnpm run build:lambda` - see that script's doc comment for the
|
|
110
|
-
* no-Docker sharp bundling approach)
|
|
144
|
+
* no-Docker sharp bundling approach), its dedicated CloudWatch log group
|
|
145
|
+
* (custom name/retention/removal policy instead of the
|
|
146
|
+
* CloudFormation-implicit `/aws/lambda/<function-name>` group), and its
|
|
147
|
+
* OAC-locked Function URL.
|
|
111
148
|
* - `assetBehaviors()`, the two CloudFront behavior configs a consuming
|
|
112
149
|
* distribution attaches (see `AssetCloudFrontBehaviors`'s doc comment for
|
|
113
150
|
* both attachment shapes).
|
|
@@ -119,6 +156,8 @@ export declare class AssetSupport extends Construct {
|
|
|
119
156
|
readonly bucket: s3.IBucket;
|
|
120
157
|
/** The transform Lambda function. */
|
|
121
158
|
readonly transformFunction: lambda.Function;
|
|
159
|
+
/** The transform Lambda's CloudWatch log group (Lambda stdout/stderr). */
|
|
160
|
+
readonly transformLogGroup: logs.LogGroup;
|
|
122
161
|
/** The transform Lambda's Function URL - use as a CloudFront origin (see `assetBehaviors()`). */
|
|
123
162
|
readonly transformFunctionUrl: lambda.FunctionUrl;
|
|
124
163
|
/** Effective advisory upload-size cap (see `AssetSupportProps.maxUploadBytes`). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asset-support.d.ts","sourceRoot":"","sources":["../../src/constructs/asset-support.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"asset-support.d.ts","sourceRoot":"","sources":["../../src/constructs/asset-support.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,EAEL,aAAa,EAEb,cAAc,IAAI,UAAU,EAE5B,OAAO,IAAI,GAAG,EACd,UAAU,IAAI,MAAM,EACpB,QAAQ,IAAI,IAAI,EAChB,MAAM,IAAI,EAAE,EACb,MAAM,aAAa,CAAA;AAiFpB,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,OAAO,CAAA;IAE5B;;;;;OAKG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,EAAE,CAAA;IAEhC;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAA;IAEhC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;IAE5B;;;;OAIG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,aAAa,CAAA;IAEtC;;;;;;OAMG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAEpC;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,uBAAuB,CAAC,EAAE,OAAO,CAAA;IAE1C;;;OAGG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,IAAI,CAAC,aAAa,CAAA;IAEnD;;;;;;;;OAQG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAA;CACxC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,eAAe,CAAA;IAE3C;;;;;;;OAOG;IACH,QAAQ,CAAC,eAAe,EAAE,UAAU,CAAC,eAAe,CAAA;CACrD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,YAAa,SAAQ,SAAS;IACzC,0EAA0E;IAC1E,SAAgB,MAAM,EAAE,EAAE,CAAC,OAAO,CAAA;IAElC,qCAAqC;IACrC,SAAgB,iBAAiB,EAAE,MAAM,CAAC,QAAQ,CAAA;IAElD,0EAA0E;IAC1E,SAAgB,iBAAiB,EAAE,IAAI,CAAC,QAAQ,CAAA;IAEhD,iGAAiG;IACjG,SAAgB,oBAAoB,EAAE,MAAM,CAAC,WAAW,CAAA;IAExD,mFAAmF;IACnF,SAAgB,cAAc,EAAE,MAAM,CAAA;IAEtC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA0B;gBAExC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB;IA2IlE,OAAO,CAAC,cAAc;IA+CtB,uIAAuI;IAChI,cAAc,IAAI,wBAAwB;IAIjD;;;;;;;;;OASG;IACI,iBAAiB,CAAC,OAAO,EAAE,GAAG,CAAC,UAAU,GAAG,IAAI;CAexD"}
|
|
@@ -1,11 +1,35 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
1
2
|
import * as path from 'node:path';
|
|
2
3
|
import { fileURLToPath } from 'node:url';
|
|
3
4
|
import { Construct } from 'constructs';
|
|
4
|
-
import { Duration, RemovalPolicy, aws_cloudfront as cloudfront, aws_cloudfront_origins as origins, aws_lambda as lambda, aws_s3 as s3, } from 'aws-cdk-lib';
|
|
5
|
+
import { Duration, RemovalPolicy, Stack, aws_cloudfront as cloudfront, aws_cloudfront_origins as origins, aws_lambda as lambda, aws_logs as logs, aws_s3 as s3, } from 'aws-cdk-lib';
|
|
5
6
|
// This package (`canopycms-cdk`) is `"type": "module"`, so its compiled
|
|
6
7
|
// output is real ESM - `__dirname` is not a global there. Derive it from
|
|
7
8
|
// `import.meta.url` instead (mirrors ../../lambda/asset-transform/build.mjs).
|
|
8
9
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
/**
|
|
11
|
+
* The transform Lambda's built code asset. Computed ONCE and shared by the
|
|
12
|
+
* deployability guard and `Code.fromAsset()` below - if the check and the
|
|
13
|
+
* bundle ever read two independently-computed paths, the guard can silently
|
|
14
|
+
* start statting a directory that is never the one being deployed, and
|
|
15
|
+
* nothing about either call site would look wrong.
|
|
16
|
+
*
|
|
17
|
+
* The `'..', '..'` walk is correct from both `<pkg>/src/constructs/` (local
|
|
18
|
+
* source) and `<pkg>/dist/constructs/` (published package) only because those
|
|
19
|
+
* sit at the same depth - see the `__dirname` note above.
|
|
20
|
+
*/
|
|
21
|
+
const transformAssetDir = path.join(__dirname, '..', '..', 'lambda', 'asset-transform', 'dist');
|
|
22
|
+
/**
|
|
23
|
+
* Written by `build:lambda` as the last act of a successful FULL build, once
|
|
24
|
+
* the linux/arm64 sharp binary is verified present. See that script's header
|
|
25
|
+
* for why the marker is positive rather than negative: a partial build (a
|
|
26
|
+
* thrown `npm install sharp`, a failed platform check) leaves a sharp-less
|
|
27
|
+
* `dist/` on disk WITHOUT reaching the `--skip-native` branch, so a
|
|
28
|
+
* "is it marked bad?" test would wave exactly that bundle through to a
|
|
29
|
+
* deploy. Requiring proof-of-good instead fails closed on every unexpected
|
|
30
|
+
* path, including the producer's and consumer's paths drifting apart.
|
|
31
|
+
*/
|
|
32
|
+
const DEPLOYABLE_MARKER = '.deployable';
|
|
9
33
|
/**
|
|
10
34
|
* The four S3 key prefixes the asset system uses, mirrored from
|
|
11
35
|
* `packages/canopycms/src/assets/asset-prefixes.ts` (the source of truth).
|
|
@@ -58,7 +82,10 @@ const TRANSFORM_CACHE_MAX_TTL = Duration.days(365);
|
|
|
58
82
|
* - The bucket's asset-prefix lifecycle rule + CORS (standalone mode only).
|
|
59
83
|
* - The transform Lambda (`../../lambda/asset-transform/handler.ts`, built
|
|
60
84
|
* via `pnpm run build:lambda` - see that script's doc comment for the
|
|
61
|
-
* no-Docker sharp bundling approach)
|
|
85
|
+
* no-Docker sharp bundling approach), its dedicated CloudWatch log group
|
|
86
|
+
* (custom name/retention/removal policy instead of the
|
|
87
|
+
* CloudFormation-implicit `/aws/lambda/<function-name>` group), and its
|
|
88
|
+
* OAC-locked Function URL.
|
|
62
89
|
* - `assetBehaviors()`, the two CloudFront behavior configs a consuming
|
|
63
90
|
* distribution attaches (see `AssetCloudFrontBehaviors`'s doc comment for
|
|
64
91
|
* both attachment shapes).
|
|
@@ -68,6 +95,25 @@ const TRANSFORM_CACHE_MAX_TTL = Duration.days(365);
|
|
|
68
95
|
export class AssetSupport extends Construct {
|
|
69
96
|
constructor(scope, id, props) {
|
|
70
97
|
super(scope, id);
|
|
98
|
+
// Fail closed before anything else: refuse to build a stack around a
|
|
99
|
+
// transform Lambda whose code asset was never verified to contain the
|
|
100
|
+
// linux/arm64 sharp binary. Without this, `pnpm test` (whose
|
|
101
|
+
// canopycms-cdk suite rebuilds that directory as a --skip-native
|
|
102
|
+
// fixture) or any partially-failed build leaves a sharp-less bundle on
|
|
103
|
+
// disk, and a later in-repo `cdk deploy` ships it - producing a Lambda
|
|
104
|
+
// that throws at cold start on the first image request, a long way from
|
|
105
|
+
// the cause. Guarding in the construct rather than at one deploy
|
|
106
|
+
// entrypoint means future entrypoints inherit the protection instead of
|
|
107
|
+
// having to remember it.
|
|
108
|
+
if ((props.requireDeployableBundle ?? true) &&
|
|
109
|
+
!existsSync(path.join(transformAssetDir, DEPLOYABLE_MARKER))) {
|
|
110
|
+
throw new Error(`The transform Lambda code asset at ${transformAssetDir} carries no ${DEPLOYABLE_MARKER} ` +
|
|
111
|
+
'marker, so it was not built with its native sharp binary and must not be deployed. ' +
|
|
112
|
+
'This is usually a --skip-native fixture bundle left behind by `pnpm test`, or a ' +
|
|
113
|
+
'`build:lambda` run that failed partway through its sharp install.\n' +
|
|
114
|
+
'Build it for real:\n' +
|
|
115
|
+
' pnpm --filter canopycms-cdk run build:lambda');
|
|
116
|
+
}
|
|
71
117
|
this.maxUploadBytes = props.maxUploadBytes ?? DEFAULT_MAX_UPLOAD_BYTES;
|
|
72
118
|
if (props.bucket) {
|
|
73
119
|
this.bucket = props.bucket;
|
|
@@ -101,13 +147,30 @@ export class AssetSupport extends Construct {
|
|
|
101
147
|
],
|
|
102
148
|
});
|
|
103
149
|
}
|
|
150
|
+
// Dedicated CloudWatch log group for the transform Lambda's stdout/
|
|
151
|
+
// stderr. Custom name (NOT the CloudFormation-implicit
|
|
152
|
+
// `/aws/lambda/<function name>`), for two reasons: (1) CDK does not
|
|
153
|
+
// manage that implicit group at all - infinite retention, and
|
|
154
|
+
// `cdk destroy` leaves it behind; (2) Lambda auto-creates
|
|
155
|
+
// `/aws/lambda/<function name>` on first invoke, OUTSIDE CloudFormation -
|
|
156
|
+
// once that has happened (e.g. this construct was already deployed
|
|
157
|
+
// before this log group existed), a CDK `LogGroup` construct using that
|
|
158
|
+
// exact name would fail its `CreateLogGroup` call with "already exists"
|
|
159
|
+
// and block every future `cdk deploy`. Mirrors `CanopyCmsService`'s
|
|
160
|
+
// `workerLogGroup`/`cmsLogGroup` (cms-service.ts), which established this
|
|
161
|
+
// convention.
|
|
162
|
+
this.transformLogGroup = new logs.LogGroup(this, 'TransformFunctionLogs', {
|
|
163
|
+
logGroupName: props.transformLogGroupName ?? `/canopycms/${Stack.of(this).stackName}/transform`,
|
|
164
|
+
retention: props.transformLogRetention ?? logs.RetentionDays.THREE_MONTHS,
|
|
165
|
+
removalPolicy: RemovalPolicy.DESTROY,
|
|
166
|
+
});
|
|
104
167
|
this.transformFunction = new lambda.Function(this, 'TransformFunction', {
|
|
105
168
|
// Built by `pnpm run build:lambda` (lambda/asset-transform/build.mjs) -
|
|
106
169
|
// esbuild bundle + a real linux/arm64 `npm install sharp` alongside it,
|
|
107
170
|
// no Docker. `cdk synth`/`deploy` need that script run first; it is
|
|
108
171
|
// NOT run automatically here (kept explicit rather than magic - see
|
|
109
172
|
// this construct's class doc comment).
|
|
110
|
-
code: lambda.Code.fromAsset(
|
|
173
|
+
code: lambda.Code.fromAsset(transformAssetDir),
|
|
111
174
|
handler: 'handler.handler',
|
|
112
175
|
// nodejs20.x was deprecated 2026-04-30; CDK's CloudFormation validation
|
|
113
176
|
// now fails synth on it. The esbuild bundle targets node20 and runs
|
|
@@ -116,10 +179,27 @@ export class AssetSupport extends Construct {
|
|
|
116
179
|
architecture: lambda.Architecture.ARM_64,
|
|
117
180
|
memorySize: TRANSFORM_LAMBDA_MEMORY_MB,
|
|
118
181
|
timeout: TRANSFORM_LAMBDA_TIMEOUT,
|
|
182
|
+
// Pass the pre-created group via `logGroup`, NOT `logRetention` (CDK
|
|
183
|
+
// throws LogRetentionLogGroupConflict/ConflictingLogPolicyOptions if
|
|
184
|
+
// both are set on the same function) - the removal policy lives on the
|
|
185
|
+
// LogGroup construct above instead.
|
|
186
|
+
logGroup: this.transformLogGroup,
|
|
119
187
|
environment: {
|
|
120
188
|
ASSET_BUCKET: this.bucket.bucketName,
|
|
121
189
|
},
|
|
122
190
|
});
|
|
191
|
+
// Explicit, scoped grant - NOT a reliance on the auto-created execution
|
|
192
|
+
// role's AWSLambdaBasicExecutionRole managed policy (attached by CDK's
|
|
193
|
+
// lambda.Function regardless of `logGroup`, and never adjusted for it -
|
|
194
|
+
// passing `logGroup` only points the function's LoggingConfig at this
|
|
195
|
+
// group, it grants no IAM permissions). That managed policy's
|
|
196
|
+
// logs:CreateLogStream/logs:PutLogEvents statement is scoped to
|
|
197
|
+
// `arn:aws:logs:*:*:log-group:/aws/lambda/*:*` only (its
|
|
198
|
+
// logs:CreateLogGroup statement is the sole one that's unrestricted) -
|
|
199
|
+
// it grants nothing for a custom-named group like this one. Without this
|
|
200
|
+
// grantWrite, log delivery to this group would fail permission checks
|
|
201
|
+
// with no error surfaced anywhere - logs would simply vanish.
|
|
202
|
+
this.transformLogGroup.grantWrite(this.transformFunction);
|
|
123
203
|
// Read access to originals (what it transforms) - deviation from the PR
|
|
124
204
|
// spec's literal "read asset-originals/, write assets/" grant list: the
|
|
125
205
|
// handler must also read `asset-meta/{hash32}.json` to look up kind/ext
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asset-support.js","sourceRoot":"","sources":["../../src/constructs/asset-support.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,EACL,QAAQ,EACR,aAAa,EACb,cAAc,IAAI,UAAU,EAC5B,sBAAsB,IAAI,OAAO,EAEjC,UAAU,IAAI,MAAM,EACpB,MAAM,IAAI,EAAE,GACb,MAAM,aAAa,CAAA;AAEpB,wEAAwE;AACxE,yEAAyE;AACzE,8EAA8E;AAC9E,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;AAE9D;;;;;;;;;;;;GAYG;AACH,MAAM,QAAQ,GAAG;IACf,SAAS,EAAE,iBAAiB;IAC5B,OAAO,EAAE,eAAe;IACxB,IAAI,EAAE,YAAY;IAClB,MAAM,EAAE,QAAQ;IAChB,SAAS,EAAE,UAAU;CACb,CAAA;AAEV,mFAAmF;AACnF,MAAM,oBAAoB,GAAG,IAAI,CAAA;AAEjC,sFAAsF;AACtF,MAAM,wBAAwB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAA;AAEjD,MAAM,0BAA0B,GAAG,IAAI,CAAA;AACvC,MAAM,wBAAwB,GAAG,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;AAErD;;;;;;;;;;;;;;GAcG;AACH,MAAM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AO,EAAE,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,CAAA;QAEtD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,QAAQ,CAAC,SAAS,IAAI,CAAC,CAAA;QACxD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,QAAQ,CAAC,IAAI,IAAI,CAAC,CAAA;QACnD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,CAAA;QAErD,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAA;QACzD,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,GAAG,QAAQ,CAAC,IAAI,IAAI,CAAC,CAAA;IACxD,CAAC;CACF"}
|
|
@@ -24,7 +24,15 @@ export interface CanopyCmsServiceProps {
|
|
|
24
24
|
spotMaxPrice?: string;
|
|
25
25
|
/** Secrets Manager ARNs the worker needs to read (GitHub token, Clerk key) */
|
|
26
26
|
secretsArns?: string[];
|
|
27
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Environment variables for the Lambda function.
|
|
29
|
+
*
|
|
30
|
+
* Two keys are not free-form here, because the construct configures the
|
|
31
|
+
* worker from the same values and the two halves must agree:
|
|
32
|
+
* `CANOPYCMS_DEPLOYMENT_NAME` is folded into `deploymentName` (validated,
|
|
33
|
+
* and mirrored into the worker's `.env`), and `CANOPY_MODE` accepts only
|
|
34
|
+
* `'prod'`. Everything else is passed through untouched.
|
|
35
|
+
*/
|
|
28
36
|
environment?: Record<string, string>;
|
|
29
37
|
/** EFS removal policy (default: RETAIN) */
|
|
30
38
|
efsRemovalPolicy?: RemovalPolicy;
|
|
@@ -38,6 +46,30 @@ export interface CanopyCmsServiceProps {
|
|
|
38
46
|
clerkSecretKeySecretArn?: string;
|
|
39
47
|
/** Base branch name (default: 'main') */
|
|
40
48
|
baseBranch?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Deployment name (default: 'prod'). Namespaces the settings branch
|
|
51
|
+
* (`canopycms-settings-{deploymentName}`) so this stack's CMS Lambda/worker
|
|
52
|
+
* don't fight another CanopyCMS deployment over the same orphan settings
|
|
53
|
+
* branch. Stamped into the Lambda's `CANOPYCMS_DEPLOYMENT_NAME` environment
|
|
54
|
+
* variable and the worker's `.env`; both resolve it through
|
|
55
|
+
* `resolveDeploymentName` (packages/canopycms/src/operating-mode/deployment-name.ts),
|
|
56
|
+
* which lets this env value win over any `deploymentName` baked into the
|
|
57
|
+
* shared repo's `canopycms.config.ts` — the point of this prop.
|
|
58
|
+
*
|
|
59
|
+
* `environment.CANOPYCMS_DEPLOYMENT_NAME` still overrides this prop, but it
|
|
60
|
+
* is now folded in at synth: the winner is validated by the same rule and
|
|
61
|
+
* written to BOTH halves, so the Lambda and the worker can never resolve
|
|
62
|
+
* different settings branches.
|
|
63
|
+
*
|
|
64
|
+
* Two `CanopyCmsService` stacks pointed at the SAME GitHub repo MUST set
|
|
65
|
+
* distinct values here, or both resolve to `canopycms-settings-prod` and
|
|
66
|
+
* fight over the same branch (permissions/groups changes reviewed on one PR
|
|
67
|
+
* clobber the other). Changing this value later, on a stack that already
|
|
68
|
+
* has a populated settings workspace, is refused at boot (see
|
|
69
|
+
* settings-workspace.ts's rename guard) rather than silently reset — plan
|
|
70
|
+
* the value up front for any stack that shares a repo.
|
|
71
|
+
*/
|
|
72
|
+
deploymentName?: string;
|
|
41
73
|
/**
|
|
42
74
|
* The asset bucket (from `AssetSupport`, or any bucket following its
|
|
43
75
|
* prefix layout) the CMS Lambda's role should be granted access to. When
|
|
@@ -49,7 +81,7 @@ export interface CanopyCmsServiceProps {
|
|
|
49
81
|
assetBucket?: IBucket;
|
|
50
82
|
/**
|
|
51
83
|
* Retention for the EC2 worker's CloudWatch log group (default: three
|
|
52
|
-
* months).
|
|
84
|
+
* months).
|
|
53
85
|
*/
|
|
54
86
|
workerLogRetention?: logs.RetentionDays;
|
|
55
87
|
/**
|
|
@@ -59,6 +91,23 @@ export interface CanopyCmsServiceProps {
|
|
|
59
91
|
* default name would collide).
|
|
60
92
|
*/
|
|
61
93
|
workerLogGroupName?: string;
|
|
94
|
+
/**
|
|
95
|
+
* Retention for the CMS Lambda's CloudWatch log group (default: three
|
|
96
|
+
* months / 90 days).
|
|
97
|
+
*/
|
|
98
|
+
cmsLogRetention?: logs.RetentionDays;
|
|
99
|
+
/**
|
|
100
|
+
* Name for the CMS Lambda's CloudWatch log group (default:
|
|
101
|
+
* `/canopycms/<stackName>/cms`). Deliberately NOT
|
|
102
|
+
* `/aws/lambda/<function-name>` - see the constructor's `cmsLogGroup`
|
|
103
|
+
* comment for why a CDK-managed group must avoid that exact name once the
|
|
104
|
+
* function has ever been deployed without one (CloudFormation's
|
|
105
|
+
* `CreateLogGroup` call fails "already exists" against a group Lambda
|
|
106
|
+
* itself auto-created outside CloudFormation). Override to follow an org
|
|
107
|
+
* naming convention, or when instantiating this construct twice in one
|
|
108
|
+
* stack (the default name would collide).
|
|
109
|
+
*/
|
|
110
|
+
cmsLogGroupName?: string;
|
|
62
111
|
}
|
|
63
112
|
/**
|
|
64
113
|
* Core CDK construct for CanopyCMS deployment.
|
|
@@ -68,12 +117,21 @@ export interface CanopyCmsServiceProps {
|
|
|
68
117
|
* - EFS filesystem with access point at /workspace
|
|
69
118
|
* - Lambda function (Docker image, EFS mount, private subnet, no internet)
|
|
70
119
|
* - Lambda Function URL (for CloudFront origin)
|
|
71
|
-
* - EC2 Worker (t4g.nano spot in ASG, public subnet, EFS mount, systemd)
|
|
72
|
-
*
|
|
73
|
-
*
|
|
120
|
+
* - EC2 Worker (t4g.nano spot in ASG, public subnet, EFS mount, systemd) -
|
|
121
|
+
* rolled on every deploy via the ASG's UpdatePolicy, so a changed worker
|
|
122
|
+
* bundle actually reaches the instance instead of sitting unused in a
|
|
123
|
+
* launch template until the next spot interruption (see the UpdatePolicy
|
|
124
|
+
* below)
|
|
125
|
+
* - Dedicated CloudWatch log groups for the CMS Lambda and the worker's
|
|
126
|
+
* stdout/stderr (the worker's is shipped via the amazon-cloudwatch-agent -
|
|
127
|
+
* journald is not agent-readable), each with a custom name/retention/
|
|
128
|
+
* removal policy instead of the CloudFormation-implicit
|
|
129
|
+
* `/aws/lambda/<function-name>` group (infinite retention, survives
|
|
130
|
+
* `cdk destroy`)
|
|
74
131
|
* - Security groups (least-privilege)
|
|
75
|
-
* - IAM roles (Lambda: EFS
|
|
76
|
-
* Logs write, scoped to its
|
|
132
|
+
* - IAM roles (Lambda: EFS + CloudWatch Logs write scoped to its own log
|
|
133
|
+
* group; EC2: EFS + Secrets Manager + CloudWatch Logs write, scoped to its
|
|
134
|
+
* own log group)
|
|
77
135
|
*/
|
|
78
136
|
export declare class CanopyCmsService extends Construct {
|
|
79
137
|
/** Lambda Function URL — use as CloudFront origin */
|
|
@@ -84,6 +142,8 @@ export declare class CanopyCmsService extends Construct {
|
|
|
84
142
|
readonly vpc: ec2.IVpc;
|
|
85
143
|
/** The Lambda function */
|
|
86
144
|
readonly lambdaFunction: lambda.Function;
|
|
145
|
+
/** The CMS Lambda's CloudWatch log group (Lambda stdout/stderr) */
|
|
146
|
+
readonly cmsLogGroup: logs.LogGroup;
|
|
87
147
|
/** The EC2 worker Auto Scaling Group */
|
|
88
148
|
readonly workerAsg: autoscaling.AutoScalingGroup;
|
|
89
149
|
/** The EC2 worker's CloudWatch log group (worker stdout/stderr) */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cms-service.d.ts","sourceRoot":"","sources":["../../src/constructs/cms-service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,EACL,QAAQ,EACR,aAAa,EAEb,OAAO,IAAI,GAAG,EACd,OAAO,IAAI,GAAG,EAEd,UAAU,IAAI,MAAM,EACpB,eAAe,IAAI,WAAW,EAE9B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