@studion/infra-code-blocks 2.0.0-alpha.3 → 2.0.0-alpha.5
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/dist/components/acm-certificate/index.js +6 -1
- package/dist/components/cloudfront/index.d.ts.map +1 -1
- package/dist/components/cloudfront/index.js +93 -46
- package/dist/components/cloudfront/lb-cache-strategy.js +9 -1
- package/dist/components/cloudfront/s3-cache-strategy.js +12 -4
- package/dist/components/database/builder.js +34 -7
- package/dist/components/database/database-replica.js +27 -3
- package/dist/components/database/ec2-ssm-connect.d.ts +2 -2
- package/dist/components/database/ec2-ssm-connect.d.ts.map +1 -1
- package/dist/components/database/ec2-ssm-connect.js +40 -23
- package/dist/components/database/index.js +55 -7
- package/dist/components/ecs-service/index.d.ts +15 -0
- package/dist/components/ecs-service/index.d.ts.map +1 -1
- package/dist/components/ecs-service/index.js +73 -30
- package/dist/components/grafana/dashboards/panels.js +23 -17
- package/dist/components/grafana/dashboards/web-server-slo.js +4 -1
- package/dist/components/password/index.js +7 -1
- package/dist/components/prometheus/queries.test.js +10 -19
- package/dist/components/redis/elasticache-redis.js +6 -1
- package/dist/components/redis/upstash-redis.js +8 -2
- package/dist/components/static-site/index.js +7 -1
- package/dist/components/static-site/s3-assets.js +4 -1
- package/dist/components/vpc/index.d.ts.map +1 -1
- package/dist/components/vpc/index.js +6 -2
- package/dist/components/web-server/builder.d.ts +4 -4
- package/dist/components/web-server/builder.d.ts.map +1 -1
- package/dist/components/web-server/builder.js +41 -12
- package/dist/components/web-server/index.d.ts +1 -1
- package/dist/components/web-server/index.d.ts.map +1 -1
- package/dist/components/web-server/index.js +49 -14
- package/dist/components/web-server/load-balancer.js +13 -3
- package/dist/otel/builder.js +4 -1
- package/dist/otel/config.js +11 -14
- package/dist/otel/index.js +7 -3
- package/package.json +34 -44
|
@@ -21,8 +21,22 @@ const defaults = {
|
|
|
21
21
|
engineVersion: '17.2',
|
|
22
22
|
};
|
|
23
23
|
class Database extends pulumi.ComponentResource {
|
|
24
|
+
name;
|
|
25
|
+
instance;
|
|
26
|
+
vpc;
|
|
27
|
+
dbSubnetGroup;
|
|
28
|
+
dbSecurityGroup;
|
|
29
|
+
password;
|
|
30
|
+
kmsKeyId;
|
|
31
|
+
monitoringRole;
|
|
32
|
+
encryptedSnapshotCopy;
|
|
33
|
+
replica;
|
|
34
|
+
ec2SSMConnect;
|
|
24
35
|
constructor(name, args, opts = {}) {
|
|
25
|
-
super('studion:database:Database', name, {},
|
|
36
|
+
super('studion:database:Database', name, {}, {
|
|
37
|
+
...opts,
|
|
38
|
+
aliases: [...(opts.aliases || []), { type: 'studion:Database' }],
|
|
39
|
+
});
|
|
26
40
|
this.name = name;
|
|
27
41
|
const argsWithDefaults = (0, merge_with_defaults_1.mergeWithDefaults)(defaults, args);
|
|
28
42
|
const { vpc, kmsKeyId, enableMonitoring, snapshotIdentifier, createReplica, replicaConfig = {}, enableSSMConnect, ssmConnectConfig = {}, } = argsWithDefaults;
|
|
@@ -117,14 +131,21 @@ class Database extends pulumi.ComponentResource {
|
|
|
117
131
|
const monitoringRole = config.enableMonitoring
|
|
118
132
|
? config.monitoringRole || this.monitoringRole
|
|
119
133
|
: undefined;
|
|
120
|
-
const replica = new database_replica_1.DatabaseReplica(`${this.name}-replica`,
|
|
134
|
+
const replica = new database_replica_1.DatabaseReplica(`${this.name}-replica`, {
|
|
135
|
+
replicateSourceDb: this.instance.dbInstanceIdentifier.apply(id => id),
|
|
136
|
+
dbSecurityGroup: this.dbSecurityGroup,
|
|
137
|
+
monitoringRole,
|
|
138
|
+
...config,
|
|
139
|
+
}, { parent: this, dependsOn: [this.instance] });
|
|
121
140
|
return replica;
|
|
122
141
|
}
|
|
123
142
|
createEc2SSMConnect(config = {}) {
|
|
124
|
-
return new ec2_ssm_connect_1.Ec2SSMConnect(`${this.name}-ssm-connect`,
|
|
143
|
+
return new ec2_ssm_connect_1.Ec2SSMConnect(`${this.name}-ssm-connect`, {
|
|
144
|
+
vpc: this.vpc,
|
|
145
|
+
...config,
|
|
146
|
+
}, { parent: this });
|
|
125
147
|
}
|
|
126
148
|
createDatabaseInstance(args) {
|
|
127
|
-
var _a, _b;
|
|
128
149
|
const monitoringOptions = args.enableMonitoring && this.monitoringRole
|
|
129
150
|
? {
|
|
130
151
|
monitoringInterval: 60,
|
|
@@ -133,11 +154,38 @@ class Database extends pulumi.ComponentResource {
|
|
|
133
154
|
performanceInsightsRetentionPeriod: 7,
|
|
134
155
|
}
|
|
135
156
|
: {};
|
|
136
|
-
const instance = new awsNative.rds.DbInstance(`${this.name}-rds`,
|
|
157
|
+
const instance = new awsNative.rds.DbInstance(`${this.name}-rds`, {
|
|
158
|
+
dbInstanceIdentifier: `${this.name}-db-instance`,
|
|
159
|
+
engine: 'postgres',
|
|
160
|
+
engineVersion: args.engineVersion,
|
|
161
|
+
dbInstanceClass: args.instanceClass,
|
|
162
|
+
dbName: args.dbName,
|
|
163
|
+
masterUsername: args.username,
|
|
164
|
+
masterUserPassword: this.password.value,
|
|
165
|
+
dbSubnetGroupName: this.dbSubnetGroup.name,
|
|
166
|
+
vpcSecurityGroups: [this.dbSecurityGroup.id],
|
|
167
|
+
allocatedStorage: args.allocatedStorage?.toString(),
|
|
168
|
+
maxAllocatedStorage: args.maxAllocatedStorage,
|
|
169
|
+
multiAz: args.multiAz,
|
|
170
|
+
applyImmediately: args.applyImmediately,
|
|
171
|
+
allowMajorVersionUpgrade: args.allowMajorVersionUpgrade,
|
|
172
|
+
autoMinorVersionUpgrade: args.autoMinorVersionUpgrade,
|
|
173
|
+
kmsKeyId: this.kmsKeyId,
|
|
174
|
+
storageEncrypted: true,
|
|
175
|
+
publiclyAccessible: false,
|
|
176
|
+
preferredMaintenanceWindow: 'Mon:07:00-Mon:07:30',
|
|
177
|
+
preferredBackupWindow: '06:00-06:30',
|
|
178
|
+
backupRetentionPeriod: 14,
|
|
179
|
+
caCertificateIdentifier: 'rds-ca-rsa2048-g1',
|
|
180
|
+
dbParameterGroupName: args.parameterGroupName,
|
|
181
|
+
dbSnapshotIdentifier: this.encryptedSnapshotCopy?.targetDbSnapshotIdentifier,
|
|
182
|
+
...monitoringOptions,
|
|
183
|
+
tags: pulumi
|
|
137
184
|
.output(args.tags)
|
|
138
185
|
.apply(tags => [
|
|
139
|
-
...Object.entries(
|
|
140
|
-
])
|
|
186
|
+
...Object.entries({ ...common_tags_1.commonTags, ...tags }).map(([key, value]) => ({ key, value })),
|
|
187
|
+
]),
|
|
188
|
+
}, { parent: this, dependsOn: [this.password] });
|
|
141
189
|
return instance;
|
|
142
190
|
}
|
|
143
191
|
}
|
|
@@ -68,6 +68,11 @@ export declare namespace EcsService {
|
|
|
68
68
|
containers: EcsService.Container[];
|
|
69
69
|
loadBalancers?: pulumi.Input<LoadBalancerConfig[]>;
|
|
70
70
|
volumes?: pulumi.Input<pulumi.Input<EcsService.PersistentStorageVolume>[]>;
|
|
71
|
+
/**
|
|
72
|
+
* Name to set for the ECS Service.
|
|
73
|
+
* @default ${this.name}
|
|
74
|
+
*/
|
|
75
|
+
name?: pulumi.Input<string>;
|
|
71
76
|
/**
|
|
72
77
|
* Type of deployment controller to use.
|
|
73
78
|
* @default "ECS"
|
|
@@ -78,6 +83,11 @@ export declare namespace EcsService {
|
|
|
78
83
|
* @default 1
|
|
79
84
|
*/
|
|
80
85
|
desiredCount?: pulumi.Input<number>;
|
|
86
|
+
/**
|
|
87
|
+
* Family for the task definition. Used for grouping of multiple versions.
|
|
88
|
+
* @default ${this.name}-task-definition-${stackName}
|
|
89
|
+
*/
|
|
90
|
+
family?: pulumi.Input<string>;
|
|
81
91
|
/**
|
|
82
92
|
* CPU and memory size used for running the container.
|
|
83
93
|
* Available predefined options are:
|
|
@@ -90,6 +100,11 @@ export declare namespace EcsService {
|
|
|
90
100
|
* @default "small"
|
|
91
101
|
*/
|
|
92
102
|
size?: pulumi.Input<TaskSize>;
|
|
103
|
+
/**
|
|
104
|
+
* Name prefix of the AWS CloudWatch log group.
|
|
105
|
+
* @default /ecs/${this.name}-
|
|
106
|
+
*/
|
|
107
|
+
logGroupNamePrefix?: pulumi.Input<string>;
|
|
93
108
|
/**
|
|
94
109
|
* Custom service security group
|
|
95
110
|
* In case no security group is provided, default security group will be automatically created.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ecs-service/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AACzC,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AACnC,OAAO,KAAK,IAAI,MAAM,cAAc,CAAC;AAIrC,OAAO,EAAE,QAAQ,EAAiB,MAAM,aAAa,CAAC;AAKtD,KAAK,iBAAiB,GAAG;IACvB,UAAU,EAAE,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC;IAC/B,WAAW,EAAE,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC;CAClC,CAAC;AAEF,yBAAiB,UAAU,CAAC;IAC1B;;;;;OAKG;IACH,KAAY,uBAAuB,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;KAAE,CAAC;IAErE;;;;;;;OAOG;IACH,KAAY,2BAA2B,GAAG;QACxC,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACnC,aAAa,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACpC,QAAQ,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;KAClC,CAAC;IAEF;;;OAGG;IACH,KAAY,SAAS,GAAG;QACtB,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC3B,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC5B,YAAY,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,GAA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A8EhC"}
|
|
@@ -39,8 +39,21 @@ const defaults = {
|
|
|
39
39
|
},
|
|
40
40
|
};
|
|
41
41
|
class EcsService extends pulumi.ComponentResource {
|
|
42
|
+
name;
|
|
43
|
+
vpc;
|
|
44
|
+
logGroup;
|
|
45
|
+
taskDefinition;
|
|
46
|
+
taskExecutionRole;
|
|
47
|
+
taskRole;
|
|
48
|
+
service;
|
|
49
|
+
securityGroups;
|
|
50
|
+
serviceDiscoveryService;
|
|
51
|
+
persistentStorage;
|
|
42
52
|
constructor(name, args, opts = {}) {
|
|
43
|
-
super('studion:ecs-service:EcsService', name, {},
|
|
53
|
+
super('studion:ecs-service:EcsService', name, {}, {
|
|
54
|
+
...opts,
|
|
55
|
+
aliases: [...(opts.aliases || []), { type: 'studion:ecs:Service' }],
|
|
56
|
+
});
|
|
44
57
|
const argsWithDefaults = (0, merge_with_defaults_1.mergeWithDefaults)(defaults, args);
|
|
45
58
|
const taskExecutionRoleInlinePolicies = pulumi.output(args.taskExecutionRoleInlinePolicies ||
|
|
46
59
|
defaults.taskExecutionRoleInlinePolicies);
|
|
@@ -48,7 +61,7 @@ class EcsService extends pulumi.ComponentResource {
|
|
|
48
61
|
this.name = name;
|
|
49
62
|
this.securityGroups = [];
|
|
50
63
|
this.vpc = pulumi.output(argsWithDefaults.vpc);
|
|
51
|
-
this.logGroup = this.createLogGroup();
|
|
64
|
+
this.logGroup = this.createLogGroup(argsWithDefaults.logGroupNamePrefix);
|
|
52
65
|
this.taskExecutionRole = this.createTaskExecutionRole(taskExecutionRoleInlinePolicies);
|
|
53
66
|
this.taskRole = this.createTaskRole(taskRoleInlinePolicies);
|
|
54
67
|
pulumi.output(argsWithDefaults.volumes).apply(volume => {
|
|
@@ -56,7 +69,7 @@ class EcsService extends pulumi.ComponentResource {
|
|
|
56
69
|
this.persistentStorage = this.createPersistentStorage(this.vpc);
|
|
57
70
|
}
|
|
58
71
|
});
|
|
59
|
-
this.taskDefinition = this.createTaskDefinition(argsWithDefaults.containers, pulumi.output(argsWithDefaults.volumes), this.taskExecutionRole, this.taskRole, argsWithDefaults.
|
|
72
|
+
this.taskDefinition = this.createTaskDefinition(argsWithDefaults.containers, pulumi.output(argsWithDefaults.volumes), this.taskExecutionRole, this.taskRole, argsWithDefaults.family, argsWithDefaults.size, { ...common_tags_1.commonTags, ...argsWithDefaults.tags });
|
|
60
73
|
if (argsWithDefaults.enableServiceAutoDiscovery) {
|
|
61
74
|
this.serviceDiscoveryService = this.createServiceDiscovery();
|
|
62
75
|
}
|
|
@@ -73,15 +86,15 @@ class EcsService extends pulumi.ComponentResource {
|
|
|
73
86
|
protocol: 'tcp',
|
|
74
87
|
};
|
|
75
88
|
}
|
|
76
|
-
createLogGroup() {
|
|
89
|
+
createLogGroup(namePrefix) {
|
|
77
90
|
const logGroup = new aws.cloudwatch.LogGroup(`${this.name}-log-group`, {
|
|
78
91
|
retentionInDays: 14,
|
|
79
|
-
namePrefix: `/ecs/${this.name}-`,
|
|
92
|
+
namePrefix: namePrefix ?? `/ecs/${this.name}-`,
|
|
80
93
|
tags: common_tags_1.commonTags,
|
|
81
94
|
}, { parent: this });
|
|
82
95
|
return logGroup;
|
|
83
96
|
}
|
|
84
|
-
createTaskDefinition(containers, volumes, taskExecutionRole, taskRole, size, tags) {
|
|
97
|
+
createTaskDefinition(containers, volumes, taskExecutionRole, taskRole, family, size, tags) {
|
|
85
98
|
const stack = pulumi.getStack();
|
|
86
99
|
const { cpu, memory } = pulumi.output(size).apply(task_size_1.parseTaskSize);
|
|
87
100
|
const containerDefinitions = containers.map(container => {
|
|
@@ -90,8 +103,18 @@ class EcsService extends pulumi.ComponentResource {
|
|
|
90
103
|
const taskDefinitionVolumes = this.createTaskDefinitionVolumes(volumes);
|
|
91
104
|
return pulumi.all(containerDefinitions).apply(containerDefinitions => {
|
|
92
105
|
return taskDefinitionVolumes.apply(volumes => {
|
|
93
|
-
return new aws.ecs.TaskDefinition(`${this.name}-task-definition`,
|
|
94
|
-
|
|
106
|
+
return new aws.ecs.TaskDefinition(`${this.name}-task-definition`, {
|
|
107
|
+
family: family ?? `${this.name}-task-definition-${stack}`,
|
|
108
|
+
networkMode: 'awsvpc',
|
|
109
|
+
executionRoleArn: taskExecutionRole.arn,
|
|
110
|
+
taskRoleArn: taskRole.arn,
|
|
111
|
+
cpu,
|
|
112
|
+
memory,
|
|
113
|
+
requiresCompatibilities: ['FARGATE'],
|
|
114
|
+
containerDefinitions: JSON.stringify(containerDefinitions),
|
|
115
|
+
...(volumes?.length ? { volumes } : {}),
|
|
116
|
+
tags: { ...common_tags_1.commonTags, ...tags },
|
|
117
|
+
}, { parent: this });
|
|
95
118
|
});
|
|
96
119
|
});
|
|
97
120
|
}
|
|
@@ -113,26 +136,31 @@ class EcsService extends pulumi.ComponentResource {
|
|
|
113
136
|
});
|
|
114
137
|
}
|
|
115
138
|
createContainerDefinition(container) {
|
|
116
|
-
return this.logGroup.name.apply(logGroupName => (
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
mountPoint
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
139
|
+
return this.logGroup.name.apply(logGroupName => ({
|
|
140
|
+
...container,
|
|
141
|
+
readonlyRootFilesystem: false,
|
|
142
|
+
...(container.mountPoints && {
|
|
143
|
+
mountPoints: container.mountPoints.map(mountPoint => pulumi
|
|
144
|
+
.all([
|
|
145
|
+
mountPoint.sourceVolume,
|
|
146
|
+
mountPoint.containerPath,
|
|
147
|
+
mountPoint.readOnly,
|
|
148
|
+
])
|
|
149
|
+
.apply(([sourceVolume, containerPath, readOnly]) => ({
|
|
150
|
+
containerPath,
|
|
151
|
+
sourceVolume,
|
|
152
|
+
readOnly: readOnly ?? false,
|
|
153
|
+
}))),
|
|
154
|
+
}),
|
|
155
|
+
logConfiguration: {
|
|
129
156
|
logDriver: 'awslogs',
|
|
130
157
|
options: {
|
|
131
158
|
'awslogs-group': logGroupName,
|
|
132
159
|
'awslogs-region': awsRegion,
|
|
133
160
|
'awslogs-stream-prefix': 'ecs',
|
|
134
161
|
},
|
|
135
|
-
}
|
|
162
|
+
},
|
|
163
|
+
}));
|
|
136
164
|
}
|
|
137
165
|
createTaskExecutionRole(inlinePolicies) {
|
|
138
166
|
const secretManagerSecretsInlinePolicy = {
|
|
@@ -236,13 +264,25 @@ class EcsService extends pulumi.ComponentResource {
|
|
|
236
264
|
.all(this.securityGroups)
|
|
237
265
|
.apply(groups => groups.map(it => it.id)),
|
|
238
266
|
};
|
|
239
|
-
return new aws.ecs.Service(`${this.name}-service`,
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
267
|
+
return new aws.ecs.Service(`${this.name}-service`, {
|
|
268
|
+
name: ecsServiceArgs.name ?? this.name,
|
|
269
|
+
cluster: pulumi.output(ecsServiceArgs.cluster).id,
|
|
270
|
+
launchType: 'FARGATE',
|
|
271
|
+
deploymentController: { type: ecsServiceArgs.deploymentController },
|
|
272
|
+
desiredCount: ecsServiceArgs.desiredCount,
|
|
273
|
+
taskDefinition: this.taskDefinition.arn,
|
|
274
|
+
enableExecuteCommand: true,
|
|
275
|
+
networkConfiguration,
|
|
276
|
+
...(ecsServiceArgs.loadBalancers && {
|
|
277
|
+
loadBalancers: ecsServiceArgs.loadBalancers,
|
|
278
|
+
}),
|
|
279
|
+
...(this.serviceDiscoveryService && {
|
|
280
|
+
serviceRegistries: {
|
|
281
|
+
registryArn: this.serviceDiscoveryService.arn,
|
|
282
|
+
},
|
|
283
|
+
}),
|
|
284
|
+
tags: { ...common_tags_1.commonTags, ...ecsServiceArgs.tags },
|
|
285
|
+
}, { parent: this });
|
|
246
286
|
}
|
|
247
287
|
createServiceDiscovery() {
|
|
248
288
|
const privateDnsNamespace = this.createPrivateDnsNameSpace();
|
|
@@ -315,7 +355,10 @@ class EcsService extends pulumi.ComponentResource {
|
|
|
315
355
|
],
|
|
316
356
|
performanceMode: 'generalPurpose',
|
|
317
357
|
throughputMode: 'bursting',
|
|
318
|
-
tags:
|
|
358
|
+
tags: {
|
|
359
|
+
...common_tags_1.commonTags,
|
|
360
|
+
Name: `${this.name}-data`,
|
|
361
|
+
},
|
|
319
362
|
}, { parent: this });
|
|
320
363
|
const securityGroup = new aws.ec2.SecurityGroup(`${this.name}-persistent-storage-security-group`, {
|
|
321
364
|
vpcId: vpc.vpcId,
|
|
@@ -22,14 +22,17 @@ function createStatPercentagePanel(title, position, dataSource, metric) {
|
|
|
22
22
|
},
|
|
23
23
|
],
|
|
24
24
|
fieldConfig: {
|
|
25
|
-
defaults:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
defaults: {
|
|
26
|
+
...percentageFieldConfig,
|
|
27
|
+
...(metric.thresholds
|
|
28
|
+
? {
|
|
29
|
+
thresholds: {
|
|
30
|
+
mode: 'absolute',
|
|
31
|
+
steps: metric.thresholds,
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
: {}),
|
|
35
|
+
},
|
|
33
36
|
},
|
|
34
37
|
};
|
|
35
38
|
}
|
|
@@ -49,16 +52,19 @@ function createTimeSeriesPanel(title, position, dataSource, metric, unit, min, m
|
|
|
49
52
|
},
|
|
50
53
|
],
|
|
51
54
|
fieldConfig: {
|
|
52
|
-
defaults:
|
|
55
|
+
defaults: {
|
|
56
|
+
unit,
|
|
53
57
|
min,
|
|
54
|
-
max
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
max,
|
|
59
|
+
...(metric.thresholds
|
|
60
|
+
? {
|
|
61
|
+
thresholds: {
|
|
62
|
+
mode: 'absolute',
|
|
63
|
+
steps: metric.thresholds,
|
|
64
|
+
},
|
|
65
|
+
}
|
|
66
|
+
: {}),
|
|
67
|
+
},
|
|
62
68
|
},
|
|
63
69
|
};
|
|
64
70
|
}
|
|
@@ -5,8 +5,11 @@ const grafana = require("@pulumiverse/grafana");
|
|
|
5
5
|
const prometheus_1 = require("../../prometheus");
|
|
6
6
|
const panels_1 = require("./panels");
|
|
7
7
|
class WebServerSloDashboardBuilder {
|
|
8
|
+
name;
|
|
9
|
+
title;
|
|
10
|
+
panels = [];
|
|
11
|
+
tags;
|
|
8
12
|
constructor(name, args) {
|
|
9
|
-
this.panels = [];
|
|
10
13
|
this.name = name;
|
|
11
14
|
this.title = pulumi.output(args.title);
|
|
12
15
|
}
|
|
@@ -6,8 +6,14 @@ const pulumi = require("@pulumi/pulumi");
|
|
|
6
6
|
const random = require("@pulumi/random");
|
|
7
7
|
const common_tags_1 = require("../../shared/common-tags");
|
|
8
8
|
class Password extends pulumi.ComponentResource {
|
|
9
|
+
name;
|
|
10
|
+
value;
|
|
11
|
+
secret;
|
|
9
12
|
constructor(name, args = {}, opts = {}) {
|
|
10
|
-
super('studion:password:Password', name, {},
|
|
13
|
+
super('studion:password:Password', name, {}, {
|
|
14
|
+
...opts,
|
|
15
|
+
aliases: [...(opts.aliases || []), { type: 'studion:Password' }],
|
|
16
|
+
});
|
|
11
17
|
this.name = name;
|
|
12
18
|
if (args.value) {
|
|
13
19
|
this.value = pulumi.secret(args.value);
|
|
@@ -1,46 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
const node_test_1 = require("node:test");
|
|
13
4
|
const assert = require("node:assert/strict");
|
|
14
5
|
const queries_1 = require("./queries");
|
|
15
|
-
(0, node_test_1.describe)('Prometheus Query Builders', () =>
|
|
6
|
+
(0, node_test_1.describe)('Prometheus Query Builders', async () => {
|
|
16
7
|
const namespace = 'app';
|
|
17
8
|
const timeRange = '2m';
|
|
18
9
|
const apiRouteFilter = 'http_route=~"/api/.*"';
|
|
19
|
-
(0, node_test_1.describe)('getAvailabilityQuery', () =>
|
|
10
|
+
(0, node_test_1.describe)('getAvailabilityQuery', async () => {
|
|
20
11
|
(0, node_test_1.it)('should build correct query', () => {
|
|
21
12
|
const result = (0, queries_1.getAvailabilityQuery)(namespace, timeRange);
|
|
22
13
|
const expected = `(sum(rate(${namespace}_http_server_duration_milliseconds_count{http_status_code!~"5.."}[${timeRange}]))) / ` +
|
|
23
14
|
`(sum(rate(${namespace}_http_server_duration_milliseconds_count[${timeRange}]))) * 100`;
|
|
24
15
|
assert.equal(result, expected);
|
|
25
16
|
});
|
|
26
|
-
})
|
|
27
|
-
(0, node_test_1.describe)('getSuccessRateQuery', () =>
|
|
17
|
+
});
|
|
18
|
+
(0, node_test_1.describe)('getSuccessRateQuery', async () => {
|
|
28
19
|
(0, node_test_1.it)('should build correct query', () => {
|
|
29
20
|
const result = (0, queries_1.getSuccessRateQuery)(namespace, timeRange, apiRouteFilter);
|
|
30
21
|
const expected = `(sum(rate(${namespace}_http_server_duration_milliseconds_count{http_status_code=~"[2-4]..",${apiRouteFilter}}[2m]))) / ` +
|
|
31
22
|
`(sum(rate(${namespace}_http_server_duration_milliseconds_count{${apiRouteFilter}}[2m]))) * 100`;
|
|
32
23
|
assert.equal(result, expected);
|
|
33
24
|
});
|
|
34
|
-
})
|
|
35
|
-
(0, node_test_1.describe)('getPercentileLatencyQuery', () =>
|
|
25
|
+
});
|
|
26
|
+
(0, node_test_1.describe)('getPercentileLatencyQuery', async () => {
|
|
36
27
|
(0, node_test_1.it)('should build correct query', () => {
|
|
37
28
|
const percentile = 0.95;
|
|
38
29
|
const result = (0, queries_1.getPercentileLatencyQuery)(namespace, timeRange, percentile, apiRouteFilter);
|
|
39
30
|
const expected = `histogram_quantile(${percentile}, sum by(le) (rate(${namespace}_http_server_duration_milliseconds_bucket{${apiRouteFilter}}[${timeRange}])))`;
|
|
40
31
|
assert.equal(result, expected);
|
|
41
32
|
});
|
|
42
|
-
})
|
|
43
|
-
(0, node_test_1.describe)('getLatencyPercentageQuery', () =>
|
|
33
|
+
});
|
|
34
|
+
(0, node_test_1.describe)('getLatencyPercentageQuery', async () => {
|
|
44
35
|
(0, node_test_1.it)('should build correct query', () => {
|
|
45
36
|
const threshold = 200;
|
|
46
37
|
const result = (0, queries_1.getLatencyPercentageQuery)(namespace, timeRange, threshold, apiRouteFilter);
|
|
@@ -48,5 +39,5 @@ const queries_1 = require("./queries");
|
|
|
48
39
|
`(sum(rate(${namespace}_http_server_duration_milliseconds_count{${apiRouteFilter}}[2m]))) * 100`;
|
|
49
40
|
assert.equal(result, expected);
|
|
50
41
|
});
|
|
51
|
-
})
|
|
52
|
-
})
|
|
42
|
+
});
|
|
43
|
+
});
|
|
@@ -11,6 +11,11 @@ const defaults = {
|
|
|
11
11
|
parameterGroupName: 'default.redis7',
|
|
12
12
|
};
|
|
13
13
|
class ElastiCacheRedis extends pulumi.ComponentResource {
|
|
14
|
+
name;
|
|
15
|
+
vpc;
|
|
16
|
+
cluster;
|
|
17
|
+
securityGroup;
|
|
18
|
+
subnetGroup;
|
|
14
19
|
constructor(name, args, opts = {}) {
|
|
15
20
|
super('studion:redis:ElastiCacheRedis', name, {}, opts);
|
|
16
21
|
const argsWithDefaults = (0, merge_with_defaults_1.mergeWithDefaults)(defaults, args);
|
|
@@ -31,7 +36,7 @@ class ElastiCacheRedis extends pulumi.ComponentResource {
|
|
|
31
36
|
subnetGroupName: this.subnetGroup.name,
|
|
32
37
|
parameterGroupName: parameterGroupName,
|
|
33
38
|
port: 6379,
|
|
34
|
-
tags:
|
|
39
|
+
tags: { ...common_tags_1.commonTags, ...tags },
|
|
35
40
|
}, { parent: this });
|
|
36
41
|
}
|
|
37
42
|
createSubnetGroup() {
|
|
@@ -10,10 +10,16 @@ const defaults = {
|
|
|
10
10
|
primaryRegion: 'us-east-1',
|
|
11
11
|
};
|
|
12
12
|
class UpstashRedis extends pulumi.ComponentResource {
|
|
13
|
+
name;
|
|
14
|
+
instance;
|
|
15
|
+
password;
|
|
13
16
|
constructor(name, args, opts = {}) {
|
|
14
|
-
super('studion:redis:UpstashRedis', name, {},
|
|
17
|
+
super('studion:redis:UpstashRedis', name, {}, {
|
|
18
|
+
...opts,
|
|
19
|
+
aliases: [...(opts.aliases || []), { type: 'studion:Redis' }],
|
|
20
|
+
});
|
|
15
21
|
const dbName = `${pulumi.getProject()}-${pulumi.getStack()}`;
|
|
16
|
-
const argsWithDefaults = (0, merge_with_defaults_1.mergeWithDefaults)(
|
|
22
|
+
const argsWithDefaults = (0, merge_with_defaults_1.mergeWithDefaults)({ ...defaults, dbName }, args);
|
|
17
23
|
this.name = name;
|
|
18
24
|
this.instance = new upstash.RedisDatabase(`${this.name}-database`, {
|
|
19
25
|
databaseName: argsWithDefaults.dbName,
|
|
@@ -6,8 +6,14 @@ const cache_rule_ttl_1 = require("./cache-rule-ttl");
|
|
|
6
6
|
const s3_assets_1 = require("./s3-assets");
|
|
7
7
|
const cloudfront_1 = require("../cloudfront");
|
|
8
8
|
class StaticSite extends pulumi.ComponentResource {
|
|
9
|
+
name;
|
|
10
|
+
s3Assets;
|
|
11
|
+
cf;
|
|
9
12
|
constructor(name, args, opts = {}) {
|
|
10
|
-
super('studion:static-site:StaticSite', name, {},
|
|
13
|
+
super('studion:static-site:StaticSite', name, {}, {
|
|
14
|
+
...opts,
|
|
15
|
+
aliases: [...(opts.aliases || []), { type: 'studion:StaticSite' }],
|
|
16
|
+
});
|
|
11
17
|
const { domain, hostedZoneId, certificate, bucketPrefix, indexDocument, errorDocument, cacheRules, tags, } = args;
|
|
12
18
|
if (!domain && !certificate) {
|
|
13
19
|
throw new Error('Provide either domain or certificate, or both');
|
|
@@ -5,6 +5,9 @@ const pulumi = require("@pulumi/pulumi");
|
|
|
5
5
|
const aws = require("@pulumi/aws");
|
|
6
6
|
const common_tags_1 = require("../../shared/common-tags");
|
|
7
7
|
class S3Assets extends pulumi.ComponentResource {
|
|
8
|
+
name;
|
|
9
|
+
bucket;
|
|
10
|
+
websiteConfig;
|
|
8
11
|
constructor(name, args, opts = {}) {
|
|
9
12
|
super('studion:static-site:S3Assets', name, {}, opts);
|
|
10
13
|
this.name = name;
|
|
@@ -30,7 +33,7 @@ class S3Assets extends pulumi.ComponentResource {
|
|
|
30
33
|
createWebsiteBucket(bucketPrefix, indexDocument, errorDocument, tags) {
|
|
31
34
|
const bucket = new aws.s3.Bucket(`${this.name}-bucket`, {
|
|
32
35
|
bucketPrefix,
|
|
33
|
-
tags:
|
|
36
|
+
tags: { ...common_tags_1.commonTags, ...tags },
|
|
34
37
|
}, { parent: this });
|
|
35
38
|
const config = new aws.s3.BucketWebsiteConfiguration(`${this.name}-bucket-website-config`, {
|
|
36
39
|
bucket: bucket.id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/vpc/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AACzC,OAAO,KAAK,IAAI,MAAM,cAAc,CAAC;AAKrC,MAAM,MAAM,OAAO,GAAG;IACpB;;;OAGG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC;QAClB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;KACrC,CAAC,CAAC;CACJ,CAAC;AAEF,eAAO,MAAM,QAAQ;;CAEpB,CAAC;AAEF,qBAAa,GAAI,SAAQ,MAAM,CAAC,iBAAiB;IAC/C,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;gBAGhB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,EACb,IAAI,GAAE,MAAM,CAAC,wBAA6B;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/vpc/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AACzC,OAAO,KAAK,IAAI,MAAM,cAAc,CAAC;AAKrC,MAAM,MAAM,OAAO,GAAG;IACpB;;;OAGG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC;QAClB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;KACrC,CAAC,CAAC;CACJ,CAAC;AAEF,eAAO,MAAM,QAAQ;;CAEpB,CAAC;AAEF,qBAAa,GAAI,SAAQ,MAAM,CAAC,iBAAiB;IAC/C,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;gBAGhB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,EACb,IAAI,GAAE,MAAM,CAAC,wBAA6B;CA4B7C"}
|
|
@@ -10,6 +10,7 @@ exports.defaults = {
|
|
|
10
10
|
numberOfAvailabilityZones: 2,
|
|
11
11
|
};
|
|
12
12
|
class Vpc extends pulumi.ComponentResource {
|
|
13
|
+
vpc;
|
|
13
14
|
constructor(name, args, opts = {}) {
|
|
14
15
|
super('studion:vpc:Vpc', name, {}, opts);
|
|
15
16
|
const argsWithDefaults = (0, merge_with_defaults_1.mergeWithDefaults)(exports.defaults, args);
|
|
@@ -18,12 +19,15 @@ class Vpc extends pulumi.ComponentResource {
|
|
|
18
19
|
enableDnsHostnames: true,
|
|
19
20
|
enableDnsSupport: true,
|
|
20
21
|
subnetStrategy: types_1.enums.ec2.SubnetAllocationStrategy.Auto,
|
|
22
|
+
// Switching from `Legacy` to `Auto` strategy changed ordering of the specs
|
|
23
|
+
// `Auto` is using the provided ordering, while `Legacy` enforced `Private`, `Public`, `Isolated` ordering
|
|
24
|
+
// Applying ordering to match one from `Legacy` to avoid breaking changes
|
|
21
25
|
subnetSpecs: [
|
|
22
|
-
{ type: awsx.ec2.SubnetType.Public, cidrMask: 24 },
|
|
23
26
|
{ type: awsx.ec2.SubnetType.Private, cidrMask: 24 },
|
|
27
|
+
{ type: awsx.ec2.SubnetType.Public, cidrMask: 24 },
|
|
24
28
|
{ type: awsx.ec2.SubnetType.Isolated, cidrMask: 24 },
|
|
25
29
|
],
|
|
26
|
-
tags:
|
|
30
|
+
tags: { ...common_tags_1.commonTags, ...argsWithDefaults.tags },
|
|
27
31
|
}, { parent: this });
|
|
28
32
|
this.registerOutputs();
|
|
29
33
|
}
|
|
@@ -22,14 +22,14 @@ export declare class WebServerBuilder {
|
|
|
22
22
|
private _sidecarContainers;
|
|
23
23
|
private _volumes;
|
|
24
24
|
constructor(name: string);
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
withContainer(image: WebServer.Container['image'], port: WebServer.Container['port'], config?: Omit<WebServer.Container, 'image' | 'port'>): this;
|
|
26
|
+
withEcsConfig(config: WebServerBuilder.EcsConfig): this;
|
|
27
27
|
withVpc(vpc: pulumi.Input<awsx.ec2.Vpc>): this;
|
|
28
28
|
withVolume(volume: EcsService.PersistentStorageVolume): this;
|
|
29
29
|
withCustomDomain(domain: pulumi.Input<string>, hostedZoneId: pulumi.Input<string>): this;
|
|
30
30
|
withCertificate(certificate: WebServerBuilder.Args['certificate'], hostedZoneId: pulumi.Input<string>, domain?: pulumi.Input<string>): this;
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
addInitContainer(container: WebServer.InitContainer): this;
|
|
32
|
+
addSidecarContainer(container: WebServer.SidecarContainer): this;
|
|
33
33
|
withOtelCollector(collector: OtelCollector): this;
|
|
34
34
|
withCustomHealthCheckPath(path: WebServer.Args['healthCheckPath']): this;
|
|
35
35
|
withLoadBalancingAlgorithm(algorithm: pulumi.Input<string>): this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../../src/components/web-server/builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AAEzC,OAAO,KAAK,IAAI,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,yBAAiB,gBAAgB,CAAC;IAChC,KAAY,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,KAAK,GAAG,SAAS,CAAC,CAAC;IAErE,KAAY,IAAI,GAAG,IAAI,CACrB,SAAS,CAAC,IAAI,EACZ,KAAK,GACL,SAAS,GACT,SAAS,GACT,QAAQ,GACR,cAAc,GACd,qBAAqB,CACxB,CAAC;CACH;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,UAAU,CAAC,CAAsB;IACzC,OAAO,CAAC,IAAI,CAAC,CAA8B;IAC3C,OAAO,CAAC,UAAU,CAAC,CAA6B;IAChD,OAAO,CAAC,OAAO,CAAC,CAAuB;IACvC,OAAO,CAAC,aAAa,CAAC,CAAuB;IAC7C,OAAO,CAAC,YAAY,CAAC,CAAoC;IACzD,OAAO,CAAC,gBAAgB,CAAC,CAAuB;IAChD,OAAO,CAAC,2BAA2B,CAAC,CAAuB;IAC3D,OAAO,CAAC,cAAc,CAAC,CAA8B;IACrD,OAAO,CAAC,eAAe,CAA+C;IACtE,OAAO,CAAC,kBAAkB,CAAkD;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