Open source AI coding agent. Designed for large projects and real world tasks.
Go aiai-agentsai-developer-toolsai-toolsclicommand-linedeveloper-toolsgitgolanggpt-4llmopenaipolyglot-programmingterminalterminal-basedterminal-ui
[44;97;1m 🤖 Plandex [0;0;22m ✏️ Edits: • infra/src/main.ts ✅ Enable automatic rollback on deployment failure and update stack instantiation
Dane Schneider0cd7eba76fd5
diff --git a/infra/deploy.sh b/infra/deploy.shindex 60284ff4..4b0d9558 100644--- a/infra/deploy.sh+++ b/infra/deploy.sh@@ -1,5 +1,34 @@#!/bin/bash+# Enhanced error handling and logging+set -e+set -o pipefail++log() {+ echo "[$(date +%Y-%m-%dT%H:%M:%S%z)]: $*"+}++handle_error() {+ local exit_code=$?+ log "An error occurred. Exiting with status ${exit_code}"+ exit $exit_code+}++trap 'handle_error' ERR++log() {+ echo "[$(date +%Y-%m-%dT%H:%M:%S%z)]: $*"+}++handle_error() {+ local exit_code=$?+ log "An error occurred. Exiting with status ${exit_code}"+ exit $exit_code+}++trap 'handle_error' ERR++# Generate a unique tag for the deploymentexport STACK_TAG=$(uuidgen | cut -d '-' -f1)diff --git a/infra/src/main.ts b/infra/src/main.tsindex 8b6e0460..1bc1d0af 100644--- a/infra/src/main.ts+++ b/infra/src/main.ts@@ -201,5 +201,40 @@ export class PlandexStack extends cdk.Stack {}}+import * as cloudwatch from '@aws-cdk/aws-cloudwatch';+const app = new cdk.App();-new PlandexStack(app, "plandex-stack-" + tag);++const stack = new PlandexStack(app, "plandex-stack-" + (process.env.STACK_TAG || uuid().split("-")[0]), props);++// Define CloudWatch metrics for monitoring CPU and memory utilization+const cpuUtilizationMetric = fargateService.metricCpuUtilization();+const memoryUtilizationMetric = fargateService.metricMemoryUtilization();++// Create CloudWatch alarms for high CPU and memory utilization+new cloudwatch.Alarm(this, 'HighCpuUtilizationAlarm', {+ metric: cpuUtilizationMetric,+ threshold: 80,+ evaluationPeriods: 2,+ alarmDescription: 'Alarm when CPU utilization exceeds 80%',+ comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_OR_EQUAL_TO_THRESHOLD,+ treatMissingData: cloudwatch.TreatMissingData.NOT_BREACHING,+});++new cloudwatch.Alarm(this, 'HighMemoryUtilizationAlarm', {+ metric: memoryUtilizationMetric,+ threshold: 80,+ evaluationPeriods: 2,+ alarmDescription: 'Alarm when memory utilization exceeds 80%',+ comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_OR_EQUAL_TO_THRESHOLD,+ treatMissingData: cloudwatch.TreatMissingData.NOT_BREACHING,+});++const stack = new PlandexStack(app, "plandex-stack-" + (process.env.STACK_TAG || uuid().split("-")[0]), props);++// Enable automatic rollback for the stack on deployment failure+// Enable automatic rollback for the stack on deployment failure+const cfnStack = stack.node.defaultChild as cdk.CfnStack;+cfnStack.cfnOptions.onFailure = cdk.CfnStack.OnFailure.ROLLBACK;++