Skip to content

Open source AI coding agent. Designed for large projects and real world tasks.

 πŸ€– Plandex  πŸ“ Add health checks for ECS container and ALB target group ✏️ Edits: β€’ infra/src/main.ts βœ… Add container health check βœ… Add ALB target group health check

Dane Schneider9ed684f4e69b
diff --git a/infra/src/main.ts b/infra/src/main.ts
index 30dc9206..17a26e95 100644
--- a/infra/src/main.ts
+++ b/infra/src/main.ts
@@ -229,6 +229,16 @@ export class PlandexStack extends cdk.Stack {
// Add a container to the task definition
const container = taskDefinition.addContainer("plandex-server", {
+ healthCheck: {
+ command: [
+ "CMD-SHELL",
+ "curl -f http://localhost:8080/health || exit 1"
+ ],
+ interval: cdk.Duration.seconds(30),
+ timeout: cdk.Duration.seconds(5),
+ retries: 3,
+ startPeriod: cdk.Duration.seconds(60),
+ },
image: ecs.ContainerImage.fromEcrRepository(ecrRepository, imageTag),
logging: new ecs.AwsLogDriver({ streamPrefix: "plandex-server" }),
environment: {
@@ -347,6 +357,16 @@ export class PlandexStack extends cdk.Stack {
// Add a target group for the ECS service to the HTTPS listener
const targetGroup = httpsListener.addTargets("plandexEcsTarget", {
+ healthCheck: {
+ path: "/health",
+ port: "8080",
+ protocol: elbv2.Protocol.HTTP,
+ healthyHttpCodes: "200",
+ interval: cdk.Duration.seconds(30),
+ timeout: cdk.Duration.seconds(5),
+ healthyThresholdCount: 2,
+ unhealthyThresholdCount: 3,
+ },
port: 8080,
targets: [fargateService],
});