@fy-stack/app-construct 0.0.147-alpha.3063 → 0.0.147-alpha.3065
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/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -5
- package/dist/lib/ecs/apps/image-app-construct.js +1 -1
- package/dist/lib/ecs/apps/next-app-router-construct.d.ts.map +1 -1
- package/dist/lib/ecs/apps/next-app-router-construct.js +13 -8
- package/dist/lib/ecs/apps/task-construct.js +1 -1
- package/dist/lib/ecs/shared/taskDefinitionImage.d.ts.map +1 -1
- package/dist/lib/lambda/apps/image-app-construct.d.ts.map +1 -1
- package/dist/lib/lambda/apps/image-app-construct.js +3 -3
- package/dist/lib/lambda/apps/next-app-router-construct.d.ts.map +1 -1
- package/dist/lib/lambda/apps/next-app-router-construct.js +9 -3
- package/dist/lib/lambda/utils/lambda-attach.js +1 -1
- package/dist/lib/shared/code-deployment.d.ts +4 -0
- package/dist/lib/shared/code-deployment.d.ts.map +1 -0
- package/dist/lib/shared/code-deployment.js +21 -0
- package/dist/lib/shared/next-app-router.d.ts +4 -3
- package/dist/lib/shared/next-app-router.d.ts.map +1 -1
- package/dist/lib/shared/next-app-router.js +24 -42
- package/dist/lib/shared/params-from-attachable.d.ts +5 -0
- package/dist/lib/shared/params-from-attachable.d.ts.map +1 -0
- package/dist/lib/shared/params-from-attachable.js +11 -0
- package/dist/lib/shared/public-bucket.d.ts +4 -0
- package/dist/lib/shared/public-bucket.d.ts.map +1 -0
- package/dist/lib/shared/public-bucket.js +23 -0
- package/dist/lib/standalone/image-app-container.d.ts +5 -2
- package/dist/lib/standalone/image-app-container.d.ts.map +1 -1
- package/dist/lib/standalone/next-app-router-code.d.ts +9 -0
- package/dist/lib/standalone/next-app-router-code.d.ts.map +1 -0
- package/dist/lib/standalone/next-app-router-code.js +51 -0
- package/dist/lib/standalone/next-app-router-container.d.ts +5 -2
- package/dist/lib/standalone/next-app-router-container.d.ts.map +1 -1
- package/dist/lib/standalone/next-app-router-container.js +10 -1
- package/dist/lib/standalone/types.d.ts +1 -3
- package/dist/lib/standalone/types.d.ts.map +1 -1
- package/dist/lib/util/public-bucket.d.ts +4 -0
- package/dist/lib/util/public-bucket.d.ts.map +1 -0
- package/dist/lib/util/public-bucket.js +23 -0
- package/package.json +3 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
export { ImageAppContainer } from './lib/standalone/image-app-container';
|
|
2
|
-
export { NextAppRouterContainer } from './lib/standalone/next-app-router-container';
|
|
3
1
|
export { EcsConstruct } from './lib/ecs/ecs-construct';
|
|
4
2
|
export type { EcsConstructProps } from './lib/ecs/types';
|
|
5
3
|
export { LambdaConstruct } from './lib/lambda/lambda-construct';
|
|
6
4
|
export type { LambdaConstructProps } from './lib/lambda/types';
|
|
7
5
|
export { lambdaAttach } from './lib/lambda/utils/lambda-attach';
|
|
8
6
|
export { lambdaGrant } from './lib/lambda/utils/lambda-grant';
|
|
7
|
+
export { ImageAppContainer } from './lib/standalone/image-app-container';
|
|
8
|
+
export { NextAppRouterContainer } from './lib/standalone/next-app-router-container';
|
|
9
|
+
export { NextAppRouterCode } from './lib/standalone/next-app-router-code';
|
|
9
10
|
export { StaticConstruct } from './lib/static/static-construct';
|
|
10
11
|
export type { StaticConstructProps } from './lib/static/types';
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,YAAY,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,YAAY,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StaticConstruct = exports.
|
|
4
|
-
var image_app_container_1 = require("./lib/standalone/image-app-container");
|
|
5
|
-
Object.defineProperty(exports, "ImageAppContainer", { enumerable: true, get: function () { return image_app_container_1.ImageAppContainer; } });
|
|
6
|
-
var next_app_router_container_1 = require("./lib/standalone/next-app-router-container");
|
|
7
|
-
Object.defineProperty(exports, "NextAppRouterContainer", { enumerable: true, get: function () { return next_app_router_container_1.NextAppRouterContainer; } });
|
|
3
|
+
exports.StaticConstruct = exports.NextAppRouterCode = exports.NextAppRouterContainer = exports.ImageAppContainer = exports.lambdaGrant = exports.lambdaAttach = exports.LambdaConstruct = exports.EcsConstruct = void 0;
|
|
8
4
|
var ecs_construct_1 = require("./lib/ecs/ecs-construct");
|
|
9
5
|
Object.defineProperty(exports, "EcsConstruct", { enumerable: true, get: function () { return ecs_construct_1.EcsConstruct; } });
|
|
10
6
|
var lambda_construct_1 = require("./lib/lambda/lambda-construct");
|
|
@@ -13,5 +9,11 @@ var lambda_attach_1 = require("./lib/lambda/utils/lambda-attach");
|
|
|
13
9
|
Object.defineProperty(exports, "lambdaAttach", { enumerable: true, get: function () { return lambda_attach_1.lambdaAttach; } });
|
|
14
10
|
var lambda_grant_1 = require("./lib/lambda/utils/lambda-grant");
|
|
15
11
|
Object.defineProperty(exports, "lambdaGrant", { enumerable: true, get: function () { return lambda_grant_1.lambdaGrant; } });
|
|
12
|
+
var image_app_container_1 = require("./lib/standalone/image-app-container");
|
|
13
|
+
Object.defineProperty(exports, "ImageAppContainer", { enumerable: true, get: function () { return image_app_container_1.ImageAppContainer; } });
|
|
14
|
+
var next_app_router_container_1 = require("./lib/standalone/next-app-router-container");
|
|
15
|
+
Object.defineProperty(exports, "NextAppRouterContainer", { enumerable: true, get: function () { return next_app_router_container_1.NextAppRouterContainer; } });
|
|
16
|
+
var next_app_router_code_1 = require("./lib/standalone/next-app-router-code");
|
|
17
|
+
Object.defineProperty(exports, "NextAppRouterCode", { enumerable: true, get: function () { return next_app_router_code_1.NextAppRouterCode; } });
|
|
16
18
|
var static_construct_1 = require("./lib/static/static-construct");
|
|
17
19
|
Object.defineProperty(exports, "StaticConstruct", { enumerable: true, get: function () { return static_construct_1.StaticConstruct; } });
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ImageAppConstruct = void 0;
|
|
4
4
|
const aws_cloudfront_1 = require("aws-cdk-lib/aws-cloudfront");
|
|
5
5
|
const constructs_1 = require("constructs");
|
|
6
|
-
const params_from_attachable_1 = require("../../
|
|
6
|
+
const params_from_attachable_1 = require("../../shared/params-from-attachable");
|
|
7
7
|
const taskDefinitionImage_1 = require("../shared/taskDefinitionImage");
|
|
8
8
|
class ImageAppConstruct extends constructs_1.Construct {
|
|
9
9
|
props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-app-router-construct.d.ts","sourceRoot":"","sources":["../../../../src/lib/ecs/apps/next-app-router-construct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;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,CAAC,MAAM,EAAE,UAAU,CAAC;IAO7C,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO;CAG7B"}
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NextAppRouterConstruct = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const ssm = tslib_1.__importStar(require("aws-cdk-lib/aws-ssm"));
|
|
6
5
|
const s3 = tslib_1.__importStar(require("aws-cdk-lib/aws-s3"));
|
|
6
|
+
const cdk = tslib_1.__importStar(require("aws-cdk-lib"));
|
|
7
7
|
const constructs_1 = require("constructs");
|
|
8
8
|
const next_app_router_1 = require("../../shared/next-app-router");
|
|
9
|
-
const params_from_attachable_1 = require("../../
|
|
9
|
+
const params_from_attachable_1 = require("../../shared/params-from-attachable");
|
|
10
10
|
const taskDefinitionImage_1 = require("../shared/taskDefinitionImage");
|
|
11
|
+
const public_bucket_1 = require("../../shared/public-bucket");
|
|
11
12
|
class NextAppRouterConstruct extends constructs_1.Construct {
|
|
12
13
|
props;
|
|
13
14
|
container;
|
|
@@ -17,15 +18,19 @@ class NextAppRouterConstruct extends constructs_1.Construct {
|
|
|
17
18
|
constructor(scope, id, props) {
|
|
18
19
|
super(scope, id);
|
|
19
20
|
this.props = props;
|
|
21
|
+
this.static = (0, public_bucket_1.publicBucket)(this, 'StaticBucket');
|
|
22
|
+
const artifactBucket = new s3.Bucket(this, 'ArtifactStorage', {
|
|
23
|
+
removalPolicy: cdk.RemovalPolicy.DESTROY,
|
|
24
|
+
autoDeleteObjects: true,
|
|
25
|
+
});
|
|
20
26
|
if ('output' in props) {
|
|
21
|
-
const deployment = (0, next_app_router_1.staticDeployment)(this, props.output);
|
|
22
|
-
this.
|
|
23
|
-
this.files = deployment.files;
|
|
27
|
+
const deployment = (0, next_app_router_1.staticDeployment)(this, artifactBucket, props.output);
|
|
28
|
+
this.files = { artifactBucket: artifactBucket, ...deployment.files };
|
|
24
29
|
}
|
|
25
30
|
else {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
this.files =
|
|
31
|
+
const fileParams = (0, next_app_router_1.filesFromSSm)(this, props.reference);
|
|
32
|
+
const appArtifact = s3.Bucket.fromBucketName(scope, 'AppArtifactStorage', fileParams.artifact);
|
|
33
|
+
this.files = { ...fileParams, artifactBucket: appArtifact };
|
|
29
34
|
}
|
|
30
35
|
this.container = (0, taskDefinitionImage_1.taskDefinitionImage)(this, `${props.appName}AppContainer`, props);
|
|
31
36
|
}
|
|
@@ -8,7 +8,7 @@ const pipes = tslib_1.__importStar(require("aws-cdk-lib/aws-pipes"));
|
|
|
8
8
|
const snsSubscription = tslib_1.__importStar(require("aws-cdk-lib/aws-sns-subscriptions"));
|
|
9
9
|
const sqs = tslib_1.__importStar(require("aws-cdk-lib/aws-sqs"));
|
|
10
10
|
const constructs_1 = require("constructs");
|
|
11
|
-
const params_from_attachable_1 = require("../../
|
|
11
|
+
const params_from_attachable_1 = require("../../shared/params-from-attachable");
|
|
12
12
|
const taskDefinitionImage_1 = require("../shared/taskDefinitionImage");
|
|
13
13
|
class TaskConstruct extends constructs_1.Construct {
|
|
14
14
|
props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taskDefinitionImage.d.ts","sourceRoot":"","sources":["../../../../src/lib/ecs/shared/taskDefinitionImage.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"taskDefinitionImage.d.ts","sourceRoot":"","sources":["../../../../src/lib/ecs/shared/taskDefinitionImage.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAG5C,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAEzD,KAAK,KAAK,GAAG,SAAS,GACpB,IAAI,CAAC,aAAa,EAAE,KAAK,GAAG,MAAM,GAAG,UAAU,GAAG,gBAAgB,CAAC,CAAC;AAEtE,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,SAAS,EAChB,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,KAAK,2BA4Cb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-app-construct.d.ts","sourceRoot":"","sources":["../../../../src/lib/lambda/apps/image-app-construct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAEL,eAAe,EAKhB,MAAM,4BAA4B,CAAC;AAIpC,OAAO,EAEL,QAAQ,EAIT,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAK5E,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"image-app-construct.d.ts","sourceRoot":"","sources":["../../../../src/lib/lambda/apps/image-app-construct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAEL,eAAe,EAKhB,MAAM,4BAA4B,CAAC;AAIpC,OAAO,EAEL,QAAQ,EAIT,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAK5E,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAMvD,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAUP,CAAC;AAEjB,qBAAa,iBAAkB,SAAQ,SAAU,YAAW,YAAY;IAC/D,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;gBAG9B,KAAK,EAAE,SAAS,EAChB,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;IAoDzD,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,IAAI;IAIpD,KAAK,CAAC,GAAG,UAAU,EAAE,SAAS,EAAE,GAAG,IAAI;IAIvC,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,kBAAkB;IAW1D,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC;IAqBzD,gBAAgB,CAAC,cAAc,EAAE,MAAM;IAIvC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC;IAIvD,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO;;;;;;;;;;;;CAG7B"}
|
|
@@ -5,19 +5,19 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const aws_cdk_lib_1 = require("aws-cdk-lib");
|
|
6
6
|
const aws_cloudfront_1 = require("aws-cdk-lib/aws-cloudfront");
|
|
7
7
|
const aws_cloudfront_origins_1 = require("aws-cdk-lib/aws-cloudfront-origins");
|
|
8
|
-
const aws_ecr_assets_1 = require("aws-cdk-lib/aws-ecr-assets");
|
|
9
8
|
const ecr = tslib_1.__importStar(require("aws-cdk-lib/aws-ecr"));
|
|
9
|
+
const aws_ecr_assets_1 = require("aws-cdk-lib/aws-ecr-assets");
|
|
10
10
|
const aws_lambda_1 = require("aws-cdk-lib/aws-lambda");
|
|
11
11
|
const aws_lambda_event_sources_1 = require("aws-cdk-lib/aws-lambda-event-sources");
|
|
12
12
|
const aws_sns_subscriptions_1 = require("aws-cdk-lib/aws-sns-subscriptions");
|
|
13
13
|
const aws_sqs_1 = require("aws-cdk-lib/aws-sqs");
|
|
14
14
|
const constructs_1 = require("constructs");
|
|
15
15
|
const zod_1 = require("zod");
|
|
16
|
+
const container_1 = require("../../shared/container");
|
|
16
17
|
const getDefaultLambda_1 = require("../utils/getDefaultLambda");
|
|
17
18
|
const lambda_api_1 = require("../utils/lambda-api");
|
|
18
19
|
const lambda_attach_1 = require("../utils/lambda-attach");
|
|
19
20
|
const lambda_grant_1 = require("../utils/lambda-grant");
|
|
20
|
-
const container_1 = require("../../shared/container");
|
|
21
21
|
const BuildParamsSchema = zod_1.z
|
|
22
22
|
.object({
|
|
23
23
|
container: zod_1.z
|
|
@@ -38,7 +38,7 @@ class ImageAppConstruct extends constructs_1.Construct {
|
|
|
38
38
|
let code;
|
|
39
39
|
if ('reference' in props) {
|
|
40
40
|
const params = (0, container_1.containerParamsFromSSM)(this, props.reference);
|
|
41
|
-
const repository = ecr.Repository.fromRepositoryName(this, '
|
|
41
|
+
const repository = ecr.Repository.fromRepositoryName(this, 'Repository', params.repository);
|
|
42
42
|
code = aws_lambda_1.Code.fromEcrImage(repository, {
|
|
43
43
|
tagOrDigest: params.tag,
|
|
44
44
|
cmd: container?.cmd,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-app-router-construct.d.ts","sourceRoot":"","sources":["../../../../src/lib/lambda/apps/next-app-router-construct.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAi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;IACnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAU;gBAG9B,KAAK,EAAE,SAAS,EAChB,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;IAkDzD,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,eAAe,CAAC;IAkBpE,gBAAgB,CAAC,cAAc,EAAE,MAAM;IAIvC,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC;IAgG3D,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;IAI7C,KAAK,CAAC,GAAG,MAAM,EAAE,SAAS,EAAE;IAI5B,YAAY,IAAI,kBAAkB;IAIlC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO;;;CAG7B"}
|
|
@@ -9,6 +9,7 @@ const aws_apigatewayv2_integrations_1 = require("aws-cdk-lib/aws-apigatewayv2-in
|
|
|
9
9
|
const cloudfrontOrigin = tslib_1.__importStar(require("aws-cdk-lib/aws-cloudfront-origins"));
|
|
10
10
|
const lambda = tslib_1.__importStar(require("aws-cdk-lib/aws-lambda"));
|
|
11
11
|
const aws_lambda_1 = require("aws-cdk-lib/aws-lambda");
|
|
12
|
+
const s3 = tslib_1.__importStar(require("aws-cdk-lib/aws-s3"));
|
|
12
13
|
const s3Deploy = tslib_1.__importStar(require("aws-cdk-lib/aws-s3-deployment"));
|
|
13
14
|
const constructs_1 = require("constructs");
|
|
14
15
|
const zod_1 = require("zod");
|
|
@@ -16,6 +17,7 @@ const next_app_router_1 = require("../../shared/next-app-router");
|
|
|
16
17
|
const getDefaultLambda_1 = require("../utils/getDefaultLambda");
|
|
17
18
|
const lambda_attach_1 = require("../utils/lambda-attach");
|
|
18
19
|
const lambda_grant_1 = require("../utils/lambda-grant");
|
|
20
|
+
const public_bucket_1 = require("../../shared/public-bucket");
|
|
19
21
|
const BuildParamsSchema = zod_1.z.object({ cmd: zod_1.z.string() }).passthrough();
|
|
20
22
|
class NextAppRouterConstruct extends constructs_1.Construct {
|
|
21
23
|
function;
|
|
@@ -28,9 +30,13 @@ class NextAppRouterConstruct extends constructs_1.Construct {
|
|
|
28
30
|
throw new Error('Output is required');
|
|
29
31
|
}
|
|
30
32
|
const region = cdk.Stack.of(this).region;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
this.static = (0, public_bucket_1.publicBucket)(this, 'StaticBucket');
|
|
34
|
+
const artifactBucket = new s3.Bucket(this, 'ArtifactStorage', {
|
|
35
|
+
removalPolicy: cdk.RemovalPolicy.DESTROY,
|
|
36
|
+
autoDeleteObjects: true,
|
|
37
|
+
});
|
|
38
|
+
const deployment = (0, next_app_router_1.staticDeployment)(this, artifactBucket, props.output);
|
|
39
|
+
this.files = { artifactBucket, ...deployment.files };
|
|
34
40
|
const webAdapterLayer = lambda.LayerVersion.fromLayerVersionArn(this, 'WebAdapterLayer', `arn:aws:lambda:${region}:753240598075:layer:LambdaAdapterLayerX86:25`);
|
|
35
41
|
const environment = {
|
|
36
42
|
AWS_LAMBDA_EXEC_WRAPPER: '/opt/bootstrap',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.lambdaAttach = lambdaAttach;
|
|
4
|
-
const params_from_attachable_1 = require("../../
|
|
4
|
+
const params_from_attachable_1 = require("../../shared/params-from-attachable");
|
|
5
5
|
function lambdaAttach(func, attachable) {
|
|
6
6
|
const params = {};
|
|
7
7
|
Object.assign(params, ...(0, params_from_attachable_1.paramsFromAttachable)(attachable));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-deployment.d.ts","sourceRoot":"","sources":["../../../src/lib/shared/code-deployment.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAGzC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,wBAAgB,cAAc,CAC5B,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,EAAE,CAAC,OAAO,EAClB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,UAqBhB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.codeDeployment = codeDeployment;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const s3Deploy = tslib_1.__importStar(require("aws-cdk-lib/aws-s3-deployment"));
|
|
6
|
+
const cdk = tslib_1.__importStar(require("aws-cdk-lib"));
|
|
7
|
+
function codeDeployment(scope, bucket, output, version) {
|
|
8
|
+
const codeFiles = s3Deploy.Source.asset(output);
|
|
9
|
+
const codePrefix = `assets/code/${version}`;
|
|
10
|
+
const codeDeployment = new s3Deploy.BucketDeployment(scope, `CodeDeployment`, {
|
|
11
|
+
destinationBucket: bucket,
|
|
12
|
+
sources: [codeFiles],
|
|
13
|
+
destinationKeyPrefix: codePrefix,
|
|
14
|
+
retainOnDelete: false,
|
|
15
|
+
extract: false,
|
|
16
|
+
});
|
|
17
|
+
return cdk.Fn.join('/', [
|
|
18
|
+
codePrefix,
|
|
19
|
+
cdk.Fn.select(0, codeDeployment.objectKeys),
|
|
20
|
+
]);
|
|
21
|
+
}
|
|
@@ -4,6 +4,7 @@ import * as s3 from 'aws-cdk-lib/aws-s3';
|
|
|
4
4
|
import * as s3Deploy from 'aws-cdk-lib/aws-s3-deployment';
|
|
5
5
|
import { Construct } from 'constructs';
|
|
6
6
|
export type AppFile = {
|
|
7
|
+
artifactBucket: s3.IBucket;
|
|
7
8
|
staticFiles?: {
|
|
8
9
|
deployment?: s3Deploy.BucketDeployment;
|
|
9
10
|
key: string;
|
|
@@ -14,6 +15,7 @@ export type AppFile = {
|
|
|
14
15
|
};
|
|
15
16
|
};
|
|
16
17
|
export declare function filesFromSSm(scope: Construct, reference: string): {
|
|
18
|
+
artifact: string;
|
|
17
19
|
publicFiles: {
|
|
18
20
|
key: string;
|
|
19
21
|
};
|
|
@@ -21,8 +23,7 @@ export declare function filesFromSSm(scope: Construct, reference: string): {
|
|
|
21
23
|
key: string;
|
|
22
24
|
};
|
|
23
25
|
};
|
|
24
|
-
export declare function staticDeployment(app: Construct, output: string): {
|
|
25
|
-
staticBucket: cdk.aws_s3.Bucket;
|
|
26
|
+
export declare function staticDeployment(app: Construct, bucket: s3.IBucket, output: string): {
|
|
26
27
|
files: {
|
|
27
28
|
staticFiles: {
|
|
28
29
|
deployment: cdk.aws_s3_deployment.BucketDeployment;
|
|
@@ -34,7 +35,7 @@ export declare function staticDeployment(app: Construct, output: string): {
|
|
|
34
35
|
};
|
|
35
36
|
};
|
|
36
37
|
};
|
|
37
|
-
export declare function cloudfrontBehaviours(
|
|
38
|
+
export declare function cloudfrontBehaviours(scope: Construct, staticBucket: s3.IBucket, serverOrigin: cloudfront.IOrigin, basePath: string, files: AppFile, isLambda?: boolean): {
|
|
38
39
|
[x: string]: cdk.aws_cloudfront.BehaviorOptions;
|
|
39
40
|
};
|
|
40
41
|
//# sourceMappingURL=next-app-router.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-app-router.d.ts","sourceRoot":"","sources":["../../../src/lib/shared/next-app-router.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AACnC,OAAO,KAAK,UAAU,MAAM,4BAA4B,CAAC;AAEzD,OAAO,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,KAAK,QAAQ,MAAM,+BAA+B,CAAC;AAE1D,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,MAAM,OAAO,GAAG;IACpB,WAAW,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,QAAQ,C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ChC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,OAAO,EACd,QAAQ,UAAQ;;EAkGjB"}
|
|
@@ -8,11 +8,11 @@ const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
|
8
8
|
const cdk = tslib_1.__importStar(require("aws-cdk-lib"));
|
|
9
9
|
const cloudfront = tslib_1.__importStar(require("aws-cdk-lib/aws-cloudfront"));
|
|
10
10
|
const cloudfrontOrigin = tslib_1.__importStar(require("aws-cdk-lib/aws-cloudfront-origins"));
|
|
11
|
-
const s3 = tslib_1.__importStar(require("aws-cdk-lib/aws-s3"));
|
|
12
11
|
const s3Deploy = tslib_1.__importStar(require("aws-cdk-lib/aws-s3-deployment"));
|
|
13
12
|
const ssm = tslib_1.__importStar(require("aws-cdk-lib/aws-ssm"));
|
|
14
13
|
function filesFromSSm(scope, reference) {
|
|
15
14
|
return {
|
|
15
|
+
artifact: ssm.StringParameter.fromStringParameterName(scope, 'ArtifactStorage', `/${reference}/artifacts`).stringValue,
|
|
16
16
|
publicFiles: {
|
|
17
17
|
key: ssm.StringParameter.fromStringParameterName(scope, 'PublicFiles', `/${reference}/files/publicFiles/key`).stringValue,
|
|
18
18
|
},
|
|
@@ -21,36 +21,20 @@ function filesFromSSm(scope, reference) {
|
|
|
21
21
|
},
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
function staticDeployment(app, output) {
|
|
25
|
-
const staticBucket = new s3.Bucket(app, `StaticBucket`, {
|
|
26
|
-
removalPolicy: cdk.RemovalPolicy.DESTROY,
|
|
27
|
-
autoDeleteObjects: true,
|
|
28
|
-
blockPublicAccess: s3.BlockPublicAccess.BLOCK_ACLS_ONLY,
|
|
29
|
-
publicReadAccess: true,
|
|
30
|
-
websiteIndexDocument: 'index.html',
|
|
31
|
-
websiteErrorDocument: 'index.html',
|
|
32
|
-
cors: [
|
|
33
|
-
{
|
|
34
|
-
allowedHeaders: ['*'],
|
|
35
|
-
allowedOrigins: ['*'],
|
|
36
|
-
allowedMethods: [s3.HttpMethods.GET, s3.HttpMethods.HEAD],
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
});
|
|
24
|
+
function staticDeployment(app, bucket, output) {
|
|
40
25
|
const staticFiles = s3Deploy.Source.asset(node_path_1.default.join(output, '/.next/static'));
|
|
41
26
|
const publicFiles = s3Deploy.Source.asset(node_path_1.default.join(output, '/public'));
|
|
42
27
|
const staticDeployment = new s3Deploy.BucketDeployment(app, `StaticAssetDeployment`, {
|
|
43
|
-
destinationBucket:
|
|
28
|
+
destinationBucket: bucket,
|
|
44
29
|
sources: [staticFiles],
|
|
45
30
|
destinationKeyPrefix: 'assets/static',
|
|
46
31
|
retainOnDelete: false,
|
|
47
32
|
extract: false,
|
|
48
33
|
});
|
|
49
34
|
const publicDeployment = new s3Deploy.BucketDeployment(app, `PublicAssetDeployment`, {
|
|
50
|
-
destinationBucket:
|
|
35
|
+
destinationBucket: bucket,
|
|
51
36
|
sources: [publicFiles],
|
|
52
37
|
destinationKeyPrefix: 'assets/public',
|
|
53
|
-
prune: false,
|
|
54
38
|
retainOnDelete: false,
|
|
55
39
|
extract: false,
|
|
56
40
|
});
|
|
@@ -73,29 +57,13 @@ function staticDeployment(app, output) {
|
|
|
73
57
|
if (!files.publicFiles || !files.staticFiles) {
|
|
74
58
|
throw new Error('Failed to deploy static and public files');
|
|
75
59
|
}
|
|
76
|
-
return {
|
|
60
|
+
return { files };
|
|
77
61
|
}
|
|
78
|
-
function cloudfrontBehaviours(
|
|
62
|
+
function cloudfrontBehaviours(scope, staticBucket, serverOrigin, basePath, files, isLambda = false) {
|
|
79
63
|
const strippedBasePath = basePath.replace(/^\/+|\/+$/g, '');
|
|
80
|
-
if (files.staticFiles) {
|
|
81
|
-
const staticFiles = s3Deploy.Source.bucket(staticBucket, files.staticFiles.key);
|
|
82
|
-
const deployment = new s3Deploy.BucketDeployment(app, `${strippedBasePath}StaticDeployment`, {
|
|
83
|
-
prune: false,
|
|
84
|
-
destinationBucket: staticBucket,
|
|
85
|
-
sources: [staticFiles],
|
|
86
|
-
destinationKeyPrefix: strippedBasePath
|
|
87
|
-
? `${strippedBasePath}/_next/static/`
|
|
88
|
-
: '_next/static/',
|
|
89
|
-
retainOnDelete: false,
|
|
90
|
-
});
|
|
91
|
-
if (files.staticFiles.deployment) {
|
|
92
|
-
deployment.node.addDependency(files.staticFiles.deployment);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
64
|
if (files.publicFiles) {
|
|
96
|
-
const publicFiles = s3Deploy.Source.bucket(
|
|
97
|
-
const deployment = new s3Deploy.BucketDeployment(
|
|
98
|
-
prune: false,
|
|
65
|
+
const publicFiles = s3Deploy.Source.bucket(files.artifactBucket, files.publicFiles.key);
|
|
66
|
+
const deployment = new s3Deploy.BucketDeployment(scope, `${strippedBasePath}PublicDeployment`, {
|
|
99
67
|
destinationBucket: staticBucket,
|
|
100
68
|
sources: [publicFiles],
|
|
101
69
|
destinationKeyPrefix: strippedBasePath
|
|
@@ -107,6 +75,20 @@ function cloudfrontBehaviours(app, staticBucket, serverOrigin, basePath, files,
|
|
|
107
75
|
deployment.node.addDependency(files.publicFiles.deployment);
|
|
108
76
|
}
|
|
109
77
|
}
|
|
78
|
+
if (files.staticFiles) {
|
|
79
|
+
const staticFiles = s3Deploy.Source.bucket(files.artifactBucket, files.staticFiles.key);
|
|
80
|
+
const deployment = new s3Deploy.BucketDeployment(scope, `${strippedBasePath}StaticDeployment`, {
|
|
81
|
+
destinationBucket: staticBucket,
|
|
82
|
+
sources: [staticFiles],
|
|
83
|
+
destinationKeyPrefix: strippedBasePath
|
|
84
|
+
? `${strippedBasePath}/_next/static/`
|
|
85
|
+
: '_next/static/',
|
|
86
|
+
retainOnDelete: false,
|
|
87
|
+
});
|
|
88
|
+
if (files.staticFiles.deployment) {
|
|
89
|
+
deployment.node.addDependency(files.staticFiles.deployment);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
110
92
|
const staticOrigin = new cloudfrontOrigin.S3StaticWebsiteOrigin(staticBucket);
|
|
111
93
|
const staticBehavior = {
|
|
112
94
|
origin: staticOrigin,
|
|
@@ -116,8 +98,8 @@ function cloudfrontBehaviours(app, staticBucket, serverOrigin, basePath, files,
|
|
|
116
98
|
compress: true,
|
|
117
99
|
viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
|
|
118
100
|
};
|
|
119
|
-
const imageCachePolicyID = ssm.StringParameter.fromStringParameterName(
|
|
120
|
-
const imageCachePolicy = cloudfront.CachePolicy.fromCachePolicyId(
|
|
101
|
+
const imageCachePolicyID = ssm.StringParameter.fromStringParameterName(scope, 'NextAppRouterImagePolicyArn', '/fy-stack/ImagePolicyID');
|
|
102
|
+
const imageCachePolicy = cloudfront.CachePolicy.fromCachePolicyId(scope, 'ImagePolicy', imageCachePolicyID.stringValue);
|
|
121
103
|
const appBehaviour = {
|
|
122
104
|
origin: serverOrigin,
|
|
123
105
|
cachePolicy: cloudfront.CachePolicy.CACHING_DISABLED,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"params-from-attachable.d.ts","sourceRoot":"","sources":["../../../src/lib/shared/params-from-attachable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;;IAS1E"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.paramsFromAttachable = paramsFromAttachable;
|
|
4
|
+
function paramsFromAttachable(attachable) {
|
|
5
|
+
return Object.entries(attachable).map(([key, val]) => {
|
|
6
|
+
return Object.fromEntries(Object.entries(val?.attachable() ?? {}).map(([subKey, subVal]) => [
|
|
7
|
+
`${key}_${subKey}`.toUpperCase(),
|
|
8
|
+
subVal,
|
|
9
|
+
]));
|
|
10
|
+
});
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-bucket.d.ts","sourceRoot":"","sources":["../../../src/lib/shared/public-bucket.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,aAgBxD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.publicBucket = publicBucket;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const s3 = tslib_1.__importStar(require("aws-cdk-lib/aws-s3"));
|
|
6
|
+
const cdk = tslib_1.__importStar(require("aws-cdk-lib"));
|
|
7
|
+
function publicBucket(scope, id) {
|
|
8
|
+
return new s3.Bucket(scope, id, {
|
|
9
|
+
removalPolicy: cdk.RemovalPolicy.DESTROY,
|
|
10
|
+
autoDeleteObjects: true,
|
|
11
|
+
blockPublicAccess: s3.BlockPublicAccess.BLOCK_ACLS_ONLY,
|
|
12
|
+
publicReadAccess: true,
|
|
13
|
+
websiteIndexDocument: 'index.html',
|
|
14
|
+
websiteErrorDocument: 'index.html',
|
|
15
|
+
cors: [
|
|
16
|
+
{
|
|
17
|
+
allowedHeaders: ['*'],
|
|
18
|
+
allowedOrigins: ['*'],
|
|
19
|
+
allowedMethods: [s3.HttpMethods.GET, s3.HttpMethods.HEAD],
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
});
|
|
23
|
+
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Construct } from 'constructs';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
2
|
+
import type { StandaloneApp } from './types';
|
|
3
|
+
import type { DockerImageAssetOptions } from 'aws-cdk-lib/aws-ecr-assets';
|
|
4
|
+
export type ImageAppProps = StandaloneApp & {
|
|
5
|
+
container?: DockerImageAssetOptions;
|
|
6
|
+
};
|
|
4
7
|
export declare class ImageAppContainer extends Construct {
|
|
5
8
|
constructor(scope: Construct, id: string, props: ImageAppProps);
|
|
6
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-app-container.d.ts","sourceRoot":"","sources":["../../../src/lib/standalone/image-app-container.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"image-app-container.d.ts","sourceRoot":"","sources":["../../../src/lib/standalone/image-app-container.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAE1E,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG;IAC1C,SAAS,CAAC,EAAE,uBAAuB,CAAC;CACrC,CAAC;AAEF,qBAAa,iBAAkB,SAAQ,SAAS;gBAClC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa;CAiC/D"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Construct } from 'constructs';
|
|
2
|
+
import type { StandaloneApp } from './types';
|
|
3
|
+
export type NextAppRouterProps = StandaloneApp & {
|
|
4
|
+
cmd: string;
|
|
5
|
+
};
|
|
6
|
+
export declare class NextAppRouterCode extends Construct {
|
|
7
|
+
constructor(scope: Construct, id: string, props: NextAppRouterProps);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=next-app-router-code.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next-app-router-code.d.ts","sourceRoot":"","sources":["../../../src/lib/standalone/next-app-router-code.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAK7C,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG;IAC/C,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,qBAAa,iBAAkB,SAAQ,SAAS;gBAClC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB;CAoDpE"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NextAppRouterCode = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const cdk = tslib_1.__importStar(require("aws-cdk-lib"));
|
|
6
|
+
const s3 = tslib_1.__importStar(require("aws-cdk-lib/aws-s3"));
|
|
7
|
+
const ssm = tslib_1.__importStar(require("aws-cdk-lib/aws-ssm"));
|
|
8
|
+
const constructs_1 = require("constructs");
|
|
9
|
+
const next_app_router_1 = require("../shared/next-app-router");
|
|
10
|
+
const code_deployment_1 = require("../shared/code-deployment");
|
|
11
|
+
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
12
|
+
const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
|
|
13
|
+
class NextAppRouterCode extends constructs_1.Construct {
|
|
14
|
+
constructor(scope, id, props) {
|
|
15
|
+
super(scope, id);
|
|
16
|
+
const stackName = cdk.Stack.of(this).stackName;
|
|
17
|
+
const artifactBucket = new s3.Bucket(this, 'ArtifactStorage', {
|
|
18
|
+
removalPolicy: cdk.RemovalPolicy.DESTROY,
|
|
19
|
+
autoDeleteObjects: true,
|
|
20
|
+
});
|
|
21
|
+
const deployment = (0, next_app_router_1.staticDeployment)(this, artifactBucket, props.output);
|
|
22
|
+
const serverOutput = node_path_1.default.join(props.output, '/.next/standalone');
|
|
23
|
+
node_fs_1.default.writeFileSync(node_path_1.default.join(serverOutput, 'run.sh'), props.cmd);
|
|
24
|
+
const code = (0, code_deployment_1.codeDeployment)(this, artifactBucket, serverOutput, props.version);
|
|
25
|
+
new ssm.StringParameter(this, 'RepositoryParam', {
|
|
26
|
+
parameterName: `/${stackName}/artifacts`,
|
|
27
|
+
stringValue: artifactBucket.bucketName,
|
|
28
|
+
});
|
|
29
|
+
new ssm.StringParameter(this, 'TagParam', {
|
|
30
|
+
parameterName: `/${stackName}/tag`,
|
|
31
|
+
stringValue: props.version,
|
|
32
|
+
});
|
|
33
|
+
new ssm.StringParameter(this, 'CodeFilesKeyParam', {
|
|
34
|
+
parameterName: `/${stackName}/code`,
|
|
35
|
+
stringValue: code,
|
|
36
|
+
});
|
|
37
|
+
new ssm.StringParameter(this, 'CodeFilesKeyParam', {
|
|
38
|
+
parameterName: `/${stackName}/code/handler`,
|
|
39
|
+
stringValue: 'run.sh',
|
|
40
|
+
});
|
|
41
|
+
new ssm.StringParameter(this, 'StaticFilesKeyParam', {
|
|
42
|
+
parameterName: `/${stackName}/files/staticFiles/key`,
|
|
43
|
+
stringValue: deployment.files.staticFiles.key,
|
|
44
|
+
});
|
|
45
|
+
new ssm.StringParameter(this, 'PublicFilesKeyParam', {
|
|
46
|
+
parameterName: `/${stackName}/files/publicFiles/key`,
|
|
47
|
+
stringValue: deployment.files.publicFiles.key,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.NextAppRouterCode = NextAppRouterCode;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Construct } from 'constructs';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
2
|
+
import type { StandaloneApp } from './types';
|
|
3
|
+
import type { DockerImageAssetOptions } from 'aws-cdk-lib/aws-ecr-assets';
|
|
4
|
+
export type NextAppRouterProps = StandaloneApp & {
|
|
5
|
+
container?: DockerImageAssetOptions;
|
|
6
|
+
};
|
|
4
7
|
export declare class NextAppRouterContainer extends Construct {
|
|
5
8
|
constructor(scope: Construct, id: string, props: NextAppRouterProps);
|
|
6
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-app-router-container.d.ts","sourceRoot":"","sources":["../../../src/lib/standalone/next-app-router-container.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"next-app-router-container.d.ts","sourceRoot":"","sources":["../../../src/lib/standalone/next-app-router-container.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAE1E,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG;IAC/C,SAAS,CAAC,EAAE,uBAAuB,CAAC;CACrC,CAAC;AAEF,qBAAa,sBAAuB,SAAQ,SAAS;gBACvC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB;CAuDpE"}
|
|
@@ -4,6 +4,7 @@ exports.NextAppRouterContainer = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const cdk = tslib_1.__importStar(require("aws-cdk-lib"));
|
|
6
6
|
const ecr = tslib_1.__importStar(require("aws-cdk-lib/aws-ecr"));
|
|
7
|
+
const s3 = tslib_1.__importStar(require("aws-cdk-lib/aws-s3"));
|
|
7
8
|
const ecrAssets = tslib_1.__importStar(require("aws-cdk-lib/aws-ecr-assets"));
|
|
8
9
|
const ssm = tslib_1.__importStar(require("aws-cdk-lib/aws-ssm"));
|
|
9
10
|
const ecrDeployment = tslib_1.__importStar(require("cdk-ecr-deployment"));
|
|
@@ -17,12 +18,16 @@ class NextAppRouterContainer extends constructs_1.Construct {
|
|
|
17
18
|
emptyOnDelete: true,
|
|
18
19
|
removalPolicy: cdk.RemovalPolicy.DESTROY,
|
|
19
20
|
});
|
|
21
|
+
const artifactBucket = new s3.Bucket(this, 'ArtifactStorage', {
|
|
22
|
+
removalPolicy: cdk.RemovalPolicy.DESTROY,
|
|
23
|
+
autoDeleteObjects: true,
|
|
24
|
+
});
|
|
20
25
|
const container = new ecrAssets.DockerImageAsset(this, 'ContainerAsset', {
|
|
21
26
|
directory: props.output,
|
|
22
27
|
platform: ecrAssets.Platform.LINUX_AMD64,
|
|
23
28
|
...props.container,
|
|
24
29
|
});
|
|
25
|
-
const deployment = (0, next_app_router_1.staticDeployment)(this, props.output);
|
|
30
|
+
const deployment = (0, next_app_router_1.staticDeployment)(this, artifactBucket, props.output);
|
|
26
31
|
new ecrDeployment.ECRDeployment(this, 'DeployedContainer', {
|
|
27
32
|
src: new ecrDeployment.DockerImageName(container.imageUri),
|
|
28
33
|
dest: new ecrDeployment.DockerImageName(cdk.Fn.join(':', [repo.repositoryUri, props.version])),
|
|
@@ -31,6 +36,10 @@ class NextAppRouterContainer extends constructs_1.Construct {
|
|
|
31
36
|
parameterName: `/${stackName}/repository`,
|
|
32
37
|
stringValue: repo.repositoryName,
|
|
33
38
|
});
|
|
39
|
+
new ssm.StringParameter(this, 'RepositoryParam', {
|
|
40
|
+
parameterName: `/${stackName}/artifacts`,
|
|
41
|
+
stringValue: artifactBucket.bucketName,
|
|
42
|
+
});
|
|
34
43
|
new ssm.StringParameter(this, 'TagParam', {
|
|
35
44
|
parameterName: `/${stackName}/tag`,
|
|
36
45
|
stringValue: props.version,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/standalone/types.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/standalone/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-bucket.d.ts","sourceRoot":"","sources":["../../../src/lib/util/public-bucket.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,aAgBxD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.publicBucket = publicBucket;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const s3 = tslib_1.__importStar(require("aws-cdk-lib/aws-s3"));
|
|
6
|
+
const cdk = tslib_1.__importStar(require("aws-cdk-lib"));
|
|
7
|
+
function publicBucket(scope, id) {
|
|
8
|
+
return new s3.Bucket(scope, id, {
|
|
9
|
+
removalPolicy: cdk.RemovalPolicy.DESTROY,
|
|
10
|
+
autoDeleteObjects: true,
|
|
11
|
+
blockPublicAccess: s3.BlockPublicAccess.BLOCK_ACLS_ONLY,
|
|
12
|
+
publicReadAccess: true,
|
|
13
|
+
websiteIndexDocument: 'index.html',
|
|
14
|
+
websiteErrorDocument: 'index.html',
|
|
15
|
+
cors: [
|
|
16
|
+
{
|
|
17
|
+
allowedHeaders: ['*'],
|
|
18
|
+
allowedOrigins: ['*'],
|
|
19
|
+
allowedMethods: [s3.HttpMethods.GET, s3.HttpMethods.HEAD],
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
});
|
|
23
|
+
}
|
package/package.json
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fy-stack/app-construct",
|
|
3
|
-
"version": "0.0.147-alpha.
|
|
3
|
+
"version": "0.0.147-alpha.3065",
|
|
4
4
|
"repository": "https://github.com/festusyuma/fy-stack",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@fy-stack/types": "0.0.147-alpha.
|
|
6
|
+
"@fy-stack/types": "0.0.147-alpha.3065",
|
|
7
7
|
"tslib": "^2.3.0",
|
|
8
8
|
"zod": "^4.3.6"
|
|
9
9
|
},
|
|
10
10
|
"peerDependencies": {
|
|
11
|
-
"
|
|
12
|
-
"constructs": "^10.4.4",
|
|
13
|
-
"cdk-ecr-deployment": "^4.1.2"
|
|
11
|
+
"constructs": "^10.4.4"
|
|
14
12
|
},
|
|
15
13
|
"main": "./dist/index.js",
|
|
16
14
|
"module": "./dist/index.mjs",
|