sst 2.45.0 → 2.45.2
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/cli/commands/deploy.js +5 -5
- package/cli/commands/remove.js +5 -5
- package/cli/commands/update.js +1 -1
- package/constructs/NextjsSite.js +6 -2
- package/constructs/Service.d.ts +9 -7
- package/constructs/Service.js +18 -10
- package/constructs/util/compareSemver.d.ts +1 -0
- package/constructs/util/compareSemver.js +17 -0
- package/package.json +2 -2
- package/support/bootstrap-metadata-function/index.mjs +607 -528
- package/support/bridge/live-lambda.mjs +54 -54
- package/support/custom-resources/index.mjs +772 -658
- package/support/event-bus-retrier/index.mjs +39 -39
- package/support/job-manager/index.mjs +605 -526
package/cli/commands/deploy.js
CHANGED
|
@@ -9,7 +9,7 @@ export const deploy = (program) => program.command("deploy [filter]", "Deploy yo
|
|
|
9
9
|
})
|
|
10
10
|
.positional("filter", {
|
|
11
11
|
type: "string",
|
|
12
|
-
describe: "Optionally filter stacks to deploy",
|
|
12
|
+
describe: "Optionally filter stacks to deploy using a regex pattern",
|
|
13
13
|
}), async (args) => {
|
|
14
14
|
const React = await import("react");
|
|
15
15
|
const { printDeploymentResults } = await import("../ui/deploy.js");
|
|
@@ -59,12 +59,12 @@ export const deploy = (program) => program.command("deploy [filter]", "Deploy yo
|
|
|
59
59
|
Colors.line(` ${Colors.bold("Region:")} ${project.config.region}`);
|
|
60
60
|
Colors.line(` ${Colors.bold("Account:")} ${identity.Account}`);
|
|
61
61
|
Colors.gap();
|
|
62
|
-
const
|
|
63
|
-
|
|
62
|
+
const filter = !!args.filter && new RegExp(args.filter, "i");
|
|
63
|
+
const isActiveStack = (stackId) => !filter ||
|
|
64
|
+
filter.test(stackId
|
|
64
65
|
.toLowerCase()
|
|
65
66
|
.replace(project.config.name.toLowerCase(), "")
|
|
66
|
-
.replace(project.config.stage.toLowerCase(), "")
|
|
67
|
-
.includes(args.filter.toLowerCase());
|
|
67
|
+
.replace(project.config.stage.toLowerCase(), ""));
|
|
68
68
|
// Generate cloud assembly
|
|
69
69
|
// - if --from is specified, we will use the existing cloud assembly
|
|
70
70
|
// - if --from is not specified, we will call synth to generate
|
package/cli/commands/remove.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const remove = (program) => program.command("remove [filter]", "Remove your app from AWS", (yargs) => yargs.option("from", { type: "string" }).positional("filter", {
|
|
2
2
|
type: "string",
|
|
3
|
-
describe: "Optionally filter stacks to remove",
|
|
3
|
+
describe: "Optionally filter stacks to remove using a regex pattern",
|
|
4
4
|
}), async (args) => {
|
|
5
5
|
const React = await import("react");
|
|
6
6
|
const { dim, blue, bold } = await import("colorette");
|
|
@@ -33,12 +33,12 @@ export const remove = (program) => program.command("remove [filter]", "Remove yo
|
|
|
33
33
|
mode: "remove",
|
|
34
34
|
});
|
|
35
35
|
})();
|
|
36
|
-
const
|
|
37
|
-
|
|
36
|
+
const filter = !!args.filter && new RegExp(args.filter, "i");
|
|
37
|
+
const target = assembly.stacks.filter((s) => !filter ||
|
|
38
|
+
filter.test(s.id
|
|
38
39
|
.toLowerCase()
|
|
39
40
|
.replace(project.config.name.toLowerCase(), "")
|
|
40
|
-
.replace(project.config.stage.toLowerCase(), "")
|
|
41
|
-
.includes(args.filter.toLowerCase()));
|
|
41
|
+
.replace(project.config.stage.toLowerCase(), "")));
|
|
42
42
|
if (!target.length) {
|
|
43
43
|
console.log(`No stacks found matching ${blue(args.filter)}`);
|
|
44
44
|
throw new SilentError(`No stacks found matching ${args.filter}`);
|
package/cli/commands/update.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const FIELDS = ["dependencies", "devDependencies"];
|
|
2
|
-
const SST_PKGS = ["sst", "
|
|
2
|
+
const SST_PKGS = ["sst", "svelte-kit-sst", "solid-start-sst"];
|
|
3
3
|
export const update = (program) => program.command("update [version]", "Update your SST and CDK packages", (yargs) => yargs.positional("version", {
|
|
4
4
|
type: "string",
|
|
5
5
|
describe: "Optionally specify a version to update to",
|
package/constructs/NextjsSite.js
CHANGED
|
@@ -9,12 +9,13 @@ import { Queue } from "aws-cdk-lib/aws-sqs";
|
|
|
9
9
|
import { SqsEventSource } from "aws-cdk-lib/aws-lambda-event-sources";
|
|
10
10
|
import { Stack } from "./Stack.js";
|
|
11
11
|
import { SsrSite, } from "./SsrSite.js";
|
|
12
|
+
import { compareSemver } from "./util/compareSemver.js";
|
|
12
13
|
import { toCdkSize } from "./util/size.js";
|
|
13
14
|
import { PolicyStatement } from "aws-cdk-lib/aws-iam";
|
|
14
15
|
import { RetentionDays } from "aws-cdk-lib/aws-logs";
|
|
15
16
|
import { VisibleError } from "../error.js";
|
|
16
17
|
import { Logger } from "../logger.js";
|
|
17
|
-
const DEFAULT_OPEN_NEXT_VERSION = "3.
|
|
18
|
+
const DEFAULT_OPEN_NEXT_VERSION = "3.2.2";
|
|
18
19
|
/**
|
|
19
20
|
* The `NextjsSite` construct is a higher level CDK construct that makes it easy to create a Next.js app.
|
|
20
21
|
* @example
|
|
@@ -35,11 +36,14 @@ export class NextjsSite extends SsrSite {
|
|
|
35
36
|
prerenderManifest;
|
|
36
37
|
openNextOutput;
|
|
37
38
|
constructor(scope, id, props = {}) {
|
|
39
|
+
const openNextVersion = props.openNextVersion ?? DEFAULT_OPEN_NEXT_VERSION;
|
|
38
40
|
super(scope, id, {
|
|
39
41
|
buildCommand: [
|
|
40
42
|
"npx",
|
|
41
43
|
"--yes",
|
|
42
|
-
|
|
44
|
+
`${compareSemver(openNextVersion, "3.1.3") <= 0
|
|
45
|
+
? "open-next"
|
|
46
|
+
: "@opennextjs/aws"}@${openNextVersion}`,
|
|
43
47
|
"build",
|
|
44
48
|
].join(" "),
|
|
45
49
|
...props,
|
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 { ContainerDefinitionOptions, CpuArchitecture, FargateService, FargateTaskDefinition, FargateServiceProps, ICluster } from "aws-cdk-lib/aws-ecs";
|
|
9
|
+
import { ContainerDefinitionOptions, CpuArchitecture, FargateService, FargateTaskDefinition, FargateServiceProps, ICluster, ScalableTaskCount } from "aws-cdk-lib/aws-ecs";
|
|
10
10
|
import { RetentionDays } from "aws-cdk-lib/aws-logs";
|
|
11
11
|
import { ApplicationLoadBalancer, ApplicationLoadBalancerProps, ApplicationTargetGroupProps, BaseApplicationListenerProps } from "aws-cdk-lib/aws-elasticloadbalancingv2";
|
|
12
12
|
declare const supportedCpus: {
|
|
@@ -119,7 +119,7 @@ export interface ServiceProps {
|
|
|
119
119
|
*/
|
|
120
120
|
maxContainers?: number;
|
|
121
121
|
/**
|
|
122
|
-
* Scales in or out to achieve a target cpu utilization.
|
|
122
|
+
* Scales in or out to achieve a target cpu utilization. Set to `false` to disable.
|
|
123
123
|
* @default 70
|
|
124
124
|
* @example
|
|
125
125
|
* ```js
|
|
@@ -131,9 +131,9 @@ export interface ServiceProps {
|
|
|
131
131
|
* }
|
|
132
132
|
*```
|
|
133
133
|
*/
|
|
134
|
-
cpuUtilization?: number;
|
|
134
|
+
cpuUtilization?: number | false;
|
|
135
135
|
/**
|
|
136
|
-
* Scales in or out to achieve a target memory utilization.
|
|
136
|
+
* Scales in or out to achieve a target memory utilization. Set to `false` to disable.
|
|
137
137
|
* @default 70
|
|
138
138
|
* @example
|
|
139
139
|
* ```js
|
|
@@ -145,9 +145,9 @@ export interface ServiceProps {
|
|
|
145
145
|
* }
|
|
146
146
|
*```
|
|
147
147
|
*/
|
|
148
|
-
memoryUtilization?: number;
|
|
148
|
+
memoryUtilization?: number | false;
|
|
149
149
|
/**
|
|
150
|
-
* Scales in or out to achieve a target request count per container.
|
|
150
|
+
* Scales in or out to achieve a target request count per container. Set to `false` to disable.
|
|
151
151
|
* @default 500
|
|
152
152
|
* @example
|
|
153
153
|
* ```js
|
|
@@ -158,7 +158,7 @@ export interface ServiceProps {
|
|
|
158
158
|
* }
|
|
159
159
|
*```
|
|
160
160
|
*/
|
|
161
|
-
requestsPerContainer?: number;
|
|
161
|
+
requestsPerContainer?: number | false;
|
|
162
162
|
};
|
|
163
163
|
/**
|
|
164
164
|
* Bind resources for the function
|
|
@@ -491,6 +491,7 @@ export declare class Service extends Construct implements SSTConstruct {
|
|
|
491
491
|
private service?;
|
|
492
492
|
private distribution?;
|
|
493
493
|
private alb?;
|
|
494
|
+
private scaling?;
|
|
494
495
|
constructor(scope: Construct, id: string, props: ServiceProps);
|
|
495
496
|
/**
|
|
496
497
|
* The CloudFront URL of the website.
|
|
@@ -513,6 +514,7 @@ export declare class Service extends Construct implements SSTConstruct {
|
|
|
513
514
|
applicationLoadBalancer: ApplicationLoadBalancer | undefined;
|
|
514
515
|
hostedZone: import("aws-cdk-lib/aws-route53").IHostedZone | undefined;
|
|
515
516
|
certificate: import("aws-cdk-lib/aws-certificatemanager").ICertificate | undefined;
|
|
517
|
+
scaling: ScalableTaskCount | undefined;
|
|
516
518
|
} | undefined;
|
|
517
519
|
getConstructMetadata(): {
|
|
518
520
|
type: "Service";
|
package/constructs/Service.js
CHANGED
|
@@ -149,6 +149,7 @@ export class Service extends Construct {
|
|
|
149
149
|
service;
|
|
150
150
|
distribution;
|
|
151
151
|
alb;
|
|
152
|
+
scaling;
|
|
152
153
|
constructor(scope, id, props) {
|
|
153
154
|
super(scope, id);
|
|
154
155
|
const app = scope.node.root;
|
|
@@ -178,7 +179,7 @@ export class Service extends Construct {
|
|
|
178
179
|
const cluster = this.createCluster(vpc);
|
|
179
180
|
const { container, taskDefinition, service } = this.createService(cluster);
|
|
180
181
|
const { alb, target } = this.createLoadBalancer(vpc, service);
|
|
181
|
-
this.createAutoScaling(service, target);
|
|
182
|
+
const scaling = this.createAutoScaling(service, target);
|
|
182
183
|
this.alb = alb;
|
|
183
184
|
// Create Distribution
|
|
184
185
|
this.distribution = this.createDistribution(alb);
|
|
@@ -187,6 +188,7 @@ export class Service extends Construct {
|
|
|
187
188
|
this.service = service;
|
|
188
189
|
this.container = container;
|
|
189
190
|
this.taskDefinition = taskDefinition;
|
|
191
|
+
this.scaling = scaling;
|
|
190
192
|
this.bindForService(props?.bind || []);
|
|
191
193
|
this.attachPermissionsForService(props?.permissions || []);
|
|
192
194
|
Object.entries(props?.environment || {}).map(([key, value]) => this.addEnvironmentForService(key, value));
|
|
@@ -253,6 +255,7 @@ export class Service extends Construct {
|
|
|
253
255
|
applicationLoadBalancer: this.alb,
|
|
254
256
|
hostedZone: this.distribution?.cdk.hostedZone,
|
|
255
257
|
certificate: this.distribution?.cdk.certificate,
|
|
258
|
+
scaling: this.scaling,
|
|
256
259
|
};
|
|
257
260
|
}
|
|
258
261
|
/////////////////////
|
|
@@ -490,20 +493,25 @@ export class Service extends Construct {
|
|
|
490
493
|
minCapacity: minContainers ?? 1,
|
|
491
494
|
maxCapacity: maxContainers ?? 1,
|
|
492
495
|
});
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
496
|
+
if (cpuUtilization !== false) {
|
|
497
|
+
scaling.scaleOnCpuUtilization("CpuScaling", {
|
|
498
|
+
targetUtilizationPercent: cpuUtilization ?? 70,
|
|
499
|
+
scaleOutCooldown: CdkDuration.seconds(300),
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
if (memoryUtilization !== false) {
|
|
503
|
+
scaling.scaleOnMemoryUtilization("MemoryScaling", {
|
|
504
|
+
targetUtilizationPercent: memoryUtilization ?? 70,
|
|
505
|
+
scaleOutCooldown: CdkDuration.seconds(300),
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
if (target && requestsPerContainer !== false) {
|
|
502
509
|
scaling.scaleOnRequestCount("RequestScaling", {
|
|
503
510
|
requestsPerTarget: requestsPerContainer ?? 500,
|
|
504
511
|
targetGroup: target,
|
|
505
512
|
});
|
|
506
513
|
}
|
|
514
|
+
return scaling;
|
|
507
515
|
}
|
|
508
516
|
createDistribution(alb) {
|
|
509
517
|
const { cdk, customDomain } = this.props;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function compareSemver(v1: string, v2: string): number;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export function compareSemver(v1, v2) {
|
|
2
|
+
if (v1 === "latest")
|
|
3
|
+
return 1;
|
|
4
|
+
if (/^[^\d]/.test(v1)) {
|
|
5
|
+
v1 = v1.substring(1);
|
|
6
|
+
}
|
|
7
|
+
if (/^[^\d]/.test(v2)) {
|
|
8
|
+
v2 = v2.substring(1);
|
|
9
|
+
}
|
|
10
|
+
const [major1, minor1, patch1] = v1.split(".").map(Number);
|
|
11
|
+
const [major2, minor2, patch2] = v2.split(".").map(Number);
|
|
12
|
+
if (major1 !== major2)
|
|
13
|
+
return major1 - major2;
|
|
14
|
+
if (minor1 !== minor2)
|
|
15
|
+
return minor1 - minor2;
|
|
16
|
+
return patch1 - patch2;
|
|
17
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"sideEffects": false,
|
|
3
3
|
"name": "sst",
|
|
4
|
-
"version": "2.45.
|
|
4
|
+
"version": "2.45.2",
|
|
5
5
|
"bin": {
|
|
6
6
|
"sst": "cli/sst.js"
|
|
7
7
|
},
|
|
@@ -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.45.
|
|
121
|
+
"astro-sst": "2.45.1",
|
|
122
122
|
"async": "^3.2.4",
|
|
123
123
|
"tsx": "^3.12.1",
|
|
124
124
|
"typescript": "5.2.2",
|