@stacksjs/cloud 0.66.0 → 0.68.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/{src/cloud/ai.ts → dist/ai.d.ts} +5 -9
- package/{src/cloud/cdn.ts → dist/cdn.d.ts} +9 -28
- package/dist/cli.d.ts +12 -0
- package/{src/cloud/compute.ts → dist/compute.d.ts} +13 -37
- package/{src/cloud/database.ts → dist/database.d.ts} +5 -10
- package/{src/cloud/deployment.ts → dist/deployment.d.ts} +5 -16
- package/{src/cloud/dns.ts → dist/dns.d.ts} +4 -11
- package/dist/docs.d.ts +34 -0
- package/{src/cloud/email.ts → dist/email.d.ts} +9 -29
- package/{src/cloud/file-system.ts → dist/file-system.d.ts} +6 -9
- package/dist/helpers.d.ts +50 -50
- package/dist/index.d.ts +2 -2
- package/dist/index.js +20 -23
- package/{src/cloud/jump-box.ts → dist/jump-box.d.ts} +7 -12
- package/{src/cloud/network.ts → dist/network.d.ts} +5 -8
- package/dist/origin-request.d.ts +5 -0
- package/dist/origin-request.js +6 -6
- package/{src/cloud/permissions.ts → dist/permissions.d.ts} +5 -13
- package/{src/cloud/queue.ts → dist/queue.d.ts} +9 -29
- package/{src/cloud/redirects.ts → dist/redirects.d.ts} +7 -14
- package/{src/cloud/security.ts → dist/security.d.ts} +5 -128
- package/{src/cloud/storage.ts → dist/storage.d.ts} +7 -15
- package/dist/types.d.ts +26 -25
- package/package.json +30 -32
- package/dist/cloud/ai.d.ts +0 -6
- package/dist/cloud/cache.d.ts +0 -0
- package/dist/cloud/cdn.d.ts +0 -34
- package/dist/cloud/cli.d.ts +0 -6
- package/dist/cloud/compute.d.ts +0 -17
- package/dist/cloud/dashboard.d.ts +0 -0
- package/dist/cloud/database.d.ts +0 -11
- package/dist/cloud/deployment.d.ts +0 -17
- package/dist/cloud/dns.d.ts +0 -7
- package/dist/cloud/docs.d.ts +0 -8
- package/dist/cloud/email.d.ts +0 -10
- package/dist/cloud/file-system.d.ts +0 -12
- package/dist/cloud/index.d.ts +0 -42
- package/dist/cloud/jump-box.d.ts +0 -12
- package/dist/cloud/network.d.ts +0 -8
- package/dist/cloud/permissions.d.ts +0 -6
- package/dist/cloud/queue.d.ts +0 -22
- package/dist/cloud/redirects.d.ts +0 -8
- package/dist/cloud/search-engine.d.ts +0 -0
- package/dist/cloud/security.d.ts +0 -15
- package/dist/cloud/storage.d.ts +0 -21
- package/dist/edge/origin-request.d.ts +0 -1
- package/dist/index.js.map +0 -1867
- package/src/cloud/cache.ts +0 -0
- package/src/cloud/cli.ts +0 -14
- package/src/cloud/dashboard.ts +0 -85
- package/src/cloud/docs.ts +0 -50
- package/src/cloud/index.ts +0 -141
- package/src/cloud/router-layer/nodejs/package.json +0 -15
- package/src/cloud/search-engine.ts +0 -108
- package/src/edge/origin-request.ts +0 -55
- package/src/helpers.ts +0 -800
- package/src/index.ts +0 -2
- package/src/types.ts +0 -28
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import type { Construct } from 'constructs'
|
|
2
|
-
import type { NestedCloudProps } from '../types'
|
|
3
|
-
import { config } from '@stacksjs/config'
|
|
4
|
-
import { aws_iam as iam } from 'aws-cdk-lib'
|
|
1
|
+
import type { Construct } from 'constructs';
|
|
2
|
+
import type { NestedCloudProps } from '../types';
|
|
5
3
|
|
|
6
|
-
export interface AiStackProps extends NestedCloudProps {}
|
|
7
|
-
|
|
8
|
-
export class AiStack {
|
|
9
|
-
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
4
|
+
export declare interface AiStackProps extends NestedCloudProps {}
|
|
5
|
+
export declare class AiStack {
|
|
10
6
|
constructor(scope: Construct, props: AiStackProps) {
|
|
11
7
|
const bedrockAccessPolicy = new iam.PolicyStatement({
|
|
12
8
|
effect: iam.Effect.ALLOW,
|
|
@@ -21,4 +17,4 @@ export class AiStack {
|
|
|
21
17
|
|
|
22
18
|
bedrockAccessRole.addToPolicy(bedrockAccessPolicy)
|
|
23
19
|
}
|
|
24
|
-
}
|
|
20
|
+
}
|
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type { NestedCloudProps } from '../types'
|
|
5
|
-
import { config } from '@stacksjs/config'
|
|
6
|
-
import {
|
|
7
|
-
aws_cloudfront as cloudfront,
|
|
8
|
-
Duration,
|
|
9
|
-
aws_lambda as lambda,
|
|
10
|
-
aws_cloudfront_origins as origins,
|
|
11
|
-
CfnOutput as Output,
|
|
12
|
-
aws_route53 as route53,
|
|
13
|
-
aws_route53_targets as targets,
|
|
14
|
-
} from 'aws-cdk-lib'
|
|
1
|
+
import type { ApplicationLoadBalancer } from 'aws-cdk-lib/aws-elasticloadbalancingv2';
|
|
2
|
+
import type { Construct } from 'constructs';
|
|
3
|
+
import type { NestedCloudProps } from '../types';
|
|
15
4
|
|
|
16
|
-
export interface CdnStackProps extends NestedCloudProps {
|
|
5
|
+
export declare interface CdnStackProps extends NestedCloudProps {
|
|
17
6
|
certificate: acm.Certificate
|
|
18
7
|
logBucket: s3.Bucket
|
|
19
8
|
publicBucket: s3.Bucket
|
|
@@ -25,8 +14,7 @@ export interface CdnStackProps extends NestedCloudProps {
|
|
|
25
14
|
webServerUrl?: lambda.FunctionUrl
|
|
26
15
|
lb?: ApplicationLoadBalancer
|
|
27
16
|
}
|
|
28
|
-
|
|
29
|
-
export class CdnStack {
|
|
17
|
+
export declare class CdnStack {
|
|
30
18
|
mainDistribution: cloudfront.Distribution
|
|
31
19
|
docsDistribution: cloudfront.Distribution | undefined
|
|
32
20
|
cdnCachePolicy: cloudfront.CachePolicy
|
|
@@ -54,7 +42,6 @@ export class CdnStack {
|
|
|
54
42
|
})
|
|
55
43
|
|
|
56
44
|
if (config.app.docMode) {
|
|
57
|
-
// In doc mode, create only one distribution for docs
|
|
58
45
|
this.mainDistribution = this.createDistribution(
|
|
59
46
|
scope,
|
|
60
47
|
props,
|
|
@@ -66,7 +53,6 @@ export class CdnStack {
|
|
|
66
53
|
)
|
|
67
54
|
}
|
|
68
55
|
else {
|
|
69
|
-
// Not in doc mode, create two distributions
|
|
70
56
|
this.mainDistribution = this.createDistribution(
|
|
71
57
|
scope,
|
|
72
58
|
props,
|
|
@@ -90,10 +76,8 @@ export class CdnStack {
|
|
|
90
76
|
}
|
|
91
77
|
}
|
|
92
78
|
|
|
93
|
-
// Create Route53 records
|
|
94
79
|
this.createRoute53Records(scope, props)
|
|
95
80
|
|
|
96
|
-
// Create outputs
|
|
97
81
|
this.createOutputs(scope, props)
|
|
98
82
|
}
|
|
99
83
|
|
|
@@ -175,11 +159,11 @@ export class CdnStack {
|
|
|
175
159
|
})
|
|
176
160
|
|
|
177
161
|
new Output(scope, 'MainUrl', {
|
|
178
|
-
value: `https
|
|
162
|
+
value: `https:
|
|
179
163
|
description: 'The URL of the deployed main application',
|
|
180
164
|
})
|
|
181
165
|
|
|
182
|
-
this.mainVanityUrl = `https
|
|
166
|
+
this.mainVanityUrl = `https:
|
|
183
167
|
new Output(scope, 'MainVanityUrl', {
|
|
184
168
|
value: this.mainVanityUrl,
|
|
185
169
|
description: 'The vanity URL of the deployed main application',
|
|
@@ -190,7 +174,7 @@ export class CdnStack {
|
|
|
190
174
|
value: this.docsDistribution.distributionId,
|
|
191
175
|
})
|
|
192
176
|
|
|
193
|
-
this.docsVanityUrl = `https
|
|
177
|
+
this.docsVanityUrl = `https:
|
|
194
178
|
new Output(scope, 'DocsAppVanityUrl', {
|
|
195
179
|
value: this.docsVanityUrl,
|
|
196
180
|
description: 'The vanity URL of the deployed docs application',
|
|
@@ -216,21 +200,18 @@ export class CdnStack {
|
|
|
216
200
|
const request = event.Records[0].cf.request;
|
|
217
201
|
const uri = request.uri;
|
|
218
202
|
|
|
219
|
-
// Append index.html to root URI
|
|
220
203
|
if (uri === '/') {
|
|
221
204
|
request.uri = '/index.html';
|
|
222
205
|
callback(null, request);
|
|
223
206
|
return;
|
|
224
207
|
}
|
|
225
208
|
|
|
226
|
-
// Append .html to suffixless URI
|
|
227
209
|
if (uri.match(regexSuffixless)) {
|
|
228
210
|
request.uri = uri + '.html';
|
|
229
211
|
callback(null, request);
|
|
230
212
|
return;
|
|
231
213
|
}
|
|
232
214
|
|
|
233
|
-
// Remove trailing slash and append .html to origin request
|
|
234
215
|
if (uri.match(regexTrailingSlash)) {
|
|
235
216
|
request.uri = uri.slice(0, -1) + '.html';
|
|
236
217
|
callback(null, request);
|
|
@@ -287,4 +268,4 @@ export class CdnStack {
|
|
|
287
268
|
return cloudfront.CachedMethods.CACHE_GET_HEAD
|
|
288
269
|
}
|
|
289
270
|
}
|
|
290
|
-
}
|
|
271
|
+
}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Construct } from 'constructs';
|
|
2
|
+
import type { NestedCloudProps } from '../types';
|
|
3
|
+
|
|
4
|
+
export declare interface CliStackProps extends NestedCloudProps {}
|
|
5
|
+
export declare class CliStack {
|
|
6
|
+
constructor(scope: Construct, props: CliStackProps) {
|
|
7
|
+
new Output(scope, 'CliSetupUrl', {
|
|
8
|
+
value: `https:
|
|
9
|
+
description: 'URL to trigger the CLI setup function',
|
|
10
|
+
})
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -1,30 +1,13 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { env } from '@stacksjs/env'
|
|
6
|
-
import { path as p } from '@stacksjs/path'
|
|
7
|
-
import {
|
|
8
|
-
Duration,
|
|
9
|
-
aws_ec2 as ec2,
|
|
10
|
-
aws_ecs as ecs,
|
|
11
|
-
CfnOutput as Output,
|
|
12
|
-
RemovalPolicy,
|
|
13
|
-
aws_route53 as route53,
|
|
14
|
-
aws_route53_targets as route53Targets,
|
|
15
|
-
aws_secretsmanager as secretsmanager,
|
|
16
|
-
} from 'aws-cdk-lib'
|
|
17
|
-
import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'
|
|
18
|
-
import { LogGroup } from 'aws-cdk-lib/aws-logs'
|
|
19
|
-
|
|
20
|
-
export interface ComputeStackProps extends NestedCloudProps {
|
|
1
|
+
import type { Construct } from 'constructs';
|
|
2
|
+
import type { NestedCloudProps } from '../types';
|
|
3
|
+
|
|
4
|
+
export declare interface ComputeStackProps extends NestedCloudProps {
|
|
21
5
|
vpc: ec2.Vpc
|
|
22
6
|
fileSystem: efs.FileSystem
|
|
23
7
|
zone: route53.IHostedZone
|
|
24
8
|
certificate: acm.Certificate
|
|
25
9
|
}
|
|
26
|
-
|
|
27
|
-
export class ComputeStack {
|
|
10
|
+
export declare class ComputeStack {
|
|
28
11
|
lb: elbv2.ApplicationLoadBalancer
|
|
29
12
|
cluster: ecs.Cluster
|
|
30
13
|
taskDefinition: ecs.FargateTaskDefinition
|
|
@@ -43,30 +26,26 @@ export class ComputeStack {
|
|
|
43
26
|
|
|
44
27
|
this.taskDefinition = new ecs.FargateTaskDefinition(scope, 'TaskDefinition', {
|
|
45
28
|
family: `${props.appName}-${props.appEnv}-api`,
|
|
46
|
-
memoryLimitMiB: 512,
|
|
47
|
-
cpu: 256,
|
|
29
|
+
memoryLimitMiB: 512,
|
|
30
|
+
cpu: 256,
|
|
48
31
|
runtimePlatform: {
|
|
49
32
|
cpuArchitecture: ecs.CpuArchitecture.ARM64,
|
|
50
33
|
},
|
|
51
34
|
})
|
|
52
35
|
|
|
53
|
-
// const assetImage = new ecr_assets.DockerImageAsset(scope, 'DockerImageAsset', {
|
|
54
|
-
// directory: p.frameworkCloudPath(),
|
|
55
|
-
// })
|
|
56
36
|
|
|
57
37
|
const container = this.taskDefinition.addContainer('WebServerContainer', {
|
|
58
38
|
containerName: `${props.appName}-${props.appEnv}-api`,
|
|
59
|
-
// image: ecs.ContainerImage.fromDockerImageAsset(assetImage),
|
|
60
39
|
image: ecs.ContainerImage.fromAsset(p.frameworkPath('server')),
|
|
61
40
|
logging: new ecs.AwsLogDriver({
|
|
62
41
|
streamPrefix: `${props.appName}-${props.appEnv}-web-server-logs`,
|
|
63
42
|
logGroup: new LogGroup(scope, 'StacksApiLogs', {
|
|
64
43
|
logGroupName: '/aws/ecs/stacks-api',
|
|
65
|
-
removalPolicy: RemovalPolicy.DESTROY,
|
|
44
|
+
removalPolicy: RemovalPolicy.DESTROY,
|
|
66
45
|
}),
|
|
67
46
|
}),
|
|
68
47
|
healthCheck: {
|
|
69
|
-
command: ['CMD-SHELL', 'curl -f http
|
|
48
|
+
command: ['CMD-SHELL', 'curl -f http:
|
|
70
49
|
interval: Duration.seconds(10),
|
|
71
50
|
timeout: Duration.seconds(5),
|
|
72
51
|
retries: 3,
|
|
@@ -91,7 +70,6 @@ export class ComputeStack {
|
|
|
91
70
|
description: 'Access to the public facing load balancer',
|
|
92
71
|
})
|
|
93
72
|
|
|
94
|
-
// Assuming serviceSecurityGroup and publicLoadBalancerSG are already defined
|
|
95
73
|
serviceSecurityGroup.addIngressRule(publicLoadBalancerSG, ec2.Port.allTraffic(), 'Ingress from the public ALB')
|
|
96
74
|
|
|
97
75
|
this.lb = new elbv2.ApplicationLoadBalancer(scope, 'ApplicationLoadBalancer', {
|
|
@@ -160,7 +138,7 @@ export class ComputeStack {
|
|
|
160
138
|
defaultAction: elbv2.ListenerAction.forward([serviceTargetGroup]),
|
|
161
139
|
})
|
|
162
140
|
|
|
163
|
-
props.fileSystem.connections.allowFromAnyIpv4(ec2.Port.tcp(2049))
|
|
141
|
+
props.fileSystem.connections.allowFromAnyIpv4(ec2.Port.tcp(2049))
|
|
164
142
|
|
|
165
143
|
const volumeName = `${props.slug}-${props.appEnv}-efs`
|
|
166
144
|
this.taskDefinition.addVolume({
|
|
@@ -176,8 +154,6 @@ export class ComputeStack {
|
|
|
176
154
|
readOnly: false,
|
|
177
155
|
})
|
|
178
156
|
|
|
179
|
-
// Setup AutoScaling policy
|
|
180
|
-
// TODO: make this configurable in cloud.compute
|
|
181
157
|
const scaling = service.autoScaleTaskCount({ maxCapacity: 2 })
|
|
182
158
|
|
|
183
159
|
scaling.scaleOnCpuUtilization('CpuScaling', {
|
|
@@ -233,13 +209,13 @@ export class ComputeStack {
|
|
|
233
209
|
|
|
234
210
|
const apiPrefix = 'api'
|
|
235
211
|
new Output(scope, 'ApiUrl', {
|
|
236
|
-
value: `https
|
|
212
|
+
value: `https:
|
|
237
213
|
description: 'The URL of the deployed application',
|
|
238
214
|
})
|
|
239
215
|
|
|
240
216
|
new Output(scope, 'ApiVanityUrl', {
|
|
241
|
-
value: `http
|
|
217
|
+
value: `http:
|
|
242
218
|
description: 'The Vanity URL / DNS name of the load balancer',
|
|
243
219
|
})
|
|
244
220
|
}
|
|
245
|
-
}
|
|
221
|
+
}
|
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type { NestedCloudProps } from '../types'
|
|
4
|
-
import { aws_dynamodb as dynamodb, RemovalPolicy } from 'aws-cdk-lib'
|
|
1
|
+
import type { Construct } from 'constructs';
|
|
2
|
+
import type { NestedCloudProps } from '../types';
|
|
5
3
|
|
|
6
|
-
export interface DatabaseStackProps extends NestedCloudProps {
|
|
4
|
+
export declare interface DatabaseStackProps extends NestedCloudProps {
|
|
7
5
|
vpc: ec2.Vpc
|
|
8
6
|
}
|
|
9
|
-
|
|
10
|
-
export class DatabaseStack {
|
|
7
|
+
export declare class DatabaseStack {
|
|
11
8
|
database: dynamodb.Table
|
|
12
9
|
|
|
13
10
|
constructor(scope: Construct, props: DatabaseStackProps) {
|
|
14
11
|
this.database = new dynamodb.Table(scope, 'Database', {
|
|
15
12
|
tableName: `${props.slug}-${props.appEnv}-database`,
|
|
16
13
|
partitionKey: {
|
|
17
|
-
// wip
|
|
18
14
|
name: 'id',
|
|
19
15
|
type: dynamodb.AttributeType.STRING,
|
|
20
16
|
},
|
|
21
17
|
sortKey: {
|
|
22
|
-
// wip
|
|
23
18
|
name: 'sort',
|
|
24
19
|
type: dynamodb.AttributeType.STRING,
|
|
25
20
|
},
|
|
@@ -31,4 +26,4 @@ export class DatabaseStack {
|
|
|
31
26
|
encryption: dynamodb.TableEncryption.AWS_MANAGED,
|
|
32
27
|
})
|
|
33
28
|
}
|
|
34
|
-
}
|
|
29
|
+
}
|
|
@@ -1,27 +1,19 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type { NestedCloudProps } from '../types'
|
|
4
|
-
import { config } from '@stacksjs/config'
|
|
5
|
-
import { path as p } from '@stacksjs/path'
|
|
6
|
-
import { hasFiles } from '@stacksjs/storage'
|
|
7
|
-
import { docsSourceHash, websiteSourceHash } from '@stacksjs/utils'
|
|
8
|
-
import { AssetHashType, aws_s3_deployment as s3deploy } from 'aws-cdk-lib'
|
|
1
|
+
import type { Construct } from 'constructs';
|
|
2
|
+
import type { NestedCloudProps } from '../types';
|
|
9
3
|
|
|
10
|
-
export interface DeploymentStackProps extends NestedCloudProps {
|
|
4
|
+
export declare interface DeploymentStackProps extends NestedCloudProps {
|
|
11
5
|
publicBucket: s3.Bucket
|
|
12
6
|
docsBucket?: s3.Bucket
|
|
13
7
|
privateBucket: s3.Bucket
|
|
14
8
|
mainDistribution: cloudfront.Distribution
|
|
15
9
|
docsDistribution?: cloudfront.Distribution
|
|
16
10
|
}
|
|
17
|
-
|
|
18
|
-
export class DeploymentStack {
|
|
11
|
+
export declare class DeploymentStack {
|
|
19
12
|
privateSource: string
|
|
20
13
|
docsSource: string
|
|
21
14
|
publicSource: string
|
|
22
15
|
|
|
23
16
|
constructor(scope: Construct, props: DeploymentStackProps) {
|
|
24
|
-
// following paths are relative to where the command is run from
|
|
25
17
|
this.privateSource = '../../private'
|
|
26
18
|
this.docsSource = '../docs/dist/'
|
|
27
19
|
this.publicSource = config.app.docMode === true ? this.docsSource : '../views/web/dist/'
|
|
@@ -36,11 +28,9 @@ export class DeploymentStack {
|
|
|
36
28
|
],
|
|
37
29
|
destinationBucket: mainBucket as s3.Bucket,
|
|
38
30
|
distribution: props.mainDistribution,
|
|
39
|
-
// distributionPaths: ['/*'],
|
|
40
31
|
})
|
|
41
32
|
|
|
42
33
|
if (this.shouldDeployDocs()) {
|
|
43
|
-
// if docs should be deployed, add it to the deployment
|
|
44
34
|
new s3deploy.BucketDeployment(scope, 'Docs', {
|
|
45
35
|
sources: [
|
|
46
36
|
s3deploy.Source.asset(this.docsSource, {
|
|
@@ -50,7 +40,6 @@ export class DeploymentStack {
|
|
|
50
40
|
],
|
|
51
41
|
destinationBucket: props.docsBucket as s3.Bucket,
|
|
52
42
|
distribution: props.docsDistribution,
|
|
53
|
-
// distributionPaths: ['/*'],
|
|
54
43
|
})
|
|
55
44
|
}
|
|
56
45
|
|
|
@@ -68,4 +57,4 @@ export class DeploymentStack {
|
|
|
68
57
|
shouldDeployDocs(): boolean {
|
|
69
58
|
return hasFiles(p.projectPath('docs')) && !config.app.docMode
|
|
70
59
|
}
|
|
71
|
-
}
|
|
60
|
+
}
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
import type { Construct } from 'constructs'
|
|
2
|
-
import type { NestedCloudProps } from '../types'
|
|
3
|
-
import { RemovalPolicy, aws_route53 as route53, aws_s3 as s3, aws_route53_targets as targets } from 'aws-cdk-lib'
|
|
1
|
+
import type { Construct } from 'constructs';
|
|
2
|
+
import type { NestedCloudProps } from '../types';
|
|
4
3
|
|
|
5
|
-
export class DnsStack {
|
|
4
|
+
export declare class DnsStack {
|
|
6
5
|
zone: route53.IHostedZone
|
|
7
6
|
|
|
8
7
|
constructor(scope: Construct, props: NestedCloudProps) {
|
|
9
|
-
// lets see if the zone already exists because Buddy should have created it already
|
|
10
8
|
this.zone = route53.PublicHostedZone.fromLookup(scope, 'AppUrlHostedZone', {
|
|
11
9
|
domainName: props.domain,
|
|
12
10
|
})
|
|
13
11
|
|
|
14
|
-
// setup the www redirect
|
|
15
|
-
// Create a bucket for www.yourdomain.com and configure it to redirect to yourdomain.com
|
|
16
12
|
const wwwBucket = new s3.Bucket(scope, 'WwwBucket', {
|
|
17
13
|
bucketName: `www.${props.domain}`,
|
|
18
14
|
websiteRedirect: {
|
|
@@ -23,19 +19,16 @@ export class DnsStack {
|
|
|
23
19
|
autoDeleteObjects: true,
|
|
24
20
|
})
|
|
25
21
|
|
|
26
|
-
// Create a Route53 record for www.yourdomain.com
|
|
27
22
|
new route53.ARecord(scope, 'WwwAliasRecord', {
|
|
28
23
|
recordName: `www.${props.domain}`,
|
|
29
24
|
zone: this.zone,
|
|
30
25
|
target: route53.RecordTarget.fromAlias(new targets.BucketWebsiteTarget(wwwBucket)),
|
|
31
26
|
})
|
|
32
27
|
|
|
33
|
-
// TODO: this only needs to be created if Lemon Squeezy is being used
|
|
34
|
-
// Create a Route53 record for www.yourdomain.com
|
|
35
28
|
new route53.ARecord(scope, 'StoreAliasRecord', {
|
|
36
29
|
recordName: `store.${props.domain}`,
|
|
37
30
|
zone: this.zone,
|
|
38
31
|
target: route53.RecordTarget.fromIpAddresses('137.66.37.136'),
|
|
39
32
|
})
|
|
40
33
|
}
|
|
41
|
-
}
|
|
34
|
+
}
|
package/dist/docs.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { CfnResource } from 'aws-cdk-lib';
|
|
2
|
+
import type { Construct } from 'constructs';
|
|
3
|
+
import type { NestedCloudProps } from '../types';
|
|
4
|
+
|
|
5
|
+
export declare interface DocsStackProps extends NestedCloudProps {
|
|
6
|
+
}
|
|
7
|
+
export declare class DocsStack {
|
|
8
|
+
originRequestFunction: lambda.Function
|
|
9
|
+
|
|
10
|
+
constructor(scope: Construct, props: DocsStackProps) {
|
|
11
|
+
const docsPrefix = 'docs'
|
|
12
|
+
|
|
13
|
+
this.originRequestFunction = new lambda.Function(scope, 'OriginRequestFunction', {
|
|
14
|
+
functionName: `${props.slug}-${props.appEnv}-origin-request-${props.timestamp}`,
|
|
15
|
+
description: 'The Stacks Origin Request function that prettifies URLs by removing the .html extension',
|
|
16
|
+
runtime: lambda.Runtime.NODEJS_20_X,
|
|
17
|
+
handler: 'dist/origin-request.handler',
|
|
18
|
+
code: lambda.Code.fromAsset(p.cloudPath('dist.zip'), {
|
|
19
|
+
assetHash: originRequestFunctionHash(),
|
|
20
|
+
assetHashType: AssetHashType.CUSTOM,
|
|
21
|
+
}),
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
const cfnOriginRequestFunction = this.originRequestFunction.node.defaultChild as CfnResource
|
|
25
|
+
cfnOriginRequestFunction.applyRemovalPolicy(RemovalPolicy.RETAIN)
|
|
26
|
+
|
|
27
|
+
if (!config.app.docMode && storage.hasFiles(p.projectPath('docs'))) {
|
|
28
|
+
new Output(scope, 'DocsUrl', {
|
|
29
|
+
value: `https:
|
|
30
|
+
description: 'The URL of the deployed documentation',
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -1,24 +1,10 @@
|
|
|
1
|
-
import type { Construct } from 'constructs'
|
|
2
|
-
import type { NestedCloudProps } from '../types'
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Duration,
|
|
6
|
-
aws_iam as iam,
|
|
7
|
-
aws_lambda as lambda,
|
|
8
|
-
RemovalPolicy,
|
|
9
|
-
aws_route53 as route53,
|
|
10
|
-
aws_s3 as s3,
|
|
11
|
-
aws_s3_notifications as s3n,
|
|
12
|
-
aws_ses as ses,
|
|
13
|
-
Stack,
|
|
14
|
-
Tags,
|
|
15
|
-
} from 'aws-cdk-lib'
|
|
16
|
-
|
|
17
|
-
export interface EmailStackProps extends NestedCloudProps {
|
|
1
|
+
import type { Construct } from 'constructs';
|
|
2
|
+
import type { NestedCloudProps } from '../types';
|
|
3
|
+
|
|
4
|
+
export declare interface EmailStackProps extends NestedCloudProps {
|
|
18
5
|
zone: route53.IHostedZone
|
|
19
6
|
}
|
|
20
|
-
|
|
21
|
-
export class EmailStack {
|
|
7
|
+
export declare class EmailStack {
|
|
22
8
|
emailBucket: s3.Bucket
|
|
23
9
|
|
|
24
10
|
constructor(scope: Construct, props: EmailStackProps) {
|
|
@@ -28,7 +14,6 @@ export class EmailStack {
|
|
|
28
14
|
versioned: true,
|
|
29
15
|
removalPolicy: RemovalPolicy.DESTROY,
|
|
30
16
|
autoDeleteObjects: true,
|
|
31
|
-
// encryptionKey: this.encryptionKey,
|
|
32
17
|
encryption: s3.BucketEncryption.S3_MANAGED,
|
|
33
18
|
lifecycleRules: [
|
|
34
19
|
{
|
|
@@ -112,8 +97,6 @@ export class EmailStack {
|
|
|
112
97
|
},
|
|
113
98
|
})
|
|
114
99
|
|
|
115
|
-
// this line is important to make sure the bucket is created before the receipt rule
|
|
116
|
-
// do not remove it, unless you want a hell of a time debugging randomness
|
|
117
100
|
receiptRule.node.addDependency(this.emailBucket)
|
|
118
101
|
|
|
119
102
|
const iamGroup = new iam.Group(scope, 'IAMGroup', {
|
|
@@ -148,7 +131,6 @@ export class EmailStack {
|
|
|
148
131
|
|
|
149
132
|
iamGroup.attachInlinePolicy(policy)
|
|
150
133
|
|
|
151
|
-
// Create a SES domain identity
|
|
152
134
|
const sesIdentity = new ses.CfnEmailIdentity(scope, 'DomainIdentity', {
|
|
153
135
|
emailIdentity: props.domain,
|
|
154
136
|
|
|
@@ -170,8 +152,6 @@ export class EmailStack {
|
|
|
170
152
|
},
|
|
171
153
|
})
|
|
172
154
|
|
|
173
|
-
// Create a Route53 records for the SES domain identity
|
|
174
|
-
// https://github.com/aws/aws-cdk/issues/21306
|
|
175
155
|
new route53.CfnRecordSet(scope, 'DkimRecord1', {
|
|
176
156
|
hostedZoneName: `${props.zone.zoneName}.`,
|
|
177
157
|
name: sesIdentity.attrDkimDnsTokenName1,
|
|
@@ -228,7 +208,7 @@ export class EmailStack {
|
|
|
228
208
|
const lambdaEmailOutbound = new lambda.Function(scope, 'LambdaEmailOutbound', {
|
|
229
209
|
functionName: `${props.slug}-${props.appEnv}-email-outbound`,
|
|
230
210
|
description: 'Take the JSON and convert it in to an raw email.',
|
|
231
|
-
code: lambda.Code.fromInline('exports.handler = async (event) => {return true;};'),
|
|
211
|
+
code: lambda.Code.fromInline('exports.handler = async (event) => {return true;};'),
|
|
232
212
|
handler: 'index.handler',
|
|
233
213
|
memorySize: 256,
|
|
234
214
|
runtime: lambda.Runtime.NODEJS_18_X,
|
|
@@ -258,7 +238,7 @@ export class EmailStack {
|
|
|
258
238
|
const lambdaEmailInbound = new lambda.Function(scope, 'LambdaEmailInbound', {
|
|
259
239
|
functionName: `${props.slug}-${props.appEnv}-email-inbound`,
|
|
260
240
|
description: 'This Lambda organizes all the incoming emails based on the From and To field.',
|
|
261
|
-
code: lambda.Code.fromInline('exports.handler = async (event) => {return true;};'),
|
|
241
|
+
code: lambda.Code.fromInline('exports.handler = async (event) => {return true;};'),
|
|
262
242
|
handler: 'index.handler',
|
|
263
243
|
memorySize: 256,
|
|
264
244
|
role: lambdaEmailInboundRole,
|
|
@@ -302,7 +282,7 @@ export class EmailStack {
|
|
|
302
282
|
description: 'This Lambda converts raw emails files in to HTML and text.',
|
|
303
283
|
code: lambda.Code.fromInline(
|
|
304
284
|
'exports.handler = async (event) => {console.log("hello world email converter");return true;};',
|
|
305
|
-
),
|
|
285
|
+
),
|
|
306
286
|
handler: 'index.handler',
|
|
307
287
|
memorySize: 256,
|
|
308
288
|
role: lambdaEmailConverterRole,
|
|
@@ -353,4 +333,4 @@ export class EmailStack {
|
|
|
353
333
|
{ prefix: 'today/' },
|
|
354
334
|
)
|
|
355
335
|
}
|
|
356
|
-
}
|
|
336
|
+
}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type { NestedCloudProps } from '../types'
|
|
4
|
-
import { aws_efs as efs, RemovalPolicy } from 'aws-cdk-lib'
|
|
1
|
+
import type { Construct } from 'constructs';
|
|
2
|
+
import type { NestedCloudProps } from '../types';
|
|
5
3
|
|
|
6
|
-
export interface FileSystemStackProps extends NestedCloudProps {
|
|
4
|
+
export declare interface FileSystemStackProps extends NestedCloudProps {
|
|
7
5
|
vpc: ec2.Vpc
|
|
8
6
|
}
|
|
9
|
-
|
|
10
|
-
export class FileSystemStack {
|
|
7
|
+
export declare class FileSystemStack {
|
|
11
8
|
fileSystem: efs.FileSystem
|
|
12
9
|
accessPoint: efs.AccessPoint
|
|
13
10
|
|
|
@@ -19,7 +16,7 @@ export class FileSystemStack {
|
|
|
19
16
|
lifecyclePolicy: efs.LifecyclePolicy.AFTER_7_DAYS,
|
|
20
17
|
performanceMode: efs.PerformanceMode.GENERAL_PURPOSE,
|
|
21
18
|
throughputMode: efs.ThroughputMode.BURSTING,
|
|
22
|
-
enableAutomaticBackups: true,
|
|
19
|
+
enableAutomaticBackups: true,
|
|
23
20
|
encrypted: true,
|
|
24
21
|
})
|
|
25
22
|
|
|
@@ -32,4 +29,4 @@ export class FileSystemStack {
|
|
|
32
29
|
},
|
|
33
30
|
})
|
|
34
31
|
}
|
|
35
|
-
}
|
|
32
|
+
}
|
package/dist/helpers.d.ts
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import type { CountryCode, RegisterDomainCommandOutput } from
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import type { CountryCode, RegisterDomainCommandOutput } from '@aws-sdk/client-route-53-domains';
|
|
2
|
+
import type { Result } from '@stacksjs/error-handling';
|
|
3
|
+
|
|
4
|
+
export { InstanceType }
|
|
5
|
+
declare const appEnv: unknown;
|
|
6
6
|
export declare function getSecurityGroupId(securityGroupName: string): Promise<Result<string | undefined, string>>;
|
|
7
|
-
export interface PurchaseOptions {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
7
|
+
export declare interface PurchaseOptions {
|
|
8
|
+
domain: string
|
|
9
|
+
years: number
|
|
10
|
+
privacy: boolean
|
|
11
|
+
autoRenew: boolean
|
|
12
|
+
adminFirstName: string
|
|
13
|
+
adminLastName: string
|
|
14
|
+
adminOrganization: string
|
|
15
|
+
adminAddressLine1: string
|
|
16
|
+
adminAddressLine2: string
|
|
17
|
+
adminCity: string
|
|
18
|
+
adminState: string
|
|
19
|
+
adminCountry: CountryCode
|
|
20
|
+
adminZip: string
|
|
21
|
+
adminPhone: string
|
|
22
|
+
adminEmail: string
|
|
23
|
+
techFirstName: string
|
|
24
|
+
techLastName: string
|
|
25
|
+
techOrganization: string
|
|
26
|
+
techAddressLine1: string
|
|
27
|
+
techAddressLine2: string
|
|
28
|
+
techCity: string
|
|
29
|
+
techState: string
|
|
30
|
+
techCountry: CountryCode
|
|
31
|
+
techZip: string
|
|
32
|
+
techPhone: string
|
|
33
|
+
techEmail: string
|
|
34
|
+
registrantFirstName: string
|
|
35
|
+
registrantLastName: string
|
|
36
|
+
registrantOrganization: string
|
|
37
|
+
registrantAddressLine1: string
|
|
38
|
+
registrantAddressLine2: string
|
|
39
|
+
registrantCity: string
|
|
40
|
+
registrantState: string
|
|
41
|
+
registrantCountry: CountryCode
|
|
42
|
+
registrantZip: string
|
|
43
|
+
registrantPhone: string
|
|
44
|
+
registrantEmail: string
|
|
45
|
+
privacyAdmin: boolean
|
|
46
|
+
privacyTech: boolean
|
|
47
|
+
privacyRegistrant: boolean
|
|
48
|
+
contactType: ContactType
|
|
49
|
+
verbose: boolean
|
|
50
50
|
}
|
|
51
|
-
export declare function purchaseDomain(domain: string, options: PurchaseOptions): Result<Promise<RegisterDomainCommandOutput>, Error>;
|
|
51
|
+
export declare function purchaseDomain(domain: string, options: PurchaseOptions,): Result<Promise<RegisterDomainCommandOutput>, Error>;
|
|
52
52
|
export declare function getJumpBoxInstanceId(name?: string): Promise<string | undefined>;
|
|
53
53
|
export declare function deleteEc2Instance(id: string, stackName?: string): Promise<Result<string, string>>;
|
|
54
54
|
export declare function deleteJumpBox(stackName?: string): Promise<Result<string, string>>;
|
|
@@ -68,4 +68,4 @@ export declare function getSecurityGroupFromInstanceId(instanceId: string): Prom
|
|
|
68
68
|
export declare function isFirstDeployment(): Promise<boolean>;
|
|
69
69
|
export declare function isFailedState(): Promise<boolean>;
|
|
70
70
|
export declare function getOrCreateTimestamp(): Promise<string>;
|
|
71
|
-
export declare function getCloudFrontDistributionId(): Promise<string>;
|
|
71
|
+
export declare function getCloudFrontDistributionId(): Promise<string>;
|