@codedazur/cdk-docker-cluster 2.0.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @codedazur/cdk-docker-cluster
2
2
 
3
+ ## 2.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`788c34a`](https://github.com/codedazur/toolkit/commit/788c34a5c321fcc1d6ebf831365111f4d8fb5573) Thanks [@thijsdaniels](https://github.com/thijsdaniels)! - Promote `containerInsights` prop to top level.
8
+
9
+ ## 2.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`f361c4c`](https://github.com/codedazur/toolkit/commit/f361c4cbf2974360c9eeec0feb04c9c2cc33b730) Thanks [@thijsdaniels](https://github.com/thijsdaniels)! - Add support for Container Insights on ECS clusters (`cluster.containerInsights`) and custom health checks on ALB target groups (`service.healthCheck`).
14
+
3
15
  ## 2.0.0
4
16
 
5
17
  ### Major Changes
package/dist/index.d.ts CHANGED
@@ -4,12 +4,29 @@ import { ContainerImage, Secret, ScalableTaskCount } from 'aws-cdk-lib/aws-ecs';
4
4
  import { SiteDistributionProps, SiteDistribution } from '@codedazur/cdk-site-distribution';
5
5
  import { Duration } from 'aws-cdk-lib';
6
6
  import { ApplicationLoadBalancedFargateServiceProps, ApplicationLoadBalancedFargateService } from 'aws-cdk-lib/aws-ecs-patterns';
7
+ import { HealthCheck } from 'aws-cdk-lib/aws-elasticloadbalancingv2';
7
8
  import { Construct } from 'constructs';
8
9
 
10
+ interface ClusterConfig {
11
+ /**
12
+ * Enable CloudWatch Container Insights for the ECS Cluster.
13
+ * @default false
14
+ */
15
+ readonly containerInsights?: boolean;
16
+ }
9
17
  interface DockerClusterProps {
10
18
  readonly source: string | SourceProps | ContainerImage;
19
+ /**
20
+ * Enable CloudWatch Container Insights for the ECS Cluster.
21
+ * @default false
22
+ */
23
+ readonly containerInsights?: boolean;
11
24
  readonly service?: ServiceProps;
12
25
  readonly distribution?: Omit<SiteDistributionProps, "origin">;
26
+ /**
27
+ * @deprecated Use top-level `containerInsights` instead.
28
+ */
29
+ readonly cluster?: ClusterConfig;
13
30
  }
14
31
  interface ServiceProps {
15
32
  readonly port?: number;
@@ -18,6 +35,10 @@ interface ServiceProps {
18
35
  readonly memory?: ApplicationLoadBalancedFargateServiceProps["memoryLimitMiB"];
19
36
  readonly environment?: Record<string, string>;
20
37
  readonly secrets?: Record<string, Secret>;
38
+ /**
39
+ * Health check configuration for the Application Load Balancer target group.
40
+ */
41
+ readonly healthCheck?: HealthCheck;
21
42
  }
22
43
  interface AutoScalingConfig {
23
44
  /**
@@ -96,4 +117,4 @@ declare class DockerCluster extends Construct {
96
117
  protected getOutputDirectory(): string;
97
118
  }
98
119
 
99
- export { DockerCluster, type DockerClusterProps, type ServiceProps };
120
+ export { type ClusterConfig, DockerCluster, type DockerClusterProps, type ServiceProps };
package/dist/index.js CHANGED
@@ -47,8 +47,11 @@ var DockerCluster = class extends Construct {
47
47
  }
48
48
  createService() {
49
49
  const desiredTasks = typeof this.props.service?.tasks === "number" ? this.props.service?.tasks : this.props.service?.tasks?.minimum;
50
+ const containerInsights = this.props.containerInsights ?? this.props.cluster?.containerInsights;
50
51
  const service = new ApplicationLoadBalancedFargateService(this, "Service", {
51
- cluster: new Cluster(this, "Cluster"),
52
+ cluster: new Cluster(this, "Cluster", {
53
+ containerInsights
54
+ }),
52
55
  cpu: this.props.service?.cpu,
53
56
  memoryLimitMiB: this.props.service?.memory,
54
57
  desiredCount: desiredTasks,
@@ -63,6 +66,9 @@ var DockerCluster = class extends Construct {
63
66
  rollback: true
64
67
  }
65
68
  });
69
+ if (this.props.service?.healthCheck) {
70
+ service.targetGroup.configureHealthCheck(this.props.service.healthCheck);
71
+ }
66
72
  return service;
67
73
  }
68
74
  createAutoScaling(service) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codedazur/cdk-docker-cluster",
3
- "version": "2.0.0",
3
+ "version": "2.1.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -23,12 +23,12 @@
23
23
  "constructs": ">=10"
24
24
  },
25
25
  "dependencies": {
26
- "@codedazur/cdk-site-distribution": "^2.0.0"
26
+ "@codedazur/cdk-site-distribution": "2.0.0"
27
27
  },
28
28
  "devDependencies": {
29
- "@types/node": "^25.0.9",
30
- "aws-cdk-lib": "^2.235.1",
31
- "constructs": "^10.4.5",
32
- "esbuild": "^0.27.2"
29
+ "@types/node": "^25.9.1",
30
+ "aws-cdk-lib": "^2.268.0",
31
+ "constructs": "^10.8.1",
32
+ "esbuild": "^0.28.2"
33
33
  }
34
34
  }