@friggframework/devtools 2.0.0--canary.701.00d6b2c.0 → 2.0.0--canary.702.3f342da.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/README.md +1 -0
- package/frigg-cli/README.md +46 -1
- package/frigg-cli/__tests__/unit/commands/build.test.js +3 -0
- package/frigg-cli/__tests__/unit/commands/deploy.test.js +3 -0
- package/frigg-cli/__tests__/unit/commands/validate-wiring.test.js +92 -0
- package/frigg-cli/build-command/index.js +6 -0
- package/frigg-cli/deploy-command/index.js +6 -0
- package/frigg-cli/index.js +19 -1
- package/frigg-cli/init-command/backend-first-handler.js +25 -46
- package/frigg-cli/start-command/index.js +4 -0
- package/frigg-cli/start-command/start-command.test.js +3 -0
- package/frigg-cli/validate-command/__tests__/init-validation.test.js +63 -0
- package/frigg-cli/validate-command/__tests__/integrations-checks.test.js +133 -0
- package/frigg-cli/validate-command/__tests__/validate-app-definition.test.js +326 -0
- package/frigg-cli/validate-command/__tests__/validate-command.test.js +241 -0
- package/frigg-cli/validate-command/__tests__/validate-module-command.test.js +119 -0
- package/frigg-cli/validate-command/checks/config.js +468 -0
- package/frigg-cli/validate-command/checks/integrations.js +274 -0
- package/frigg-cli/validate-command/fixtures/bad-module/index.js +18 -0
- package/frigg-cli/validate-command/fixtures/fathom-module/definition.js +76 -0
- package/frigg-cli/validate-command/fixtures/fathom-module/index.js +6 -0
- package/frigg-cli/validate-command/format-report.js +60 -0
- package/frigg-cli/validate-command/index.js +151 -0
- package/frigg-cli/validate-command/load-app-definition.js +93 -0
- package/frigg-cli/validate-command/load-module-definition.js +64 -0
- package/frigg-cli/validate-command/schema-issues.js +154 -0
- package/frigg-cli/validate-command/validate-app-definition.js +60 -0
- package/frigg-cli/validate-command/validate-module-definition.js +46 -0
- package/infrastructure/app-definition-schema-contract.test.js +607 -0
- package/infrastructure/create-frigg-infrastructure.js +4 -1
- package/infrastructure/create-frigg-infrastructure.test.js +51 -0
- package/infrastructure/docs/POSTGRES-CONFIGURATION.md +60 -98
- package/package.json +7 -7
|
@@ -8,10 +8,10 @@ Frigg Framework supports automatic provisioning of Amazon Aurora Serverless v2 P
|
|
|
8
8
|
|
|
9
9
|
### Key Features
|
|
10
10
|
|
|
11
|
-
- **Aurora Serverless v2**: Cost-efficient auto-scaling database (0.5-
|
|
11
|
+
- **Aurora Serverless v2**: Cost-efficient auto-scaling database (0.5-4 ACU default)
|
|
12
12
|
- **VPC Integration**: Deployed in same private subnets as Lambda functions
|
|
13
13
|
- **Secrets Manager**: Automatic credential management and rotation
|
|
14
|
-
- **Three Management Modes**: discover,
|
|
14
|
+
- **Three Management Modes**: discover, managed, use-existing
|
|
15
15
|
- **Security**: Private subnet deployment with security group isolation
|
|
16
16
|
- **High Availability**: Multi-AZ deployment with automatic failover
|
|
17
17
|
|
|
@@ -21,12 +21,16 @@ Frigg Framework supports automatic provisioning of Amazon Aurora Serverless v2 P
|
|
|
21
21
|
|
|
22
22
|
### App Definition Structure
|
|
23
23
|
|
|
24
|
+
These are the keys the Aurora builder reads (see `database.postgres` in
|
|
25
|
+
`packages/schemas/schemas/app-definition.schema.json`). `frigg validate`
|
|
26
|
+
rejects any other key under `database.postgres`.
|
|
27
|
+
|
|
24
28
|
```javascript
|
|
25
29
|
// backend/index.js
|
|
26
30
|
const appDefinition = {
|
|
27
31
|
name: 'my-frigg-app',
|
|
28
32
|
|
|
29
|
-
//
|
|
33
|
+
// VPC Configuration (required for Aurora)
|
|
30
34
|
vpc: {
|
|
31
35
|
enable: true,
|
|
32
36
|
},
|
|
@@ -36,34 +40,24 @@ const appDefinition = {
|
|
|
36
40
|
postgres: {
|
|
37
41
|
enable: true,
|
|
38
42
|
|
|
39
|
-
//
|
|
43
|
+
// 'discover' (also when omitted) | 'managed' | 'use-existing'
|
|
44
|
+
// Ignored when managementMode is 'managed' or 'existing'.
|
|
40
45
|
management: 'discover',
|
|
41
46
|
|
|
42
|
-
//
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
// Engine Configuration
|
|
47
|
-
engine: 'aurora-postgresql',
|
|
48
|
-
engineVersion: '15.3',
|
|
49
|
-
|
|
50
|
-
// Scaling Configuration (Aurora Serverless v2)
|
|
51
|
-
scaling: {
|
|
52
|
-
minCapacity: 0.5, // ACUs (0.5 = ~1GB RAM, ~$43/month)
|
|
53
|
-
maxCapacity: 1.0, // ACUs (1.0 = ~2GB RAM, ~$87/month)
|
|
54
|
-
},
|
|
47
|
+
database: 'frigg', // database name (default 'frigg')
|
|
48
|
+
username: 'postgres', // master user (default 'postgres')
|
|
49
|
+
engineVersion: '15.13', // Aurora PostgreSQL version (default '15.13')
|
|
55
50
|
|
|
56
|
-
//
|
|
57
|
-
|
|
58
|
-
|
|
51
|
+
// Aurora Serverless v2 capacity, in ACUs (0.5-128)
|
|
52
|
+
minCapacity: 0.5, // default 0.5
|
|
53
|
+
maxCapacity: 4, // default 4
|
|
59
54
|
|
|
60
|
-
//
|
|
61
|
-
|
|
62
|
-
enablePerformanceInsights: false,
|
|
55
|
+
publiclyAccessible: false, // default false (private subnets)
|
|
56
|
+
autoCreateCredentials: false, // discover only: create a secret for a discovered cluster
|
|
63
57
|
|
|
64
|
-
//
|
|
65
|
-
|
|
66
|
-
|
|
58
|
+
// use-existing only
|
|
59
|
+
// endpoint: 'mydb.cluster-abc123.us-east-1.rds.amazonaws.com',
|
|
60
|
+
// port: 5432,
|
|
67
61
|
}
|
|
68
62
|
}
|
|
69
63
|
};
|
|
@@ -73,13 +67,17 @@ module.exports = {
|
|
|
73
67
|
};
|
|
74
68
|
```
|
|
75
69
|
|
|
70
|
+
Backup retention (7 days), the backup and maintenance windows and deletion
|
|
71
|
+
settings are fixed by the builder and are not configurable through the app
|
|
72
|
+
definition.
|
|
73
|
+
|
|
76
74
|
---
|
|
77
75
|
|
|
78
76
|
## Management Modes
|
|
79
77
|
|
|
80
78
|
### 1. Discover Mode (Default)
|
|
81
79
|
|
|
82
|
-
|
|
80
|
+
Discovers an existing Aurora cluster, or creates a new one in the stack if none is found.
|
|
83
81
|
|
|
84
82
|
```javascript
|
|
85
83
|
database: {
|
|
@@ -100,63 +98,56 @@ database: {
|
|
|
100
98
|
|
|
101
99
|
---
|
|
102
100
|
|
|
103
|
-
### 2.
|
|
101
|
+
### 2. Managed Mode
|
|
104
102
|
|
|
105
|
-
|
|
103
|
+
Creates the cluster, instance, subnet group and secret in the stack.
|
|
106
104
|
|
|
107
105
|
```javascript
|
|
108
106
|
database: {
|
|
109
107
|
postgres: {
|
|
110
108
|
enable: true,
|
|
111
|
-
management: '
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
databaseName: 'my_app_db',
|
|
115
|
-
masterUsername: 'admin',
|
|
116
|
-
engineVersion: '15.3',
|
|
117
|
-
scaling: {
|
|
118
|
-
minCapacity: 1.0,
|
|
119
|
-
maxCapacity: 2.0,
|
|
120
|
-
},
|
|
121
|
-
backupRetentionDays: 14,
|
|
122
|
-
deletionProtection: true,
|
|
109
|
+
management: 'managed',
|
|
110
|
+
minCapacity: 1,
|
|
111
|
+
maxCapacity: 2,
|
|
123
112
|
}
|
|
124
113
|
}
|
|
125
114
|
```
|
|
126
115
|
|
|
116
|
+
With the top-level `managementMode: 'managed'` (and `vpcIsolation: 'isolated'`),
|
|
117
|
+
Frigg manages the database per stage and `database.postgres.management` is ignored.
|
|
118
|
+
|
|
127
119
|
**Best For**: Production environments where you want dedicated database resources.
|
|
128
120
|
|
|
129
121
|
---
|
|
130
122
|
|
|
131
123
|
### 3. Use-Existing Mode
|
|
132
124
|
|
|
133
|
-
|
|
125
|
+
Connects to an existing PostgreSQL endpoint without creating database resources.
|
|
134
126
|
|
|
135
127
|
```javascript
|
|
136
128
|
database: {
|
|
137
129
|
postgres: {
|
|
138
130
|
enable: true,
|
|
139
131
|
management: 'use-existing',
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
// Optional: secret ARN (discovered if not provided)
|
|
145
|
-
secretArn: 'arn:aws:secretsmanager:us-east-1:123456789012:secret:my-db-secret',
|
|
146
|
-
|
|
147
|
-
// Database name to connect to
|
|
148
|
-
databaseName: 'frigg_db',
|
|
132
|
+
endpoint: 'my-cluster.cluster-abc123.us-east-1.rds.amazonaws.com', // required
|
|
133
|
+
port: 5432,
|
|
134
|
+
database: 'frigg_db',
|
|
135
|
+
username: 'frigg_admin',
|
|
149
136
|
}
|
|
150
137
|
}
|
|
151
138
|
```
|
|
152
139
|
|
|
140
|
+
To use an existing cluster by identifier instead, use the ownership form:
|
|
141
|
+
`ownership: { cluster: 'external', instance: 'external' }` with
|
|
142
|
+
`external: { clusterIdentifier, instanceIdentifier, secretArn }`.
|
|
143
|
+
|
|
153
144
|
**Best For**: Shared database scenarios or when you manage Aurora outside of Frigg.
|
|
154
145
|
|
|
155
146
|
---
|
|
156
147
|
|
|
157
148
|
## Created AWS Resources
|
|
158
149
|
|
|
159
|
-
When provisioning Aurora (`
|
|
150
|
+
When provisioning Aurora (`managed`, or `discover` mode without an existing cluster), Frigg creates:
|
|
160
151
|
|
|
161
152
|
### 1. RDS DB Subnet Group
|
|
162
153
|
- **Name**: `{service}-{stage}-db-subnet-group`
|
|
@@ -221,17 +212,15 @@ database: {
|
|
|
221
212
|
database: {
|
|
222
213
|
postgres: {
|
|
223
214
|
enable: true,
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
maxCapacity: 4.0, // Handle traffic spikes
|
|
227
|
-
},
|
|
228
|
-
backupRetentionDays: 30, // Longer retention
|
|
229
|
-
enablePerformanceInsights: true, // Monitoring
|
|
230
|
-
deletionProtection: true, // Prevent accidental deletion
|
|
215
|
+
minCapacity: 1, // Higher baseline for production
|
|
216
|
+
maxCapacity: 4, // Handle traffic spikes
|
|
231
217
|
}
|
|
232
218
|
}
|
|
233
219
|
```
|
|
234
220
|
|
|
221
|
+
Backup retention, Performance Insights and deletion protection are not
|
|
222
|
+
configurable through the app definition; change them on the cluster.
|
|
223
|
+
|
|
235
224
|
**Estimated Monthly Costs**:
|
|
236
225
|
- **Baseline**: $87/month (1.0 ACU minimum)
|
|
237
226
|
- **Peak Traffic**: $348/month (4.0 ACU maximum)
|
|
@@ -276,15 +265,9 @@ const users = await prismaClient.user.findMany();
|
|
|
276
265
|
|
|
277
266
|
### 4. Deletion Protection
|
|
278
267
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
deletionProtection: true, // Prevents accidental deletion
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
**Important**: When enabled, you must manually disable deletion protection in AWS console before stack deletion.
|
|
268
|
+
Deletion protection is not configurable through the app definition. Enable it
|
|
269
|
+
on the cluster in the AWS console (or with the AWS CLI); you must then disable
|
|
270
|
+
it before deleting the stack.
|
|
288
271
|
|
|
289
272
|
---
|
|
290
273
|
|
|
@@ -384,7 +367,7 @@ DB_TYPE=postgresql
|
|
|
384
367
|
database: {
|
|
385
368
|
postgres: {
|
|
386
369
|
enable: true,
|
|
387
|
-
management: '
|
|
370
|
+
management: 'managed',
|
|
388
371
|
}
|
|
389
372
|
}
|
|
390
373
|
```
|
|
@@ -411,7 +394,7 @@ DB_TYPE=postgresql
|
|
|
411
394
|
database: {
|
|
412
395
|
postgres: {
|
|
413
396
|
enable: true,
|
|
414
|
-
management: '
|
|
397
|
+
management: 'managed',
|
|
415
398
|
}
|
|
416
399
|
}
|
|
417
400
|
```
|
|
@@ -456,13 +439,13 @@ DB_TYPE=postgresql
|
|
|
456
439
|
|
|
457
440
|
**Error**:
|
|
458
441
|
```
|
|
459
|
-
No Aurora cluster found in discovery mode. Set management to "
|
|
442
|
+
No Aurora cluster found in discovery mode. Set management to "managed" or provide endpoint with "use-existing".
|
|
460
443
|
```
|
|
461
444
|
|
|
462
445
|
**Solution**:
|
|
463
446
|
1. Check VPC is enabled: `vpc.enable: true`
|
|
464
|
-
2. Set management mode: `management: '
|
|
465
|
-
3. Or
|
|
447
|
+
2. Set management mode: `management: 'managed'`
|
|
448
|
+
3. Or connect to a known endpoint: `management: 'use-existing'`, `endpoint: '...'`
|
|
466
449
|
|
|
467
450
|
---
|
|
468
451
|
|
|
@@ -544,41 +527,20 @@ Cannot create Aurora cluster: InsufficientDBInstanceCapacity
|
|
|
544
527
|
|
|
545
528
|
## Advanced Configuration
|
|
546
529
|
|
|
547
|
-
### Custom Backup Window
|
|
548
|
-
|
|
549
|
-
```javascript
|
|
550
|
-
database: {
|
|
551
|
-
postgres: {
|
|
552
|
-
enable: true,
|
|
553
|
-
backupRetentionDays: 30,
|
|
554
|
-
preferredBackupWindow: '02:00-03:00', // UTC
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
```
|
|
558
|
-
|
|
559
|
-
### Enhanced Monitoring
|
|
560
|
-
|
|
561
|
-
```javascript
|
|
562
|
-
database: {
|
|
563
|
-
postgres: {
|
|
564
|
-
enable: true,
|
|
565
|
-
enablePerformanceInsights: true,
|
|
566
|
-
// Performance Insights retention: 7 days (default) or 731 days
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
```
|
|
570
|
-
|
|
571
530
|
### Custom Engine Version
|
|
572
531
|
|
|
573
532
|
```javascript
|
|
574
533
|
database: {
|
|
575
534
|
postgres: {
|
|
576
535
|
enable: true,
|
|
577
|
-
engineVersion: '
|
|
536
|
+
engineVersion: '16.4', // Default: 15.13
|
|
578
537
|
}
|
|
579
538
|
}
|
|
580
539
|
```
|
|
581
540
|
|
|
541
|
+
The backup window, backup retention and Performance Insights are set by the
|
|
542
|
+
builder and are not configurable through the app definition.
|
|
543
|
+
|
|
582
544
|
### Read Replicas (Not Supported Yet)
|
|
583
545
|
|
|
584
546
|
Frigg currently provisions a single Aurora instance. For read replicas:
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@friggframework/devtools",
|
|
3
3
|
"prettier": "@friggframework/prettier-config",
|
|
4
|
-
"version": "2.0.0--canary.
|
|
4
|
+
"version": "2.0.0--canary.702.3f342da.0",
|
|
5
5
|
"bin": {
|
|
6
6
|
"frigg": "./frigg-cli/index.js"
|
|
7
7
|
},
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"@babel/eslint-parser": "^7.18.9",
|
|
27
27
|
"@babel/parser": "^7.25.3",
|
|
28
28
|
"@babel/traverse": "^7.25.3",
|
|
29
|
-
"@friggframework/core": "2.0.0--canary.
|
|
30
|
-
"@friggframework/schemas": "2.0.0--canary.
|
|
31
|
-
"@friggframework/test": "2.0.0--canary.
|
|
29
|
+
"@friggframework/core": "2.0.0--canary.702.3f342da.0",
|
|
30
|
+
"@friggframework/schemas": "2.0.0--canary.702.3f342da.0",
|
|
31
|
+
"@friggframework/test": "2.0.0--canary.702.3f342da.0",
|
|
32
32
|
"@hapi/boom": "^10.0.1",
|
|
33
33
|
"@inquirer/prompts": "^5.3.8",
|
|
34
34
|
"axios": "^1.18.0",
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"validate-npm-package-name": "^5.0.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@friggframework/eslint-config": "2.0.0--canary.
|
|
60
|
-
"@friggframework/prettier-config": "2.0.0--canary.
|
|
59
|
+
"@friggframework/eslint-config": "2.0.0--canary.702.3f342da.0",
|
|
60
|
+
"@friggframework/prettier-config": "2.0.0--canary.702.3f342da.0",
|
|
61
61
|
"aws-sdk-client-mock": "^4.1.0",
|
|
62
62
|
"aws-sdk-client-mock-jest": "^4.1.0",
|
|
63
63
|
"jest": "^30.1.3",
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
"publishConfig": {
|
|
90
90
|
"access": "public"
|
|
91
91
|
},
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "3f342daf8aac3124f25936bb8b327b447024ca4c"
|
|
93
93
|
}
|