cdk-nuxt 2.19.0 → 2.19.1
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/README.md +5 -0
- package/lib/templates/stack-index-server.ts +37 -27
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -116,6 +116,11 @@ First-time setup (once per AWS account/region):
|
|
|
116
116
|
cdk bootstrap aws://YOUR_ACCOUNT_ID/YOUR_REGION
|
|
117
117
|
```
|
|
118
118
|
|
|
119
|
+
> When using the [WAF via CloudFrontWafStack](docs/WAF.md) and using a different region than `us-east-1`, you also need to bootstrap `us-east-1` for the WAF resources:
|
|
120
|
+
> ```bash
|
|
121
|
+
> cdk bootstrap aws://YOUR_ACCOUNT_ID/us-east-1
|
|
122
|
+
> ```
|
|
123
|
+
|
|
119
124
|
Deploy your app:
|
|
120
125
|
```bash
|
|
121
126
|
node_modules/.bin/cdk-nuxt-deploy-server
|
|
@@ -1,15 +1,44 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {NuxtServerAppStack, type NuxtServerAppStackProps, App, CloudFrontWafStack} from "cdk-nuxt";
|
|
3
3
|
|
|
4
|
+
const accountId = 'XXXXXXXX';
|
|
5
|
+
const project = 'my-project';
|
|
6
|
+
const service = 'nuxt-app';
|
|
7
|
+
const environment = 'dev';
|
|
8
|
+
|
|
9
|
+
// The tags to apply to all stack resources.
|
|
10
|
+
// Modify as needed for analytics and cost allocation.
|
|
11
|
+
const tags = {
|
|
12
|
+
project: project,
|
|
13
|
+
service: service,
|
|
14
|
+
environment: environment
|
|
15
|
+
};
|
|
16
|
+
|
|
4
17
|
const app = new App();
|
|
5
18
|
|
|
19
|
+
// Optional: Create a separate WAF stack in us-east-1 (required for CloudFront WAF)
|
|
20
|
+
// Uncomment the following lines to enable WAF protection:
|
|
21
|
+
/*
|
|
22
|
+
const wafStack = new CloudFrontWafStack(app, `${project}-${service}-${environment}-waf-stack`, {
|
|
23
|
+
name: `${project}-${service}-${environment}-waf`,
|
|
24
|
+
config: {
|
|
25
|
+
// Add WAF configuration as needed
|
|
26
|
+
// See https://github.com/ferdinandfrank/cdk-nuxt/blob/main/docs/WAF.md
|
|
27
|
+
},
|
|
28
|
+
env: {
|
|
29
|
+
account: accountId
|
|
30
|
+
},
|
|
31
|
+
tags: tags
|
|
32
|
+
});
|
|
33
|
+
*/
|
|
34
|
+
|
|
6
35
|
const appStackProps: NuxtServerAppStackProps = {
|
|
7
36
|
/**
|
|
8
37
|
* The AWS environment (account/region) where this stack will be deployed.
|
|
9
38
|
*/
|
|
10
39
|
env: {
|
|
11
40
|
// The ID of your AWS account on which to deploy the stack.
|
|
12
|
-
account:
|
|
41
|
+
account: accountId,
|
|
13
42
|
|
|
14
43
|
// The AWS region where to deploy the Nuxt app.
|
|
15
44
|
region: 'eu-central-1'
|
|
@@ -19,19 +48,19 @@ const appStackProps: NuxtServerAppStackProps = {
|
|
|
19
48
|
* A string identifier for the project the Nuxt app is part of.
|
|
20
49
|
* A project might have multiple different services.
|
|
21
50
|
*/
|
|
22
|
-
project:
|
|
51
|
+
project: project,
|
|
23
52
|
|
|
24
53
|
/**
|
|
25
54
|
* A string identifier for the project's service the Nuxt app is created for.
|
|
26
55
|
* This can be seen as the name of the Nuxt app.
|
|
27
56
|
*/
|
|
28
|
-
service:
|
|
57
|
+
service: service,
|
|
29
58
|
|
|
30
59
|
/**
|
|
31
60
|
* A string to identify the environment of the Nuxt app. This enables us
|
|
32
61
|
* to deploy multiple different environments of the same Nuxt app, e.g., production and development.
|
|
33
62
|
*/
|
|
34
|
-
environment:
|
|
63
|
+
environment: environment,
|
|
35
64
|
|
|
36
65
|
/**
|
|
37
66
|
* The domain (without the protocol) at which the Nuxt app shall be publicly available.
|
|
@@ -195,34 +224,15 @@ const appStackProps: NuxtServerAppStackProps = {
|
|
|
195
224
|
/**
|
|
196
225
|
* The ARN of an existing AWS WAF Web ACL to associate with the CloudFront distribution.
|
|
197
226
|
* This should be used with a separate CloudFrontWafStack deployed in us-east-1.
|
|
198
|
-
* If you want to use a preconfigured WAF, create a separate stack as shown
|
|
227
|
+
* If you want to use a preconfigured WAF, create a separate stack as shown above and pass its ARN here.
|
|
199
228
|
*/
|
|
200
229
|
webAclArn: undefined,
|
|
230
|
+
// webAclArn: wafStack.webAclArn, // Uncomment this line if using the WAF stack created above
|
|
201
231
|
|
|
202
232
|
/**
|
|
203
233
|
* Stack tags that will be applied to all the taggable resources and the stack itself.
|
|
204
234
|
*/
|
|
205
|
-
tags:
|
|
206
|
-
service: 'nuxt-app'
|
|
207
|
-
},
|
|
235
|
+
tags: tags
|
|
208
236
|
};
|
|
209
237
|
|
|
210
|
-
|
|
211
|
-
// Uncomment the following lines to enable WAF protection:
|
|
212
|
-
/*
|
|
213
|
-
const wafStack = new CloudFrontWafStack(app, `${appStackProps.project}-${appStackProps.service}-${appStackProps.environment}-waf-stack`, {
|
|
214
|
-
name: `${appStackProps.project}-${appStackProps.service}-${appStackProps.environment}-waf`,
|
|
215
|
-
config: {
|
|
216
|
-
// Add WAF configuration as needed
|
|
217
|
-
// See https://github.com/ferdinandfrank/cdk-nuxt/blob/main/docs/WAF.md
|
|
218
|
-
},
|
|
219
|
-
env: {
|
|
220
|
-
account: appStackProps.env.account,
|
|
221
|
-
},
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
// Attach the WAF Web ACL ARN to the app stack
|
|
225
|
-
appStackProps.webAclArn = wafStack.webAclArn;
|
|
226
|
-
*/
|
|
227
|
-
|
|
228
|
-
new NuxtServerAppStack(app, `${appStackProps.project}-${appStackProps.service}-${appStackProps.environment}-stack`, appStackProps);
|
|
238
|
+
new NuxtServerAppStack(app, `${project}-${service}-${environment}-stack`, appStackProps);
|