@fy-stack/app-construct 0.0.143 → 0.0.144
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/lib/ecs/apps/task-construct.d.ts +1 -1
- package/dist/lib/ecs/apps/task-construct.d.ts.map +1 -1
- package/dist/lib/ecs/apps/task-construct.js +7 -7
- package/dist/lib/ecs/ecs-server-construct.d.ts +5 -2
- package/dist/lib/ecs/ecs-server-construct.d.ts.map +1 -1
- package/dist/lib/ecs/ecs-server-construct.js +6 -6
- package/dist/lib/lambda/apps/next-app-router-construct.js +1 -1
- package/package.json +2 -2
|
@@ -6,7 +6,7 @@ import { Construct } from 'constructs';
|
|
|
6
6
|
import { TaskConstructsProps } from '../types';
|
|
7
7
|
export declare class TaskConstruct extends Construct implements EventResource, Grant, Attach {
|
|
8
8
|
private props;
|
|
9
|
-
|
|
9
|
+
definition: ecs.FargateTaskDefinition;
|
|
10
10
|
constructor(scope: Construct, id: string, props: TaskConstructsProps);
|
|
11
11
|
subscription(props: snsSubscription.SubscriptionProps): sns.ITopicSubscription;
|
|
12
12
|
grant(...grantables: Grantable[]): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-construct.d.ts","sourceRoot":"","sources":["../../../../src/lib/ecs/apps/task-construct.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,UAAU,EACV,aAAa,EACb,KAAK,EACL,SAAS,EACV,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAI3C,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,KAAK,eAAe,MAAM,mCAAmC,CAAC;AAErE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,qBAAa,aACX,SAAQ,SACR,YAAW,aAAa,EAAE,KAAK,EAAE,MAAM;IAOrC,OAAO,CAAC,KAAK;IALR,
|
|
1
|
+
{"version":3,"file":"task-construct.d.ts","sourceRoot":"","sources":["../../../../src/lib/ecs/apps/task-construct.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,UAAU,EACV,aAAa,EACb,KAAK,EACL,SAAS,EACV,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAI3C,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,KAAK,eAAe,MAAM,mCAAmC,CAAC;AAErE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,qBAAa,aACX,SAAQ,SACR,YAAW,aAAa,EAAE,KAAK,EAAE,MAAM;IAOrC,OAAO,CAAC,KAAK;IALR,UAAU,EAAE,GAAG,CAAC,qBAAqB,CAAC;gBAG3C,KAAK,EAAE,SAAS,EAChB,EAAE,EAAE,MAAM,EACF,KAAK,EAAE,mBAAmB;IAgCpC,YAAY,CACV,KAAK,EAAE,eAAe,CAAC,iBAAiB,GACvC,GAAG,CAAC,kBAAkB;IA6CzB,KAAK,CAAC,GAAG,UAAU,EAAE,SAAS,EAAE,GAAG,IAAI;IAMvC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;IAS7C,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO;CAG7B"}
|
|
@@ -13,12 +13,12 @@ const constructs_1 = require("constructs");
|
|
|
13
13
|
const params_from_attachable_1 = require("../../util/params-from-attachable");
|
|
14
14
|
class TaskConstruct extends constructs_1.Construct {
|
|
15
15
|
props;
|
|
16
|
-
|
|
16
|
+
definition;
|
|
17
17
|
constructor(scope, id, props) {
|
|
18
18
|
super(scope, id);
|
|
19
19
|
this.props = props;
|
|
20
20
|
const { container, output, ...definitionProps } = props;
|
|
21
|
-
this.
|
|
21
|
+
this.definition = new ecs.FargateTaskDefinition(this, 'Task', {
|
|
22
22
|
cpu: 256,
|
|
23
23
|
memoryLimitMiB: 512,
|
|
24
24
|
runtimePlatform: {
|
|
@@ -28,7 +28,7 @@ class TaskConstruct extends constructs_1.Construct {
|
|
|
28
28
|
});
|
|
29
29
|
if (container) {
|
|
30
30
|
const { image: imageProps, logDuration, ...containerProps } = container;
|
|
31
|
-
this.
|
|
31
|
+
this.definition.addContainer('DefaultImage', {
|
|
32
32
|
image: ecs.ContainerImage.fromAsset(output, {
|
|
33
33
|
platform: ecrAssets.Platform.LINUX_AMD64,
|
|
34
34
|
...imageProps,
|
|
@@ -53,7 +53,7 @@ class TaskConstruct extends constructs_1.Construct {
|
|
|
53
53
|
desiredState: 'RUNNING',
|
|
54
54
|
targetParameters: {
|
|
55
55
|
ecsTaskParameters: {
|
|
56
|
-
taskDefinitionArn: this.
|
|
56
|
+
taskDefinitionArn: this.definition.taskDefinitionArn,
|
|
57
57
|
launchType: 'FARGATE',
|
|
58
58
|
networkConfiguration: {
|
|
59
59
|
awsvpcConfiguration: {
|
|
@@ -76,7 +76,7 @@ class TaskConstruct extends constructs_1.Construct {
|
|
|
76
76
|
},
|
|
77
77
|
});
|
|
78
78
|
queue.grantConsumeMessages(pipeRole);
|
|
79
|
-
this.
|
|
79
|
+
this.definition.grantRun(pipeRole);
|
|
80
80
|
return new snsSubscription.SqsSubscription(queue, {
|
|
81
81
|
...props,
|
|
82
82
|
rawMessageDelivery: true,
|
|
@@ -84,14 +84,14 @@ class TaskConstruct extends constructs_1.Construct {
|
|
|
84
84
|
}
|
|
85
85
|
grant(...grantables) {
|
|
86
86
|
for (const i in grantables) {
|
|
87
|
-
grantables[i].grantable(this.
|
|
87
|
+
grantables[i].grantable(this.definition.taskRole);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
attach(attachable) {
|
|
91
91
|
const params = {};
|
|
92
92
|
Object.assign(params, ...(0, params_from_attachable_1.paramsFromAttachable)(attachable));
|
|
93
93
|
for (const i in params) {
|
|
94
|
-
this.
|
|
94
|
+
this.definition.defaultContainer?.addEnvironment(i, params[i]);
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
static parse(params) {
|
|
@@ -13,8 +13,11 @@ type EcsServerConstructProps = EcsConstructProps['server'] & {
|
|
|
13
13
|
export declare class EcsServerConstruct extends Construct implements Grant {
|
|
14
14
|
private props;
|
|
15
15
|
apps: Record<string, AppConstruct>;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
definition: ecs.TaskDefinition;
|
|
17
|
+
loadBalancer?: {
|
|
18
|
+
alb: elbV2.IApplicationLoadBalancer;
|
|
19
|
+
listener: elbV2.IApplicationListener;
|
|
20
|
+
};
|
|
18
21
|
constructor(scope: Construct, id: string, props: EcsServerConstructProps);
|
|
19
22
|
grant(...grantables: Grantable[]): void;
|
|
20
23
|
private serverOrigin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecs-server-construct.d.ts","sourceRoot":"","sources":["../../../src/lib/ecs/ecs-server-construct.ts"],"names":[],"mappings":"AAGA,OAAO,EAAW,KAAK,EAAE,SAAS,EAAgB,MAAM,iBAAiB,CAAC;AAG1E,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,KAAK,KAAK,MAAM,wCAAwC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAO1D,KAAK,uBAAuB,GAAG,iBAAiB,CAAC,QAAQ,CAAC,GAAG;IAC3D,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC;CACtB,CAAC;AAEF,qBAAa,kBAAmB,SAAQ,SA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c,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;CA+CxC"}
|
|
@@ -20,7 +20,7 @@ const AppBuilds = {
|
|
|
20
20
|
class EcsServerConstruct extends constructs_1.Construct {
|
|
21
21
|
props;
|
|
22
22
|
apps = {};
|
|
23
|
-
|
|
23
|
+
definition;
|
|
24
24
|
loadBalancer;
|
|
25
25
|
constructor(scope, id, props) {
|
|
26
26
|
super(scope, id);
|
|
@@ -29,7 +29,7 @@ class EcsServerConstruct extends constructs_1.Construct {
|
|
|
29
29
|
vpc: props.vpc,
|
|
30
30
|
});
|
|
31
31
|
const { definition, apps, cluster, ...serverProps } = props;
|
|
32
|
-
this.
|
|
32
|
+
this.definition = new ecs.FargateTaskDefinition(this, 'ServerTaskDefinition', {
|
|
33
33
|
cpu: 256,
|
|
34
34
|
memoryLimitMiB: 512,
|
|
35
35
|
runtimePlatform: {
|
|
@@ -40,7 +40,7 @@ class EcsServerConstruct extends constructs_1.Construct {
|
|
|
40
40
|
});
|
|
41
41
|
const service = new ecs.FargateService(this, 'ServerService', {
|
|
42
42
|
cluster,
|
|
43
|
-
taskDefinition: this.
|
|
43
|
+
taskDefinition: this.definition,
|
|
44
44
|
capacityProviderStrategies: [{ capacityProvider: 'FARGATE', weight: 1 }],
|
|
45
45
|
desiredCount: 1,
|
|
46
46
|
vpcSubnets: {
|
|
@@ -62,7 +62,7 @@ class EcsServerConstruct extends constructs_1.Construct {
|
|
|
62
62
|
environmentPath: props.environmentPath,
|
|
63
63
|
buildParams: AppTypeConstruct.parse(app.buildParams ?? {}),
|
|
64
64
|
serverOrigin,
|
|
65
|
-
taskDefinition: this.
|
|
65
|
+
taskDefinition: this.definition,
|
|
66
66
|
...app,
|
|
67
67
|
}),
|
|
68
68
|
];
|
|
@@ -70,7 +70,7 @@ class EcsServerConstruct extends constructs_1.Construct {
|
|
|
70
70
|
}
|
|
71
71
|
grant(...grantables) {
|
|
72
72
|
for (const i in grantables) {
|
|
73
|
-
grantables[i].grantable(this.
|
|
73
|
+
grantables[i].grantable(this.definition.taskRole);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
serverOrigin(service, port, containerName, appPath, healthPath) {
|
|
@@ -127,7 +127,7 @@ class EcsServerConstruct extends constructs_1.Construct {
|
|
|
127
127
|
const configPath = './fy-stack.context.json';
|
|
128
128
|
let config = {};
|
|
129
129
|
let priorityRage = [0, 1000];
|
|
130
|
-
if (this.props.loadBalancer &&
|
|
130
|
+
if (this.props.loadBalancer && 'priorityRange' in this.props.loadBalancer) {
|
|
131
131
|
priorityRage = this.props.loadBalancer.priorityRange;
|
|
132
132
|
}
|
|
133
133
|
let priority = priorityRage[0];
|
|
@@ -23,7 +23,7 @@ class NextAppRouterConstruct extends constructs_1.Construct {
|
|
|
23
23
|
super(scope, id);
|
|
24
24
|
const region = cdk.Stack.of(this).region;
|
|
25
25
|
this.static = (0, next_app_router_1.staticDeployment)(this, props.output);
|
|
26
|
-
const webAdapterLayer = lambda.LayerVersion.fromLayerVersionArn(this, 'WebAdapterLayer', `arn:aws:lambda:${region}:753240598075:layer:LambdaAdapterLayerX86:
|
|
26
|
+
const webAdapterLayer = lambda.LayerVersion.fromLayerVersionArn(this, 'WebAdapterLayer', `arn:aws:lambda:${region}:753240598075:layer:LambdaAdapterLayerX86:25`);
|
|
27
27
|
const environment = {
|
|
28
28
|
AWS_LAMBDA_EXEC_WRAPPER: '/opt/bootstrap',
|
|
29
29
|
PORT: '8080',
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fy-stack/app-construct",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.144",
|
|
4
4
|
"repository": "https://github.com/festusyuma/fy-stack",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@fy-stack/types": "0.0.
|
|
6
|
+
"@fy-stack/types": "0.0.144",
|
|
7
7
|
"tslib": "^2.3.0",
|
|
8
8
|
"zod": "^3.24.1"
|
|
9
9
|
},
|