sst 2.40.7 → 2.41.0
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/constructs/NextjsSite.js +1 -1
- package/constructs/Service.d.ts +19 -3
- package/constructs/Service.js +14 -8
- package/package.json +9 -9
package/constructs/NextjsSite.js
CHANGED
|
@@ -20,7 +20,7 @@ import { useFunctions } from "./Function.js";
|
|
|
20
20
|
import { useDeferredTasks } from "./deferred_task.js";
|
|
21
21
|
import { Logger } from "../logger.js";
|
|
22
22
|
const LAYER_VERSION = "2";
|
|
23
|
-
const DEFAULT_OPEN_NEXT_VERSION = "2.3.
|
|
23
|
+
const DEFAULT_OPEN_NEXT_VERSION = "2.3.7";
|
|
24
24
|
const DEFAULT_CACHE_POLICY_ALLOWED_HEADERS = [
|
|
25
25
|
"accept",
|
|
26
26
|
"rsc",
|
package/constructs/Service.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { SSTConstruct } from "./Construct.js";
|
|
|
6
6
|
import { Permissions } from "./util/permission.js";
|
|
7
7
|
import { BindingProps, BindingResource } from "./util/binding.js";
|
|
8
8
|
import { IVpc } from "aws-cdk-lib/aws-ec2";
|
|
9
|
-
import {
|
|
9
|
+
import { ContainerDefinitionOptions, CpuArchitecture, FargateService, FargateTaskDefinition, FargateServiceProps, ICluster } from "aws-cdk-lib/aws-ecs";
|
|
10
10
|
import { RetentionDays } from "aws-cdk-lib/aws-logs";
|
|
11
11
|
import { ApplicationLoadBalancer, ApplicationLoadBalancerProps, ApplicationTargetGroupProps } from "aws-cdk-lib/aws-elasticloadbalancingv2";
|
|
12
12
|
declare const supportedCpus: {
|
|
@@ -399,7 +399,22 @@ export interface ServiceProps {
|
|
|
399
399
|
image?: ContainerDefinitionOptions["image"];
|
|
400
400
|
};
|
|
401
401
|
/**
|
|
402
|
-
*
|
|
402
|
+
* Create the service in an existing ECS cluster.
|
|
403
|
+
*
|
|
404
|
+
* @example
|
|
405
|
+
* ```js
|
|
406
|
+
* import { Cluster } from "aws-cdk-lib/aws-ecs";
|
|
407
|
+
*
|
|
408
|
+
* {
|
|
409
|
+
* cdk: {
|
|
410
|
+
* cluster: Cluster.fromClusterArn(stack, "Cluster", "arn:aws:ecs:us-east-1:123456789012:cluster/my-cluster"),
|
|
411
|
+
* }
|
|
412
|
+
* }
|
|
413
|
+
* ```
|
|
414
|
+
*/
|
|
415
|
+
cluster?: ICluster;
|
|
416
|
+
/**
|
|
417
|
+
* Create the service in the specified VPC. Note this will only work once deployed.
|
|
403
418
|
*
|
|
404
419
|
* @example
|
|
405
420
|
* ```js
|
|
@@ -463,7 +478,7 @@ export declare class Service extends Construct implements SSTConstruct {
|
|
|
463
478
|
*/
|
|
464
479
|
get cdk(): {
|
|
465
480
|
vpc: IVpc | undefined;
|
|
466
|
-
cluster:
|
|
481
|
+
cluster: ICluster | undefined;
|
|
467
482
|
fargateService: FargateService | undefined;
|
|
468
483
|
taskDefinition: FargateTaskDefinition | undefined;
|
|
469
484
|
distribution: import("aws-cdk-lib/aws-cloudfront").IDistribution | undefined;
|
|
@@ -519,6 +534,7 @@ export declare class Service extends Construct implements SSTConstruct {
|
|
|
519
534
|
private validateServiceExists;
|
|
520
535
|
private validateMemoryCpuAndStorage;
|
|
521
536
|
private createVpc;
|
|
537
|
+
private createCluster;
|
|
522
538
|
private createService;
|
|
523
539
|
private createLoadBalancer;
|
|
524
540
|
private createAutoScaling;
|
package/constructs/Service.js
CHANGED
|
@@ -175,7 +175,8 @@ export class Service extends Construct {
|
|
|
175
175
|
}
|
|
176
176
|
// Create ECS cluster
|
|
177
177
|
const vpc = this.createVpc();
|
|
178
|
-
const
|
|
178
|
+
const cluster = this.createCluster(vpc);
|
|
179
|
+
const { container, taskDefinition, service } = this.createService(cluster);
|
|
179
180
|
const { alb, target } = this.createLoadBalancer(vpc, service);
|
|
180
181
|
this.createAutoScaling(service, target);
|
|
181
182
|
this.alb = alb;
|
|
@@ -398,21 +399,26 @@ export class Service extends Construct {
|
|
|
398
399
|
natGateways: 1,
|
|
399
400
|
}));
|
|
400
401
|
}
|
|
401
|
-
|
|
402
|
-
|
|
402
|
+
createCluster(vpc) {
|
|
403
|
+
if (this.props.cdk?.cluster)
|
|
404
|
+
return this.props.cdk.cluster;
|
|
403
405
|
const app = this.node.root;
|
|
404
406
|
const clusterName = app.logicalPrefixedName(this.node.id);
|
|
407
|
+
return new Cluster(this, "Cluster", {
|
|
408
|
+
clusterName,
|
|
409
|
+
vpc,
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
createService(cluster) {
|
|
413
|
+
const { architecture, cpu, memory, storage, port, logRetention, cdk } = this.props;
|
|
414
|
+
const app = this.node.root;
|
|
405
415
|
const logGroup = new LogRetention(this, "LogRetention", {
|
|
406
|
-
logGroupName: `/sst/service/${clusterName}`,
|
|
416
|
+
logGroupName: `/sst/service/${cluster.clusterName}`,
|
|
407
417
|
retention: RetentionDays[logRetention.toUpperCase()],
|
|
408
418
|
logRetentionRetryOptions: {
|
|
409
419
|
maxRetries: 100,
|
|
410
420
|
},
|
|
411
421
|
});
|
|
412
|
-
const cluster = new Cluster(this, "Cluster", {
|
|
413
|
-
clusterName,
|
|
414
|
-
vpc,
|
|
415
|
-
});
|
|
416
422
|
const ephemeralStorageGiB = toCdkSize(storage).toGibibytes();
|
|
417
423
|
const taskDefinition = new FargateTaskDefinition(this, `TaskDefinition`, {
|
|
418
424
|
// @ts-expect-error
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"sideEffects": false,
|
|
3
3
|
"name": "sst",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.41.0",
|
|
5
5
|
"bin": {
|
|
6
6
|
"sst": "cli/sst.js"
|
|
7
7
|
},
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
},
|
|
26
26
|
"homepage": "https://sst.dev",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aws-cdk/aws-lambda-python-alpha": "2.
|
|
29
|
-
"@aws-cdk/cloud-assembly-schema": "2.
|
|
30
|
-
"@aws-cdk/cloudformation-diff": "2.
|
|
31
|
-
"@aws-cdk/cx-api": "2.
|
|
28
|
+
"@aws-cdk/aws-lambda-python-alpha": "2.132.1-alpha.0",
|
|
29
|
+
"@aws-cdk/cloud-assembly-schema": "2.132.1",
|
|
30
|
+
"@aws-cdk/cloudformation-diff": "2.132.1",
|
|
31
|
+
"@aws-cdk/cx-api": "2.132.1",
|
|
32
32
|
"@aws-crypto/sha256-js": "^5.2.0",
|
|
33
33
|
"@aws-sdk/client-cloudformation": "^3.454.0",
|
|
34
34
|
"@aws-sdk/client-ecs": "^3.454.0",
|
|
@@ -53,11 +53,11 @@
|
|
|
53
53
|
"@smithy/signature-v4": "^2.0.16",
|
|
54
54
|
"@trpc/server": "9.16.0",
|
|
55
55
|
"adm-zip": "^0.5.10",
|
|
56
|
-
"aws-cdk-lib": "2.
|
|
56
|
+
"aws-cdk-lib": "2.132.1",
|
|
57
57
|
"aws-iot-device-sdk": "^2.2.13",
|
|
58
58
|
"aws-sdk": "^2.1501.0",
|
|
59
59
|
"builtin-modules": "3.2.0",
|
|
60
|
-
"cdk-assets": "2.
|
|
60
|
+
"cdk-assets": "2.132.1",
|
|
61
61
|
"chalk": "^5.2.0",
|
|
62
62
|
"chokidar": "^3.5.3",
|
|
63
63
|
"ci-info": "^3.7.0",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"ora": "^6.1.2",
|
|
86
86
|
"react": "^18.0.0",
|
|
87
87
|
"remeda": "^1.3.0",
|
|
88
|
-
"sst-aws-cdk": "2.
|
|
88
|
+
"sst-aws-cdk": "2.132.1",
|
|
89
89
|
"tree-kill": "^1.2.2",
|
|
90
90
|
"undici": "^5.12.0",
|
|
91
91
|
"uuid": "^9.0.0",
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
"@types/ws": "^8.5.3",
|
|
119
119
|
"@types/yargs": "^17.0.13",
|
|
120
120
|
"archiver": "^5.3.1",
|
|
121
|
-
"astro-sst": "2.
|
|
121
|
+
"astro-sst": "2.41.0",
|
|
122
122
|
"async": "^3.2.4",
|
|
123
123
|
"tsx": "^3.12.1",
|
|
124
124
|
"typescript": "^5.2.2",
|