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 π Implement error handling, logging, CloudWatch monitoring, and security enhancements in the deployment and CDK scripts. π Implement error handling, logging, CloudWatch monitoring, and security enhancements in the deployment and CDK scripts. π Implement error handling, logging, CloudWatch monitoring, and security enhancements in the deployment and CDK scripts. π Implement error handling, logging, CloudWatch monitoring, and security enhancements in the deployment and CDK scripts. π Implement error handling, logging, CloudWatch monitoring, and security enhancements in the deployment and CDK scripts. π Implement error handling, logging, CloudWatch monitoring, and security enhancements in the deployment and CDK scripts. βοΈ Edits: β’ infra/deploy.sh β Add comprehensive error handling and enhanced logging β’ infra/src/main.ts β Configure automatic rollback on deployment failure β Configure automatic rollback on deployment failure β Configure automatic rollback on deployment failure β Configure automatic rollback on deployment failure β Remove duplicate code for setting automatic rollback on deployment failure
Dane Schneider2580a0ce9ab6
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;++