From b1dbcfecbbdf4c9e086bd1865866efe53a6bf088 Mon Sep 17 00:00:00 2001 From: Greg Harvey Date: Fri, 26 Apr 2024 14:59:17 +0200 Subject: [PATCH 1/3] Adding extra healthcheck options for ECS services. --- docs/roles/deploy_container.md | 4 ++++ roles/deploy_container/README.md | 4 ++++ roles/deploy_container/defaults/main.yml | 4 ++++ roles/deploy_container/tasks/action-create.yml | 7 +++++-- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/docs/roles/deploy_container.md b/docs/roles/deploy_container.md index 06847722..ed42996d 100644 --- a/docs/roles/deploy_container.md +++ b/docs/roles/deploy_container.md @@ -124,6 +124,10 @@ deploy_container: protocol: http path: / response_codes: "200" + # optional additional healthcheck settings + #interval: 60 + #healthy_threshold_count: 3 + #unhealthy_threshold_count: 5 # Requires the deploy IAM user to have the managed AWSCertificateManagerFullAccess and AmazonRoute53FullAccess policies attached acm: # see https://github.com/codeenigma/ce-provision/tree/1.x/roles/aws/aws_acm create_cert: false diff --git a/roles/deploy_container/README.md b/roles/deploy_container/README.md index 06847722..ed42996d 100644 --- a/roles/deploy_container/README.md +++ b/roles/deploy_container/README.md @@ -124,6 +124,10 @@ deploy_container: protocol: http path: / response_codes: "200" + # optional additional healthcheck settings + #interval: 60 + #healthy_threshold_count: 3 + #unhealthy_threshold_count: 5 # Requires the deploy IAM user to have the managed AWSCertificateManagerFullAccess and AmazonRoute53FullAccess policies attached acm: # see https://github.com/codeenigma/ce-provision/tree/1.x/roles/aws/aws_acm create_cert: false diff --git a/roles/deploy_container/defaults/main.yml b/roles/deploy_container/defaults/main.yml index ff99d2b9..98b23723 100644 --- a/roles/deploy_container/defaults/main.yml +++ b/roles/deploy_container/defaults/main.yml @@ -81,6 +81,10 @@ deploy_container: protocol: http path: / response_codes: "200" + # optional additional healthcheck settings + #interval: 60 + #healthy_threshold_count: 3 + #unhealthy_threshold_count: 5 # Requires the deploy IAM user to have the managed AWSCertificateManagerFullAccess and AmazonRoute53FullAccess policies attached acm: # see https://github.com/codeenigma/ce-provision/tree/1.x/roles/aws/aws_acm create_cert: false diff --git a/roles/deploy_container/tasks/action-create.yml b/roles/deploy_container/tasks/action-create.yml index cc06163d..5dadd039 100644 --- a/roles/deploy_container/tasks/action-create.yml +++ b/roles/deploy_container/tasks/action-create.yml @@ -70,7 +70,7 @@ - name: Fetch the aws_acm files. ansible.builtin.get_url: - url: "https://raw.githubusercontent.com/codeenigma/ce-provision/1.x/roles/aws/aws_acm/{{ item }}/main.yml" + url: "https://raw.githubusercontent.com/codeenigma/ce-provision/2.x/roles/aws/aws_acm/{{ item }}/main.yml" dest: "{{ _ce_deploy_base_dir }}/roles/aws_acm/{{ item }}/main.yml" delegate_to: localhost with_items: @@ -79,7 +79,7 @@ - name: Fetch the aws_acm tasks. ansible.builtin.get_url: - url: https://raw.githubusercontent.com/codeenigma/ce-provision/1.x/roles/aws/aws_acm/tasks/main.yml + url: https://raw.githubusercontent.com/codeenigma/ce-provision/2.x/roles/aws/aws_acm/tasks/main.yml dest: "{{ _ce_deploy_base_dir }}/roles/aws_acm/tasks/main.yml" delegate_to: localhost @@ -161,6 +161,9 @@ vpc_id: "{{ _aws_ecs_cluster_vpc_id }}" health_check_protocol: "{{ deploy_container.aws_ecs.health_check.protocol }}" health_check_path: "{{ deploy_container.aws_ecs.health_check.path }}" + health_check_interval: "{{ deploy_container.aws_ecs.health_check.interval | default(omit) }}" + healthy_threshold_count: "{{ deploy_container.aws_ecs.health_check.healthy_threshold_count | default(omit) }}" + unhealthy_threshold_count: "{{ deploy_container.aws_ecs.health_check.unhealthy_threshold_count | default(omit) }}" successful_response_codes: "{{ deploy_container.aws_ecs.health_check.response_codes }}" target_type: ip targets: "{{ deploy_container.aws_ecs.targets }}" From 8a6b456a6635c944553ae9d9f02cd8e711de1ef0 Mon Sep 17 00:00:00 2001 From: Greg Harvey Date: Fri, 26 Apr 2024 16:27:02 +0200 Subject: [PATCH 2/3] Renaming scale up/down to in/out to avoid confusion. --- docs/roles/deploy_container.md | 4 ++-- roles/deploy_container/README.md | 4 ++-- roles/deploy_container/defaults/main.yml | 4 ++-- roles/deploy_container/tasks/action-create.yml | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/roles/deploy_container.md b/docs/roles/deploy_container.md index ed42996d..15955a56 100644 --- a/docs/roles/deploy_container.md +++ b/docs/roles/deploy_container.md @@ -88,8 +88,8 @@ deploy_container: - example-cluster-dev-b # See docs for values: https://docs.aws.amazon.com/autoscaling/application/APIReference/API_TargetTrackingScalingPolicyConfiguration.html service_autoscale_metric_type: ECSServiceAverageCPUUtilization - service_autoscale_up_cooldown: 120 - service_autoscale_down_cooldown: 120 + service_autoscale_in_cooldown: 120 # scale down + service_autoscale_out_cooldown: 120 # scale up service_autoscale_target_value: 70 # the value to trigger a scaling event at service_public_container_ip: false # set to true to make containers appear on an EIP - more details: https://stackoverflow.com/a/66802973 service_enable_ssm: false # set to true to allow arbitrary command execution on containers via the AWS API diff --git a/roles/deploy_container/README.md b/roles/deploy_container/README.md index ed42996d..15955a56 100644 --- a/roles/deploy_container/README.md +++ b/roles/deploy_container/README.md @@ -88,8 +88,8 @@ deploy_container: - example-cluster-dev-b # See docs for values: https://docs.aws.amazon.com/autoscaling/application/APIReference/API_TargetTrackingScalingPolicyConfiguration.html service_autoscale_metric_type: ECSServiceAverageCPUUtilization - service_autoscale_up_cooldown: 120 - service_autoscale_down_cooldown: 120 + service_autoscale_in_cooldown: 120 # scale down + service_autoscale_out_cooldown: 120 # scale up service_autoscale_target_value: 70 # the value to trigger a scaling event at service_public_container_ip: false # set to true to make containers appear on an EIP - more details: https://stackoverflow.com/a/66802973 service_enable_ssm: false # set to true to allow arbitrary command execution on containers via the AWS API diff --git a/roles/deploy_container/defaults/main.yml b/roles/deploy_container/defaults/main.yml index 98b23723..169fb359 100644 --- a/roles/deploy_container/defaults/main.yml +++ b/roles/deploy_container/defaults/main.yml @@ -45,8 +45,8 @@ deploy_container: - example-cluster-dev-b # See docs for values: https://docs.aws.amazon.com/autoscaling/application/APIReference/API_TargetTrackingScalingPolicyConfiguration.html service_autoscale_metric_type: ECSServiceAverageCPUUtilization - service_autoscale_up_cooldown: 120 - service_autoscale_down_cooldown: 120 + service_autoscale_in_cooldown: 120 # scale down + service_autoscale_out_cooldown: 120 # scale up service_autoscale_target_value: 70 # the value to trigger a scaling event at service_public_container_ip: false # set to true to make containers appear on an EIP - more details: https://stackoverflow.com/a/66802973 service_enable_ssm: false # set to true to allow arbitrary command execution on containers via the AWS API diff --git a/roles/deploy_container/tasks/action-create.yml b/roles/deploy_container/tasks/action-create.yml index 5dadd039..58ebf27a 100644 --- a/roles/deploy_container/tasks/action-create.yml +++ b/roles/deploy_container/tasks/action-create.yml @@ -328,8 +328,8 @@ target_tracking_scaling_policy_configuration: PredefinedMetricSpecification: PredefinedMetricType: "{{ deploy_container.aws_ecs.service_autoscale_metric_type }}" - ScaleInCooldown: "{{ deploy_container.aws_ecs.service_autoscale_up_cooldown }}" - ScaleOutCooldown: "{{ deploy_container.aws_ecs.service_autoscale_down_cooldown }}" + ScaleInCooldown: "{{ deploy_container.aws_ecs.service_autoscale_in_cooldown }}" + ScaleOutCooldown: "{{ deploy_container.aws_ecs.service_autoscale_out_cooldown }}" DisableScaleIn: false TargetValue: "{{ deploy_container.aws_ecs.service_autoscale_target_value }}" delegate_to: localhost From b27e9a0af1a5649969c9f9a4cc1631c60cf9aee8 Mon Sep 17 00:00:00 2001 From: Greg Harvey Date: Fri, 26 Apr 2024 16:29:26 +0200 Subject: [PATCH 3/3] Spotted annoying typo. --- roles/_init/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/_init/README.md b/roles/_init/README.md index f31e8064..8d4fa92e 100644 --- a/roles/_init/README.md +++ b/roles/_init/README.md @@ -1,5 +1,5 @@ # Init -Mandatory role that must run before any other `ce-edploy` roles when executing a playbook. +Mandatory role that must run before any other `ce-deploy` roles when executing a playbook. These variables **must** be set in a common variables file if you do not wish to use defaults.