@studion/infra-code-blocks 0.8.0-next.2 → 2.0.0-alpha.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/dist/components/acm-certificate/index.d.ts +20 -0
- package/dist/components/acm-certificate/index.d.ts.map +1 -0
- package/dist/components/acm-certificate/index.js +40 -0
- package/dist/components/cloudfront/index.d.ts +92 -0
- package/dist/components/cloudfront/index.d.ts.map +1 -0
- package/dist/components/cloudfront/index.js +208 -0
- package/dist/components/cloudfront/lb-cache-strategy.d.ts +21 -0
- package/dist/components/cloudfront/lb-cache-strategy.d.ts.map +1 -0
- package/dist/components/cloudfront/lb-cache-strategy.js +93 -0
- package/dist/components/cloudfront/s3-cache-strategy.d.ts +21 -0
- package/dist/components/cloudfront/s3-cache-strategy.d.ts.map +1 -0
- package/dist/components/cloudfront/s3-cache-strategy.js +78 -0
- package/dist/components/cloudfront/types.d.ts +10 -0
- package/dist/components/cloudfront/types.d.ts.map +1 -0
- package/dist/components/database/builder.d.ts +32 -0
- package/dist/components/database/builder.d.ts.map +1 -0
- package/dist/components/database/builder.js +82 -0
- package/dist/components/database/database-replica.d.ts +35 -0
- package/dist/components/database/database-replica.d.ts.map +1 -0
- package/dist/components/database/database-replica.js +40 -0
- package/dist/components/database/ec2-ssm-connect.d.ts +26 -0
- package/dist/components/database/ec2-ssm-connect.d.ts.map +1 -0
- package/dist/components/{ec2-ssm-connect.js → database/ec2-ssm-connect.js} +42 -34
- package/dist/components/database/index.d.ts +67 -0
- package/dist/components/database/index.d.ts.map +1 -0
- package/dist/components/database/index.js +144 -0
- package/dist/{v2/components → components}/ecs-service/index.d.ts +6 -5
- package/dist/components/ecs-service/index.d.ts.map +1 -0
- package/dist/{v2/components → components}/ecs-service/index.js +19 -30
- package/dist/components/ecs-service/policies.d.ts +3 -0
- package/dist/components/ecs-service/policies.d.ts.map +1 -0
- package/dist/components/ecs-service/task-size.d.ts +37 -0
- package/dist/components/ecs-service/task-size.d.ts.map +1 -0
- package/dist/{constants.js → components/ecs-service/task-size.js} +17 -7
- package/dist/components/grafana/dashboards/index.d.ts.map +1 -0
- package/dist/components/grafana/dashboards/panels.d.ts.map +1 -0
- package/dist/components/grafana/dashboards/types.d.ts.map +1 -0
- package/dist/components/grafana/dashboards/web-server-slo.d.ts.map +1 -0
- package/dist/components/grafana/index.d.ts.map +1 -0
- package/dist/components/password/index.d.ts +15 -0
- package/dist/components/password/index.d.ts.map +1 -0
- package/dist/components/{password.js → password/index.js} +6 -9
- package/dist/components/prometheus/index.d.ts.map +1 -0
- package/dist/components/prometheus/queries.d.ts.map +1 -0
- package/dist/components/prometheus/queries.test.d.ts.map +1 -0
- package/dist/components/redis/elasticache-redis.d.ts +38 -0
- package/dist/components/redis/elasticache-redis.d.ts.map +1 -0
- package/dist/components/redis/elasticache-redis.js +58 -0
- package/dist/components/redis/upstash-redis.d.ts +20 -0
- package/dist/components/redis/upstash-redis.d.ts.map +1 -0
- package/dist/components/redis/upstash-redis.js +29 -0
- package/dist/components/static-site/index.d.ts +23 -0
- package/dist/components/static-site/index.d.ts.map +1 -0
- package/dist/components/static-site/index.js +32 -0
- package/dist/components/static-site/s3-assets.d.ts +20 -0
- package/dist/components/static-site/s3-assets.d.ts.map +1 -0
- package/dist/components/static-site/s3-assets.js +63 -0
- package/dist/components/vpc/index.d.ts +20 -0
- package/dist/components/vpc/index.d.ts.map +1 -0
- package/dist/components/vpc/index.js +31 -0
- package/dist/{v2/components → components}/web-server/builder.d.ts +6 -2
- package/dist/components/web-server/builder.d.ts.map +1 -0
- package/dist/{v2/components → components}/web-server/builder.js +11 -1
- package/dist/{v2/components → components}/web-server/index.d.ts +30 -8
- package/dist/components/web-server/index.d.ts.map +1 -0
- package/dist/{v2/components → components}/web-server/index.js +49 -40
- package/dist/{v2/components → components}/web-server/load-balancer.d.ts +4 -3
- package/dist/components/web-server/load-balancer.d.ts.map +1 -0
- package/dist/{v2/components → components}/web-server/load-balancer.js +17 -14
- package/dist/index.d.ts +24 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +38 -26
- package/dist/otel/batch-processor.d.ts.map +1 -0
- package/dist/{v2/otel → otel}/builder.d.ts +15 -2
- package/dist/otel/builder.d.ts.map +1 -0
- package/dist/{v2/otel → otel}/builder.js +47 -2
- package/dist/{v2/otel → otel}/config.d.ts +13 -1
- package/dist/otel/config.d.ts.map +1 -0
- package/dist/{v2/otel → otel}/config.js +20 -3
- package/dist/{v2/otel → otel}/index.d.ts +8 -0
- package/dist/otel/index.d.ts.map +1 -0
- package/dist/otel/memory-limiter-processor.d.ts.map +1 -0
- package/dist/otel/otlp-receiver.d.ts.map +1 -0
- package/dist/otel/prometheus-remote-write-exporter.d.ts.map +1 -0
- package/dist/shared/common-tags.d.ts +5 -0
- package/dist/shared/common-tags.d.ts.map +1 -0
- package/dist/shared/common-tags.js +8 -0
- package/dist/shared/merge-with-defaults.d.ts +2 -0
- package/dist/shared/merge-with-defaults.d.ts.map +1 -0
- package/dist/shared/merge-with-defaults.js +7 -0
- package/package.json +32 -14
- package/dist/components/acm-certificate.d.ts +0 -11
- package/dist/components/acm-certificate.d.ts.map +0 -1
- package/dist/components/acm-certificate.js +0 -30
- package/dist/components/database-replica.d.ts +0 -69
- package/dist/components/database-replica.d.ts.map +0 -1
- package/dist/components/database-replica.js +0 -40
- package/dist/components/database.d.ts +0 -99
- package/dist/components/database.d.ts.map +0 -1
- package/dist/components/database.js +0 -118
- package/dist/components/ec2-ssm-connect.d.ts +0 -22
- package/dist/components/ec2-ssm-connect.d.ts.map +0 -1
- package/dist/components/ecs-service.d.ts +0 -143
- package/dist/components/ecs-service.d.ts.map +0 -1
- package/dist/components/ecs-service.js +0 -357
- package/dist/components/mongo.d.ts +0 -39
- package/dist/components/mongo.d.ts.map +0 -1
- package/dist/components/mongo.js +0 -54
- package/dist/components/nuxt-ssr.d.ts +0 -44
- package/dist/components/nuxt-ssr.d.ts.map +0 -1
- package/dist/components/nuxt-ssr.js +0 -277
- package/dist/components/password.d.ts +0 -13
- package/dist/components/password.d.ts.map +0 -1
- package/dist/components/project.d.ts +0 -77
- package/dist/components/project.d.ts.map +0 -1
- package/dist/components/project.js +0 -171
- package/dist/components/redis.d.ts +0 -23
- package/dist/components/redis.d.ts.map +0 -1
- package/dist/components/redis.js +0 -35
- package/dist/components/static-site.d.ts +0 -36
- package/dist/components/static-site.d.ts.map +0 -1
- package/dist/components/static-site.js +0 -138
- package/dist/components/web-server.d.ts +0 -38
- package/dist/components/web-server.d.ts.map +0 -1
- package/dist/components/web-server.js +0 -185
- package/dist/constants.d.ts +0 -23
- package/dist/constants.d.ts.map +0 -1
- package/dist/types/pulumi.d.ts +0 -5
- package/dist/types/pulumi.d.ts.map +0 -1
- package/dist/types/size.d.ts +0 -8
- package/dist/types/size.d.ts.map +0 -1
- package/dist/types/size.js +0 -2
- package/dist/v2/components/ecs-service/index.d.ts.map +0 -1
- package/dist/v2/components/ecs-service/policies.d.ts +0 -3
- package/dist/v2/components/ecs-service/policies.d.ts.map +0 -1
- package/dist/v2/components/grafana/dashboards/index.d.ts.map +0 -1
- package/dist/v2/components/grafana/dashboards/panels.d.ts.map +0 -1
- package/dist/v2/components/grafana/dashboards/types.d.ts.map +0 -1
- package/dist/v2/components/grafana/dashboards/web-server-slo.d.ts.map +0 -1
- package/dist/v2/components/grafana/index.d.ts.map +0 -1
- package/dist/v2/components/prometheus/index.d.ts.map +0 -1
- package/dist/v2/components/prometheus/queries.d.ts.map +0 -1
- package/dist/v2/components/prometheus/queries.test.d.ts.map +0 -1
- package/dist/v2/components/web-server/builder.d.ts.map +0 -1
- package/dist/v2/components/web-server/index.d.ts.map +0 -1
- package/dist/v2/components/web-server/load-balancer.d.ts.map +0 -1
- package/dist/v2/index.d.ts +0 -13
- package/dist/v2/index.d.ts.map +0 -1
- package/dist/v2/index.js +0 -16
- package/dist/v2/otel/batch-processor.d.ts.map +0 -1
- package/dist/v2/otel/builder.d.ts.map +0 -1
- package/dist/v2/otel/config.d.ts.map +0 -1
- package/dist/v2/otel/index.d.ts.map +0 -1
- package/dist/v2/otel/memory-limiter-processor.d.ts.map +0 -1
- package/dist/v2/otel/otlp-receiver.d.ts.map +0 -1
- package/dist/v2/otel/prometheus-remote-write-exporter.d.ts.map +0 -1
- /package/dist/{v2/components/grafana/dashboards → components/cloudfront}/types.js +0 -0
- /package/dist/{v2/components → components}/ecs-service/policies.js +0 -0
- /package/dist/{v2/components → components}/grafana/dashboards/index.d.ts +0 -0
- /package/dist/{v2/components → components}/grafana/dashboards/index.js +0 -0
- /package/dist/{v2/components → components}/grafana/dashboards/panels.d.ts +0 -0
- /package/dist/{v2/components → components}/grafana/dashboards/panels.js +0 -0
- /package/dist/{v2/components → components}/grafana/dashboards/types.d.ts +0 -0
- /package/dist/{types/pulumi.js → components/grafana/dashboards/types.js} +0 -0
- /package/dist/{v2/components → components}/grafana/dashboards/web-server-slo.d.ts +0 -0
- /package/dist/{v2/components → components}/grafana/dashboards/web-server-slo.js +0 -0
- /package/dist/{v2/components → components}/grafana/index.d.ts +0 -0
- /package/dist/{v2/components → components}/grafana/index.js +0 -0
- /package/dist/{v2/components → components}/prometheus/index.d.ts +0 -0
- /package/dist/{v2/components → components}/prometheus/index.js +0 -0
- /package/dist/{v2/components → components}/prometheus/queries.d.ts +0 -0
- /package/dist/{v2/components → components}/prometheus/queries.js +0 -0
- /package/dist/{v2/components → components}/prometheus/queries.test.d.ts +0 -0
- /package/dist/{v2/components → components}/prometheus/queries.test.js +0 -0
- /package/dist/{v2/otel → otel}/batch-processor.d.ts +0 -0
- /package/dist/{v2/otel → otel}/batch-processor.js +0 -0
- /package/dist/{v2/otel → otel}/index.js +0 -0
- /package/dist/{v2/otel → otel}/memory-limiter-processor.d.ts +0 -0
- /package/dist/{v2/otel → otel}/memory-limiter-processor.js +0 -0
- /package/dist/{v2/otel → otel}/otlp-receiver.d.ts +0 -0
- /package/dist/{v2/otel → otel}/otlp-receiver.js +0 -0
- /package/dist/{v2/otel → otel}/prometheus-remote-write-exporter.d.ts +0 -0
- /package/dist/{v2/otel → otel}/prometheus-remote-write-exporter.js +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as pulumi from '@pulumi/pulumi';
|
|
2
|
+
import * as awsx from '@pulumi/awsx-v3';
|
|
3
|
+
export type VpcArgs = {
|
|
4
|
+
/**
|
|
5
|
+
* Number of availability zones to which the subnets defined in subnetSpecs will be deployed
|
|
6
|
+
* @default '2'
|
|
7
|
+
*/
|
|
8
|
+
numberOfAvailabilityZones?: number;
|
|
9
|
+
tags?: pulumi.Input<{
|
|
10
|
+
[key: string]: pulumi.Input<string>;
|
|
11
|
+
}>;
|
|
12
|
+
};
|
|
13
|
+
export declare const defaults: {
|
|
14
|
+
numberOfAvailabilityZones: number;
|
|
15
|
+
};
|
|
16
|
+
export declare class Vpc extends pulumi.ComponentResource {
|
|
17
|
+
vpc: awsx.ec2.Vpc;
|
|
18
|
+
constructor(name: string, args: VpcArgs, opts?: pulumi.ComponentResourceOptions);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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,iBAAiB,CAAC;AAKxC,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;CAyB7C"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Vpc = exports.defaults = void 0;
|
|
4
|
+
const pulumi = require("@pulumi/pulumi");
|
|
5
|
+
const awsx = require("@pulumi/awsx-v3");
|
|
6
|
+
const common_tags_1 = require("../../shared/common-tags");
|
|
7
|
+
const types_1 = require("@pulumi/awsx-v3/types");
|
|
8
|
+
const merge_with_defaults_1 = require("../../shared/merge-with-defaults");
|
|
9
|
+
exports.defaults = {
|
|
10
|
+
numberOfAvailabilityZones: 2,
|
|
11
|
+
};
|
|
12
|
+
class Vpc extends pulumi.ComponentResource {
|
|
13
|
+
constructor(name, args, opts = {}) {
|
|
14
|
+
super('studion:vpc:Vpc', name, {}, opts);
|
|
15
|
+
const argsWithDefaults = (0, merge_with_defaults_1.mergeWithDefaults)(exports.defaults, args);
|
|
16
|
+
this.vpc = new awsx.ec2.Vpc(`${name}-vpc`, {
|
|
17
|
+
numberOfAvailabilityZones: argsWithDefaults.numberOfAvailabilityZones,
|
|
18
|
+
enableDnsHostnames: true,
|
|
19
|
+
enableDnsSupport: true,
|
|
20
|
+
subnetStrategy: types_1.enums.ec2.SubnetAllocationStrategy.Auto,
|
|
21
|
+
subnetSpecs: [
|
|
22
|
+
{ type: awsx.ec2.SubnetType.Public, cidrMask: 24 },
|
|
23
|
+
{ type: awsx.ec2.SubnetType.Private, cidrMask: 24 },
|
|
24
|
+
{ type: awsx.ec2.SubnetType.Isolated, cidrMask: 24 },
|
|
25
|
+
],
|
|
26
|
+
tags: Object.assign(Object.assign({}, common_tags_1.commonTags), argsWithDefaults.tags),
|
|
27
|
+
}, { parent: this });
|
|
28
|
+
this.registerOutputs();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.Vpc = Vpc;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as pulumi from '@pulumi/pulumi';
|
|
2
|
-
import * as awsx from '@pulumi/awsx';
|
|
2
|
+
import * as awsx from '@pulumi/awsx-v3';
|
|
3
3
|
import { EcsService } from '../ecs-service';
|
|
4
4
|
import { WebServer } from '.';
|
|
5
5
|
import { OtelCollector } from '../../otel';
|
|
6
6
|
export declare namespace WebServerBuilder {
|
|
7
7
|
type EcsConfig = Omit<WebServer.EcsConfig, 'vpc' | 'volumes'>;
|
|
8
|
-
type Args = Omit<WebServer.Args, 'vpc' | '
|
|
8
|
+
type Args = Omit<WebServer.Args, 'vpc' | 'cluster' | 'volumes' | 'domain' | 'hostedZoneId' | 'otelCollectorConfig'>;
|
|
9
9
|
}
|
|
10
10
|
export declare class WebServerBuilder {
|
|
11
11
|
private _name;
|
|
@@ -14,7 +14,9 @@ export declare class WebServerBuilder {
|
|
|
14
14
|
private _ecsConfig?;
|
|
15
15
|
private _domain?;
|
|
16
16
|
private _hostedZoneId?;
|
|
17
|
+
private _certificate?;
|
|
17
18
|
private _healthCheckPath?;
|
|
19
|
+
private _loadBalancingAlgorithmType?;
|
|
18
20
|
private _otelCollector?;
|
|
19
21
|
private _initContainers;
|
|
20
22
|
private _sidecarContainers;
|
|
@@ -25,10 +27,12 @@ export declare class WebServerBuilder {
|
|
|
25
27
|
withVpc(vpc: pulumi.Input<awsx.ec2.Vpc>): this;
|
|
26
28
|
withVolume(volume: EcsService.PersistentStorageVolume): this;
|
|
27
29
|
withCustomDomain(domain: pulumi.Input<string>, hostedZoneId: pulumi.Input<string>): this;
|
|
30
|
+
withCertificate(certificate: WebServerBuilder.Args['certificate'], hostedZoneId: pulumi.Input<string>, domain?: pulumi.Input<string>): this;
|
|
28
31
|
withInitContainer(container: WebServer.InitContainer): this;
|
|
29
32
|
withSidecarContainer(container: WebServer.SidecarContainer): this;
|
|
30
33
|
withOtelCollector(collector: OtelCollector): this;
|
|
31
34
|
withCustomHealthCheckPath(path: WebServer.Args['healthCheckPath']): this;
|
|
35
|
+
withLoadBalancingAlgorithm(algorithm: pulumi.Input<string>): this;
|
|
32
36
|
build(opts?: pulumi.ComponentResourceOptions): WebServer;
|
|
33
37
|
}
|
|
34
38
|
//# sourceMappingURL=builder.d.ts.map
|
|
@@ -0,0 +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,iBAAiB,CAAC;AACxC,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;IAC5E,OAAO,CAAC,QAAQ,CAA4C;gBAEhD,IAAI,EAAE,MAAM;IAIjB,kBAAkB,CACvB,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,EACnC,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,EACjC,MAAM,GAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,OAAO,GAAG,MAAM,CAAM,GACvD,IAAI;IAUA,YAAY,CAAC,MAAM,EAAE,gBAAgB,CAAC,SAAS,GAAG,IAAI;IAetD,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI;IAM9C,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,uBAAuB,GAAG,IAAI;IAM5D,gBAAgB,CACrB,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAC5B,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GACjC,IAAI;IAOA,eAAe,CACpB,WAAW,EAAE,gBAAgB,CAAC,IAAI,CAAC,aAAa,CAAC,EACjD,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAClC,MAAM,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAC5B,IAAI;IAQA,iBAAiB,CAAC,SAAS,EAAE,SAAS,CAAC,aAAa,GAAG,IAAI;IAM3D,oBAAoB,CAAC,SAAS,EAAE,SAAS,CAAC,gBAAgB,GAAG,IAAI;IAMjE,iBAAiB,CAAC,SAAS,EAAE,aAAa,GAAG,IAAI;IAMjD,yBAAyB,CAC9B,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,iBAAiB,CAAC,GACtC,IAAI;IAMA,0BAA0B,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;IAM1D,KAAK,CAAC,IAAI,GAAE,MAAM,CAAC,wBAA6B,GAAG,SAAS;CAoCpE"}
|
|
@@ -41,6 +41,12 @@ class WebServerBuilder {
|
|
|
41
41
|
this._hostedZoneId = hostedZoneId;
|
|
42
42
|
return this;
|
|
43
43
|
}
|
|
44
|
+
withCertificate(certificate, hostedZoneId, domain) {
|
|
45
|
+
this._certificate = certificate;
|
|
46
|
+
this._hostedZoneId = hostedZoneId;
|
|
47
|
+
this._domain = domain;
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
44
50
|
withInitContainer(container) {
|
|
45
51
|
this._initContainers.push(container);
|
|
46
52
|
return this;
|
|
@@ -57,6 +63,10 @@ class WebServerBuilder {
|
|
|
57
63
|
this._healthCheckPath = path;
|
|
58
64
|
return this;
|
|
59
65
|
}
|
|
66
|
+
withLoadBalancingAlgorithm(algorithm) {
|
|
67
|
+
this._loadBalancingAlgorithmType = algorithm;
|
|
68
|
+
return this;
|
|
69
|
+
}
|
|
60
70
|
build(opts = {}) {
|
|
61
71
|
if (!this._container) {
|
|
62
72
|
throw new Error('Web server not configured. Make sure to call WebServerBuilder.configureWebServer().');
|
|
@@ -67,7 +77,7 @@ class WebServerBuilder {
|
|
|
67
77
|
if (!this._vpc) {
|
|
68
78
|
throw new Error('VPC not provided. Make sure to call WebServerBuilder.withVpc().');
|
|
69
79
|
}
|
|
70
|
-
return new _1.WebServer(this._name, Object.assign(Object.assign(Object.assign({}, this._ecsConfig), this._container), { vpc: this._vpc, volumes: this._volumes,
|
|
80
|
+
return new _1.WebServer(this._name, Object.assign(Object.assign(Object.assign({}, this._ecsConfig), this._container), { vpc: this._vpc, volumes: this._volumes, domain: this._domain, hostedZoneId: this._hostedZoneId, certificate: this._certificate, healthCheckPath: this._healthCheckPath, loadBalancingAlgorithmType: this._loadBalancingAlgorithmType, otelCollector: this._otelCollector, initContainers: this._initContainers, sidecarContainers: this._sidecarContainers }), opts);
|
|
71
81
|
}
|
|
72
82
|
}
|
|
73
83
|
exports.WebServerBuilder = WebServerBuilder;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as pulumi from '@pulumi/pulumi';
|
|
2
|
-
import * as aws from '@pulumi/aws';
|
|
3
|
-
import { AcmCertificate } from '
|
|
2
|
+
import * as aws from '@pulumi/aws-v7';
|
|
3
|
+
import { AcmCertificate } from '../acm-certificate';
|
|
4
4
|
import { EcsService } from '../ecs-service';
|
|
5
5
|
import { WebServerLoadBalancer } from './load-balancer';
|
|
6
6
|
import { OtelCollector } from '../../otel';
|
|
@@ -12,12 +12,33 @@ export declare namespace WebServer {
|
|
|
12
12
|
type InitContainer = Omit<EcsService.Container, 'essential'>;
|
|
13
13
|
type SidecarContainer = Omit<EcsService.Container, 'essential' | 'healthCheck'> & Required<Pick<EcsService.Container, 'healthCheck'>>;
|
|
14
14
|
type Args = EcsConfig & Container & {
|
|
15
|
-
publicSubnetIds: pulumi.Input<pulumi.Input<string>[]>;
|
|
16
15
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
16
|
+
* Domain name for CloudFront distribution. Implies creation of certificate
|
|
17
|
+
* and alias record. Must belong to the provided hosted zone.
|
|
18
|
+
* Providing the `certificate` argument has following effects:
|
|
19
|
+
* - Certificate creation is skipped
|
|
20
|
+
* - Provided certificate must cover the domain name
|
|
21
|
+
* Responsibility to ensure mentioned requirements in on the consumer, and
|
|
22
|
+
* falling to do so will result in unexpected behavior.
|
|
19
23
|
*/
|
|
20
24
|
domain?: pulumi.Input<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Certificate for CloudFront distribution. Domain and alternative domains
|
|
27
|
+
* are automatically pulled from the certificate and translated into alias
|
|
28
|
+
* records. Domains covered by the certificate, must belong to the provided
|
|
29
|
+
* hosted zone. The certificate must be in `us-east-1` region. In a case
|
|
30
|
+
* of wildcard certificate the `domain` argument is required.
|
|
31
|
+
* Providing the `domain` argument has following effects:
|
|
32
|
+
* - Alias records creation, from automatically pulled domains, is skipped
|
|
33
|
+
* - Certificate must cover the provided domain name
|
|
34
|
+
* Responsibility to ensure mentioned requirements in on the consumer, and
|
|
35
|
+
* falling to do so will result in unexpected behavior.
|
|
36
|
+
*/
|
|
37
|
+
certificate?: pulumi.Input<aws.acm.Certificate>;
|
|
38
|
+
/**
|
|
39
|
+
* ID of hosted zone is needed when the `domain` or the `certificate`
|
|
40
|
+
* arguments are provided.
|
|
41
|
+
*/
|
|
21
42
|
hostedZoneId?: pulumi.Input<string>;
|
|
22
43
|
/**
|
|
23
44
|
* Path for the load balancer target group health check request.
|
|
@@ -26,6 +47,7 @@ export declare namespace WebServer {
|
|
|
26
47
|
* "/healthcheck"
|
|
27
48
|
*/
|
|
28
49
|
healthCheckPath?: pulumi.Input<string>;
|
|
50
|
+
loadBalancingAlgorithmType?: pulumi.Input<string>;
|
|
29
51
|
initContainers?: pulumi.Input<pulumi.Input<WebServer.InitContainer>[]>;
|
|
30
52
|
sidecarContainers?: pulumi.Input<pulumi.Input<WebServer.SidecarContainer>[]>;
|
|
31
53
|
otelCollector?: pulumi.Input<OtelCollector>;
|
|
@@ -41,8 +63,8 @@ export declare class WebServer extends pulumi.ComponentResource {
|
|
|
41
63
|
initContainers?: pulumi.Output<EcsService.Container[]>;
|
|
42
64
|
sidecarContainers?: pulumi.Output<EcsService.Container[]>;
|
|
43
65
|
volumes?: pulumi.Output<EcsService.PersistentStorageVolume[]>;
|
|
44
|
-
|
|
45
|
-
|
|
66
|
+
acmCertificate?: AcmCertificate;
|
|
67
|
+
dnsRecords?: pulumi.Output<aws.route53.Record[]>;
|
|
46
68
|
constructor(name: string, args: WebServer.Args, opts?: pulumi.ComponentResourceOptions);
|
|
47
69
|
private getVolumes;
|
|
48
70
|
private getInitContainers;
|
|
@@ -53,6 +75,6 @@ export declare class WebServer extends pulumi.ComponentResource {
|
|
|
53
75
|
private createTlsCertificate;
|
|
54
76
|
private createSecurityGroup;
|
|
55
77
|
private createEcsService;
|
|
56
|
-
private
|
|
78
|
+
private createDnsRecords;
|
|
57
79
|
}
|
|
58
80
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/web-server/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -2,44 +2,42 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WebServer = void 0;
|
|
4
4
|
const pulumi = require("@pulumi/pulumi");
|
|
5
|
-
const aws = require("@pulumi/aws");
|
|
6
|
-
const
|
|
7
|
-
const acm_certificate_1 = require("
|
|
5
|
+
const aws = require("@pulumi/aws-v7");
|
|
6
|
+
const common_tags_1 = require("../../shared/common-tags");
|
|
7
|
+
const acm_certificate_1 = require("../acm-certificate");
|
|
8
8
|
const ecs_service_1 = require("../ecs-service");
|
|
9
9
|
const load_balancer_1 = require("./load-balancer");
|
|
10
10
|
class WebServer extends pulumi.ComponentResource {
|
|
11
11
|
constructor(name, args, opts = {}) {
|
|
12
12
|
var _a;
|
|
13
|
-
super('studion:WebServer', name, args, opts);
|
|
14
|
-
const { vpc, domain, hostedZoneId } = args;
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
super('studion:web-server:WebServer', name, args, Object.assign(Object.assign({}, opts), { aliases: [...(opts.aliases || []), { type: 'studion:WebServer' }] }));
|
|
14
|
+
const { vpc, domain, hostedZoneId, certificate } = args;
|
|
15
|
+
const hasCustomDomain = !!domain || !!certificate;
|
|
16
|
+
if (hasCustomDomain && !hostedZoneId) {
|
|
17
|
+
throw new Error('Provide `hostedZoneId` alongside `domain` and/or `certificate`.');
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
this.certificate = this.createTlsCertificate({ domain, hostedZoneId });
|
|
19
|
+
if (domain && hostedZoneId && !certificate) {
|
|
20
|
+
this.acmCertificate = this.createTlsCertificate({ domain, hostedZoneId });
|
|
21
21
|
}
|
|
22
22
|
this.name = name;
|
|
23
23
|
this.lb = new load_balancer_1.WebServerLoadBalancer(`${this.name}-lb`, {
|
|
24
24
|
vpc,
|
|
25
25
|
port: args.port,
|
|
26
|
-
certificate: (_a = this.
|
|
26
|
+
certificate: certificate !== null && certificate !== void 0 ? certificate : (_a = this.acmCertificate) === null || _a === void 0 ? void 0 : _a.certificate,
|
|
27
27
|
healthCheckPath: args.healthCheckPath,
|
|
28
|
-
|
|
28
|
+
loadBalancingAlgorithmType: args.loadBalancingAlgorithmType,
|
|
29
|
+
}, Object.assign({ parent: this }, (this.acmCertificate
|
|
30
|
+
? { dependsOn: [this.acmCertificate.certificateValidation] }
|
|
31
|
+
: undefined)));
|
|
29
32
|
this.serviceSecurityGroup = this.createSecurityGroup(vpc);
|
|
30
33
|
this.initContainers = this.getInitContainers(args);
|
|
31
34
|
this.sidecarContainers = this.getSidecarContainers(args);
|
|
32
35
|
this.container = this.createWebServerContainer(args);
|
|
33
36
|
this.ecsConfig = this.createEcsConfig(args);
|
|
34
37
|
this.volumes = this.getVolumes(args);
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
.
|
|
38
|
-
.apply(([initContainers, sidecarContainers]) => {
|
|
39
|
-
return this.createEcsService(this.container, this.lb, this.ecsConfig, this.volumes, [...initContainers, ...sidecarContainers]);
|
|
40
|
-
});
|
|
41
|
-
if (hasCustomDomain) {
|
|
42
|
-
this.dnsRecord = this.createDnsRecord({ domain, hostedZoneId });
|
|
38
|
+
this.service = this.createEcsService(this.container, this.lb, this.ecsConfig, this.volumes, this.initContainers, this.sidecarContainers);
|
|
39
|
+
if (hasCustomDomain && hostedZoneId) {
|
|
40
|
+
this.dnsRecords = this.createDnsRecords(certificate !== null && certificate !== void 0 ? certificate : this.acmCertificate.certificate, hostedZoneId, domain);
|
|
43
41
|
}
|
|
44
42
|
this.registerOutputs();
|
|
45
43
|
}
|
|
@@ -143,30 +141,41 @@ class WebServer extends pulumi.ComponentResource {
|
|
|
143
141
|
cidrBlocks: ['0.0.0.0/0'],
|
|
144
142
|
},
|
|
145
143
|
],
|
|
146
|
-
tags:
|
|
144
|
+
tags: common_tags_1.commonTags,
|
|
147
145
|
}, { parent: this });
|
|
148
146
|
}
|
|
149
|
-
createEcsService(webServerContainer, lb, ecsConfig, volumes,
|
|
150
|
-
return
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
147
|
+
createEcsService(webServerContainer, lb, ecsConfig, volumes, initContainers, sidecarContainers) {
|
|
148
|
+
return pulumi
|
|
149
|
+
.all([
|
|
150
|
+
initContainers || pulumi.output([]),
|
|
151
|
+
sidecarContainers || pulumi.output([]),
|
|
152
|
+
])
|
|
153
|
+
.apply(([inits, sidecars]) => {
|
|
154
|
+
return new ecs_service_1.EcsService(`${this.name}-ecs`, Object.assign(Object.assign({}, ecsConfig), { volumes, containers: [
|
|
155
|
+
Object.assign(Object.assign({}, webServerContainer), { name: this.name, portMappings: [
|
|
156
|
+
ecs_service_1.EcsService.createTcpPortMapping(webServerContainer.port),
|
|
157
|
+
], essential: true }),
|
|
158
|
+
...inits,
|
|
159
|
+
...sidecars,
|
|
160
|
+
], enableServiceAutoDiscovery: false, loadBalancers: [
|
|
161
|
+
{
|
|
162
|
+
containerName: this.name,
|
|
163
|
+
containerPort: webServerContainer.port,
|
|
164
|
+
targetGroupArn: lb.targetGroup.arn,
|
|
165
|
+
},
|
|
166
|
+
], assignPublicIp: true, securityGroup: this.serviceSecurityGroup }), {
|
|
167
|
+
parent: this,
|
|
168
|
+
dependsOn: [lb, lb.targetGroup],
|
|
169
|
+
});
|
|
164
170
|
});
|
|
165
171
|
}
|
|
166
|
-
|
|
167
|
-
|
|
172
|
+
createDnsRecords(certificate, hostedZoneId, domain) {
|
|
173
|
+
const certOutput = pulumi.output(certificate);
|
|
174
|
+
return pulumi
|
|
175
|
+
.all([domain, certOutput.domainName, certOutput.subjectAlternativeNames])
|
|
176
|
+
.apply(([domain, certDomain, certSans = []]) => (domain ? [domain] : [...new Set([certDomain, ...certSans])]).map((alias, index) => new aws.route53.Record(`${this.name}-route53-record${index === 0 ? '' : `-${index}`}`, {
|
|
168
177
|
type: 'A',
|
|
169
|
-
name:
|
|
178
|
+
name: alias,
|
|
170
179
|
zoneId: hostedZoneId,
|
|
171
180
|
aliases: [
|
|
172
181
|
{
|
|
@@ -175,7 +184,7 @@ class WebServer extends pulumi.ComponentResource {
|
|
|
175
184
|
evaluateTargetHealth: true,
|
|
176
185
|
},
|
|
177
186
|
],
|
|
178
|
-
}, { parent: this });
|
|
187
|
+
}, { parent: this })));
|
|
179
188
|
}
|
|
180
189
|
}
|
|
181
190
|
exports.WebServer = WebServer;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as pulumi from '@pulumi/pulumi';
|
|
2
|
-
import * as aws from '@pulumi/aws';
|
|
3
|
-
import * as awsx from '@pulumi/awsx';
|
|
2
|
+
import * as aws from '@pulumi/aws-v7';
|
|
3
|
+
import * as awsx from '@pulumi/awsx-v3';
|
|
4
4
|
export declare namespace WebServerLoadBalancer {
|
|
5
5
|
type Args = {
|
|
6
6
|
vpc: pulumi.Input<awsx.ec2.Vpc>;
|
|
7
7
|
port: pulumi.Input<number>;
|
|
8
|
-
certificate?: aws.acm.Certificate
|
|
8
|
+
certificate?: pulumi.Input<aws.acm.Certificate>;
|
|
9
9
|
healthCheckPath?: pulumi.Input<string>;
|
|
10
|
+
loadBalancingAlgorithmType?: pulumi.Input<string>;
|
|
10
11
|
};
|
|
11
12
|
}
|
|
12
13
|
export declare class WebServerLoadBalancer extends pulumi.ComponentResource {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-balancer.d.ts","sourceRoot":"","sources":["../../../src/components/web-server/load-balancer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AACzC,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAC;AACtC,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAIxC,yBAAiB,qBAAqB,CAAC;IACrC,KAAY,IAAI,GAAG;QACjB,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAChC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC3B,WAAW,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAChD,eAAe,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACvC,0BAA0B,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;KACnD,CAAC;CACH;AA+BD,qBAAa,qBAAsB,SAAQ,MAAM,CAAC,iBAAiB;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,GAAG,CAAC,EAAE,CAAC,YAAY,CAAC;IACxB,WAAW,EAAE,GAAG,CAAC,EAAE,CAAC,WAAW,CAAC;IAChC,YAAY,EAAE,GAAG,CAAC,EAAE,CAAC,QAAQ,CAAC;IAC9B,WAAW,EAAE,GAAG,CAAC,EAAE,CAAC,QAAQ,GAAG,SAAS,CAAC;IACzC,aAAa,EAAE,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC;gBAGnC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,qBAAqB,CAAC,IAAI,EAChC,IAAI,GAAE,MAAM,CAAC,wBAA6B;IAgD5C,OAAO,CAAC,mBAAmB;IAyB3B,OAAO,CAAC,oBAAoB;IAgC5B,OAAO,CAAC,mBAAmB;IA4B3B,OAAO,CAAC,qBAAqB;CAa9B"}
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WebServerLoadBalancer = void 0;
|
|
4
4
|
const pulumi = require("@pulumi/pulumi");
|
|
5
|
-
const aws = require("@pulumi/aws");
|
|
6
|
-
const
|
|
5
|
+
const aws = require("@pulumi/aws-v7");
|
|
6
|
+
const common_tags_1 = require("../../shared/common-tags");
|
|
7
|
+
const merge_with_defaults_1 = require("../../shared/merge-with-defaults");
|
|
7
8
|
const webServerLoadBalancerNetworkConfig = {
|
|
8
9
|
ingress: [
|
|
9
10
|
{
|
|
@@ -33,10 +34,11 @@ const defaults = {
|
|
|
33
34
|
};
|
|
34
35
|
class WebServerLoadBalancer extends pulumi.ComponentResource {
|
|
35
36
|
constructor(name, args, opts = {}) {
|
|
36
|
-
super('studion:WebServerLoadBalancer', name, args, opts);
|
|
37
|
+
super('studion:web-server:WebServerLoadBalancer', name, args, opts);
|
|
37
38
|
this.name = name;
|
|
38
39
|
const vpc = pulumi.output(args.vpc);
|
|
39
|
-
const
|
|
40
|
+
const argsWithDefaults = (0, merge_with_defaults_1.mergeWithDefaults)(defaults, args);
|
|
41
|
+
const { port, certificate, healthCheckPath, loadBalancingAlgorithmType } = argsWithDefaults;
|
|
40
42
|
this.securityGroup = this.createLbSecurityGroup(vpc.vpcId);
|
|
41
43
|
this.lb = new aws.lb.LoadBalancer(this.name, {
|
|
42
44
|
namePrefix: 'lb-',
|
|
@@ -45,13 +47,13 @@ class WebServerLoadBalancer extends pulumi.ComponentResource {
|
|
|
45
47
|
securityGroups: [this.securityGroup.id],
|
|
46
48
|
internal: false,
|
|
47
49
|
ipAddressType: 'ipv4',
|
|
48
|
-
tags: Object.assign(Object.assign({},
|
|
50
|
+
tags: Object.assign(Object.assign({}, common_tags_1.commonTags), { Name: name }),
|
|
49
51
|
}, { parent: this });
|
|
50
|
-
this.targetGroup = this.createLbTargetGroup(port, vpc.vpcId, healthCheckPath);
|
|
52
|
+
this.targetGroup = this.createLbTargetGroup(port, vpc.vpcId, healthCheckPath, loadBalancingAlgorithmType);
|
|
51
53
|
this.httpListener = this.createLbHttpListener(this.lb, this.targetGroup, !!certificate);
|
|
52
54
|
this.tlsListener =
|
|
53
55
|
certificate &&
|
|
54
|
-
this.createLbTlsListener(this.lb, this.targetGroup, certificate);
|
|
56
|
+
this.createLbTlsListener(this.lb, this.targetGroup, pulumi.output(certificate));
|
|
55
57
|
this.registerOutputs();
|
|
56
58
|
}
|
|
57
59
|
createLbTlsListener(lb, lbTargetGroup, certificate) {
|
|
@@ -59,7 +61,7 @@ class WebServerLoadBalancer extends pulumi.ComponentResource {
|
|
|
59
61
|
loadBalancerArn: lb.arn,
|
|
60
62
|
port: 443,
|
|
61
63
|
protocol: 'HTTPS',
|
|
62
|
-
sslPolicy: 'ELBSecurityPolicy-
|
|
64
|
+
sslPolicy: 'ELBSecurityPolicy-TLS13-1-2-2021-06',
|
|
63
65
|
certificateArn: certificate.arn,
|
|
64
66
|
defaultActions: [
|
|
65
67
|
{
|
|
@@ -67,7 +69,7 @@ class WebServerLoadBalancer extends pulumi.ComponentResource {
|
|
|
67
69
|
targetGroupArn: lbTargetGroup.arn,
|
|
68
70
|
},
|
|
69
71
|
],
|
|
70
|
-
tags:
|
|
72
|
+
tags: common_tags_1.commonTags,
|
|
71
73
|
}, { parent: this, dependsOn: [certificate] });
|
|
72
74
|
}
|
|
73
75
|
createLbHttpListener(lb, lbTargetGroup, redirectToHttps) {
|
|
@@ -89,28 +91,29 @@ class WebServerLoadBalancer extends pulumi.ComponentResource {
|
|
|
89
91
|
loadBalancerArn: lb.arn,
|
|
90
92
|
port: 80,
|
|
91
93
|
defaultActions: [defaultAction],
|
|
92
|
-
tags:
|
|
94
|
+
tags: common_tags_1.commonTags,
|
|
93
95
|
}, { parent: this });
|
|
94
96
|
}
|
|
95
|
-
createLbTargetGroup(port, vpcId, healthCheckPath) {
|
|
97
|
+
createLbTargetGroup(port, vpcId, healthCheckPath, loadBalancingAlgorithmType) {
|
|
96
98
|
return new aws.lb.TargetGroup(`${this.name}-tg`, {
|
|
97
99
|
namePrefix: 'lb-tg-',
|
|
98
100
|
port,
|
|
99
101
|
protocol: 'HTTP',
|
|
100
102
|
targetType: 'ip',
|
|
101
103
|
vpcId,
|
|
104
|
+
loadBalancingAlgorithmType,
|
|
102
105
|
healthCheck: {
|
|
103
106
|
healthyThreshold: 3,
|
|
104
107
|
unhealthyThreshold: 2,
|
|
105
108
|
interval: 60,
|
|
106
109
|
timeout: 5,
|
|
107
|
-
path: healthCheckPath
|
|
110
|
+
path: healthCheckPath,
|
|
108
111
|
},
|
|
109
|
-
tags: Object.assign(Object.assign({},
|
|
112
|
+
tags: Object.assign(Object.assign({}, common_tags_1.commonTags), { Name: `${this.name}-target-group` }),
|
|
110
113
|
}, { parent: this, dependsOn: [this.lb] });
|
|
111
114
|
}
|
|
112
115
|
createLbSecurityGroup(vpcId) {
|
|
113
|
-
return new aws.ec2.SecurityGroup(`${this.name}-security-group`, Object.assign(Object.assign({}, webServerLoadBalancerNetworkConfig), { vpcId, tags:
|
|
116
|
+
return new aws.ec2.SecurityGroup(`${this.name}-security-group`, Object.assign(Object.assign({}, webServerLoadBalancerNetworkConfig), { vpcId, tags: common_tags_1.commonTags }), { parent: this });
|
|
114
117
|
}
|
|
115
118
|
}
|
|
116
119
|
exports.WebServerLoadBalancer = WebServerLoadBalancer;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,25 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
1
|
+
export { EcsService } from './components/ecs-service';
|
|
2
|
+
export { WebServer } from './components/web-server';
|
|
3
|
+
export { WebServerBuilder } from './components/web-server/builder';
|
|
4
|
+
export { WebServerLoadBalancer } from './components/web-server/load-balancer';
|
|
5
|
+
export { ElastiCacheRedis } from './components/redis/elasticache-redis';
|
|
6
|
+
export { UpstashRedis } from './components/redis/upstash-redis';
|
|
7
|
+
export { Vpc } from './components/vpc';
|
|
8
|
+
export { Database } from './components/database';
|
|
9
|
+
export { DatabaseBuilder } from './components/database/builder';
|
|
10
|
+
export { DatabaseReplica } from './components/database/database-replica';
|
|
11
|
+
export { Ec2SSMConnect } from './components/database/ec2-ssm-connect';
|
|
12
|
+
export { AcmCertificate } from './components/acm-certificate';
|
|
13
|
+
export { Password } from './components/password';
|
|
14
|
+
export { CloudFront } from './components/cloudfront';
|
|
15
|
+
export { StaticSite } from './components/static-site';
|
|
16
|
+
export { S3Assets } from './components/static-site/s3-assets';
|
|
17
|
+
import { OtelCollectorBuilder } from './otel/builder';
|
|
18
|
+
import { OtelCollector } from './otel';
|
|
19
|
+
export declare const openTelemetry: {
|
|
20
|
+
OtelCollector: typeof OtelCollector;
|
|
21
|
+
OtelCollectorBuilder: typeof OtelCollectorBuilder;
|
|
22
|
+
};
|
|
23
|
+
export * as grafana from './components/grafana';
|
|
24
|
+
export * as prometheus from './components/prometheus';
|
|
12
25
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAE9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,eAAO,MAAM,aAAa;;;CAA0C,CAAC;AAErE,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAChD,OAAO,KAAK,UAAU,MAAM,yBAAyB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,28 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
3
|
+
exports.prometheus = exports.grafana = exports.openTelemetry = exports.S3Assets = exports.StaticSite = exports.CloudFront = exports.Password = exports.AcmCertificate = exports.Ec2SSMConnect = exports.DatabaseReplica = exports.DatabaseBuilder = exports.Database = exports.Vpc = exports.UpstashRedis = exports.ElastiCacheRedis = exports.WebServerLoadBalancer = exports.WebServerBuilder = exports.WebServer = exports.EcsService = void 0;
|
|
4
|
+
var ecs_service_1 = require("./components/ecs-service");
|
|
5
|
+
Object.defineProperty(exports, "EcsService", { enumerable: true, get: function () { return ecs_service_1.EcsService; } });
|
|
6
|
+
var web_server_1 = require("./components/web-server");
|
|
7
|
+
Object.defineProperty(exports, "WebServer", { enumerable: true, get: function () { return web_server_1.WebServer; } });
|
|
8
|
+
var builder_1 = require("./components/web-server/builder");
|
|
9
|
+
Object.defineProperty(exports, "WebServerBuilder", { enumerable: true, get: function () { return builder_1.WebServerBuilder; } });
|
|
10
|
+
var load_balancer_1 = require("./components/web-server/load-balancer");
|
|
11
|
+
Object.defineProperty(exports, "WebServerLoadBalancer", { enumerable: true, get: function () { return load_balancer_1.WebServerLoadBalancer; } });
|
|
12
|
+
var elasticache_redis_1 = require("./components/redis/elasticache-redis");
|
|
13
|
+
Object.defineProperty(exports, "ElastiCacheRedis", { enumerable: true, get: function () { return elasticache_redis_1.ElastiCacheRedis; } });
|
|
14
|
+
var upstash_redis_1 = require("./components/redis/upstash-redis");
|
|
15
|
+
Object.defineProperty(exports, "UpstashRedis", { enumerable: true, get: function () { return upstash_redis_1.UpstashRedis; } });
|
|
16
|
+
var vpc_1 = require("./components/vpc");
|
|
17
|
+
Object.defineProperty(exports, "Vpc", { enumerable: true, get: function () { return vpc_1.Vpc; } });
|
|
18
|
+
var database_1 = require("./components/database");
|
|
19
|
+
Object.defineProperty(exports, "Database", { enumerable: true, get: function () { return database_1.Database; } });
|
|
20
|
+
var builder_2 = require("./components/database/builder");
|
|
21
|
+
Object.defineProperty(exports, "DatabaseBuilder", { enumerable: true, get: function () { return builder_2.DatabaseBuilder; } });
|
|
22
|
+
var database_replica_1 = require("./components/database/database-replica");
|
|
23
|
+
Object.defineProperty(exports, "DatabaseReplica", { enumerable: true, get: function () { return database_replica_1.DatabaseReplica; } });
|
|
24
|
+
var ec2_ssm_connect_1 = require("./components/database/ec2-ssm-connect");
|
|
25
|
+
Object.defineProperty(exports, "Ec2SSMConnect", { enumerable: true, get: function () { return ec2_ssm_connect_1.Ec2SSMConnect; } });
|
|
26
|
+
var acm_certificate_1 = require("./components/acm-certificate");
|
|
27
|
+
Object.defineProperty(exports, "AcmCertificate", { enumerable: true, get: function () { return acm_certificate_1.AcmCertificate; } });
|
|
28
|
+
var password_1 = require("./components/password");
|
|
29
|
+
Object.defineProperty(exports, "Password", { enumerable: true, get: function () { return password_1.Password; } });
|
|
30
|
+
var cloudfront_1 = require("./components/cloudfront");
|
|
31
|
+
Object.defineProperty(exports, "CloudFront", { enumerable: true, get: function () { return cloudfront_1.CloudFront; } });
|
|
32
|
+
var static_site_1 = require("./components/static-site");
|
|
33
|
+
Object.defineProperty(exports, "StaticSite", { enumerable: true, get: function () { return static_site_1.StaticSite; } });
|
|
34
|
+
var s3_assets_1 = require("./components/static-site/s3-assets");
|
|
35
|
+
Object.defineProperty(exports, "S3Assets", { enumerable: true, get: function () { return s3_assets_1.S3Assets; } });
|
|
36
|
+
const builder_3 = require("./otel/builder");
|
|
37
|
+
const otel_1 = require("./otel");
|
|
38
|
+
exports.openTelemetry = { OtelCollector: otel_1.OtelCollector, OtelCollectorBuilder: builder_3.OtelCollectorBuilder };
|
|
39
|
+
exports.grafana = require("./components/grafana");
|
|
40
|
+
exports.prometheus = require("./components/prometheus");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batch-processor.d.ts","sourceRoot":"","sources":["../../src/otel/batch-processor.ts"],"names":[],"mappings":"AAAA,yBAAiB,cAAc,CAAC;IAC9B,KAAY,MAAM,GAAG;QACnB,eAAe,EAAE,MAAM,CAAC;QACxB,mBAAmB,EAAE,MAAM,CAAC;QAC5B,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED,eAAO,MAAM,QAAQ;;;;;CAKpB,CAAC"}
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import * as pulumi from '@pulumi/pulumi';
|
|
2
|
-
import * as aws from '@pulumi/aws';
|
|
2
|
+
import * as aws from '@pulumi/aws-v7';
|
|
3
3
|
import { OtelCollector } from '.';
|
|
4
4
|
import { OTLPReceiver } from './otlp-receiver';
|
|
5
|
+
import { PrometheusRemoteWriteExporter } from './prometheus-remote-write-exporter';
|
|
6
|
+
export declare namespace OtelCollectorBuilder {
|
|
7
|
+
type WithDefaultArgs = {
|
|
8
|
+
prometheusNamespace: PrometheusRemoteWriteExporter.Config['namespace'];
|
|
9
|
+
prometheusWorkspace: aws.amp.Workspace;
|
|
10
|
+
region: string;
|
|
11
|
+
logGroupName: OtelCollector.AwsCloudWatchLogsExporterConfig['log_group_name'];
|
|
12
|
+
logStreamName: OtelCollector.AwsCloudWatchLogsExporterConfig['log_stream_name'];
|
|
13
|
+
};
|
|
14
|
+
}
|
|
5
15
|
export declare class OtelCollectorBuilder {
|
|
6
16
|
private readonly _serviceName;
|
|
7
17
|
private readonly _env;
|
|
@@ -12,6 +22,7 @@ export declare class OtelCollectorBuilder {
|
|
|
12
22
|
withBatchProcessor(name?: string, size?: number, maxSize?: number, timeout?: string): this;
|
|
13
23
|
withMemoryLimiterProcessor(checkInterval?: string, limitPercentage?: number, spikeLimitPercentage?: number): this;
|
|
14
24
|
withAWSXRayExporter(region: string): this;
|
|
25
|
+
withCloudWatchLogsExporter(region: OtelCollector.AwsCloudWatchLogsExporterConfig['region'], logGroupName: OtelCollector.AwsCloudWatchLogsExporterConfig['log_group_name'], logStreamName: OtelCollector.AwsCloudWatchLogsExporterConfig['log_stream_name'], logRetention?: OtelCollector.AwsCloudWatchLogsExporterConfig['log_retention']): this;
|
|
15
26
|
withHealthCheckExtension(endpoint?: string): this;
|
|
16
27
|
withPprofExtension(endpoint?: string): this;
|
|
17
28
|
withAPS(namespace: pulumi.Input<string>, workspace: aws.amp.Workspace, region: string): this;
|
|
@@ -19,9 +30,11 @@ export declare class OtelCollectorBuilder {
|
|
|
19
30
|
withTelemetry(logLevel?: 'debug' | 'warn' | 'error', metricsVerbosity?: 'basic' | 'normal' | 'detailed'): this;
|
|
20
31
|
withMetricsPipeline(receivers: OtelCollector.ReceiverType[], processors: OtelCollector.ProcessorType[], exporters: OtelCollector.ExporterType[]): this;
|
|
21
32
|
withTracesPipeline(receivers: OtelCollector.ReceiverType[], processors: OtelCollector.ProcessorType[], exporters: OtelCollector.ExporterType[]): this;
|
|
22
|
-
|
|
33
|
+
withLogsPipeline(receivers: OtelCollector.ReceiverType[], processors: OtelCollector.ProcessorType[], exporters: OtelCollector.ExporterType[]): this;
|
|
34
|
+
withDefault({ prometheusNamespace, prometheusWorkspace, region, logGroupName, logStreamName, }: OtelCollectorBuilder.WithDefaultArgs): this;
|
|
23
35
|
build(): OtelCollector;
|
|
24
36
|
private createAPSInlinePolicy;
|
|
25
37
|
private createAWSXRayPolicy;
|
|
38
|
+
private createCloudWatchLogsPolicy;
|
|
26
39
|
}
|
|
27
40
|
//# sourceMappingURL=builder.d.ts.map
|