@fjall/components-infrastructure 10.1.1 → 10.1.2

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.
@@ -1,5 +1,7 @@
1
+ import { Duration } from "aws-cdk-lib";
1
2
  import { ApplicationLoadBalancer } from "aws-cdk-lib/aws-elasticloadbalancingv2";
2
3
  import { SubnetType } from "aws-cdk-lib/aws-ec2";
4
+ import { DEFAULT_ALB_IDLE_TIMEOUT_SECONDS } from "@fjall/util/httpKeepAlive";
3
5
  /**
4
6
  * Context-free Application Load Balancer factory shared by the ECS cluster path
5
7
  * and the dev substrate. Subnet placement is derived from `internetFacing`
@@ -10,6 +12,10 @@ export function createApplicationLoadBalancer(scope, id, options) {
10
12
  return new ApplicationLoadBalancer(scope, id, {
11
13
  vpc: options.vpc,
12
14
  internetFacing: options.internetFacing,
15
+ // Pinned (rather than left at the AWS default of the same value) because
16
+ // ALB-fronted containers receive it as FJALL_ALB_IDLE_TIMEOUT_SECONDS
17
+ // (ecsTaskDefinition.ts) for keep-alive tuning — one constant, both sides.
18
+ idleTimeout: Duration.seconds(DEFAULT_ALB_IDLE_TIMEOUT_SECONDS),
13
19
  ...(options.securityGroup && { securityGroup: options.securityGroup }),
14
20
  ...(options.loadBalancerName && {
15
21
  loadBalancerName: options.loadBalancerName
@@ -3,6 +3,7 @@ import { Duration } from "aws-cdk-lib";
3
3
  import { Secret as EcsSecret } from "aws-cdk-lib/aws-ecs";
4
4
  import { StringParameter } from "aws-cdk-lib/aws-ssm";
5
5
  import { buildParameterPath } from "@fjall/util";
6
+ import { DEFAULT_ALB_IDLE_TIMEOUT_SECONDS, FJALL_ALB_IDLE_TIMEOUT_ENV_VAR } from "@fjall/util/httpKeepAlive";
6
7
  import { resolveOrgId } from "../../../utils/cdkContext.js";
7
8
  import { validateSsmPathComponent, validateSecretName } from "./ecsValidation.js";
8
9
  import { DEFAULT_LOG_RETENTION, DEFAULT_FARGATE_CPU, DEFAULT_FARGATE_MEMORY_MIB, resolveEc2ContainerMemoryMiB } from "./ecsConstants.js";
@@ -194,6 +195,14 @@ export function addContainersToTask(ctx, serviceName, serviceProps, taskDefiniti
194
195
  ...remoteEnv,
195
196
  ...(containerConfig.port
196
197
  ? { PORT: String(containerConfig.port) }
198
+ : {}),
199
+ // The ALB half of the keep-alive contract (@fjall/util/httpKeepAlive):
200
+ // only the first port-bearing container is ALB-registered, and the
201
+ // value must match the idleTimeout pinned in applicationLoadBalancer.ts.
202
+ ...(isFirstWithPort && !ctx.loadBalancerDisabled
203
+ ? {
204
+ [FJALL_ALB_IDLE_TIMEOUT_ENV_VAR]: String(DEFAULT_ALB_IDLE_TIMEOUT_SECONDS)
205
+ }
197
206
  : {})
198
207
  },
199
208
  secrets,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fjall/components-infrastructure",
3
- "version": "10.1.1",
3
+ "version": "10.1.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/fjall-tech/fjall.git",
@@ -80,8 +80,8 @@
80
80
  },
81
81
  "dependencies": {
82
82
  "@aws-sdk/client-organizations": "^3.1098.0",
83
- "@fjall/generator": "^10.1.1",
84
- "@fjall/util": "^10.1.1",
83
+ "@fjall/generator": "^10.1.2",
84
+ "@fjall/util": "^10.1.2",
85
85
  "constructs": "^10.7.2"
86
86
  },
87
87
  "overrides": {