(MODE-11365) Increase instance startup wait time.
This commit is contained in:
parent
3d601423d1
commit
748feb25e4
2 changed files with 4 additions and 3 deletions
|
|
@ -24,6 +24,7 @@ resource "aws_autoscaling_group" "autoscalinggroup" {
|
|||
max_size = 5
|
||||
desired_capacity = 1
|
||||
min_size = 1
|
||||
default_cooldown = 60
|
||||
health_check_grace_period = 300
|
||||
health_check_type = "ELB"
|
||||
force_delete = true
|
||||
|
|
@ -49,7 +50,7 @@ resource "aws_autoscaling_group" "autoscalinggroup" {
|
|||
# Wait until the number of "ok" instance status checks is equal to 1
|
||||
# command = "sleep 15;expected=2; current=0; retries=0; instances=$(aws autoscaling describe-auto-scaling-groups --auto-scaling-group-name \"${aws_autoscaling_group.autoscalinggroup.name}\" --query 'AutoScalingGroups[*].Instances[*].InstanceId' --output text); while [ \"$current\" -lt \"$expected\" ]; do for i in $(echo $instances); do check=$(aws elbv2 describe-target-health --target-group-arn \"${aws_alb_target_group.target_group_this.arn}\" --query \"TargetHealthDescriptions[?Target.Id == '$i'].TargetHealth.State\" --output text); echo \"$check\"; if [ \"$check\" = \"$(echo 'healthy')\" ]; then current=\"$(echo $((++current)))\"; else current=\"$(echo $((--current)))\"; fi; done; if [ \"$current\" -eq \"$expected\" ]; then break; else current=\"0\"; retries=\"$((++retries))\" fi; if [ \"$retries\" = \"3\" ]; then break;fi; done"
|
||||
# command = "sleep 15;expected=2; current=0; retries=0; instances=$(aws autoscaling describe-auto-scaling-groups --auto-scaling-group-name \"${aws_autoscaling_group.autoscalinggroup.name}\" --query 'AutoScalingGroups[*].Instances[*].InstanceId' --output text); while [ \"$current\" -lt \"$expected\" ]; do for i in $(echo $instances); do check=$(aws elbv2 describe-target-health --target-group-arn \"${aws_alb_target_group.target_group_this.arn}\" --query \"TargetHealthDescriptions[?Target.Id == '$i'].TargetHealth.State\" --output text); echo \"$check\"; if [ \"$check\" = \"$(echo 'healthy')\" ]; then current=\"$(echo $((++current)))\"; else current=\"$(echo $((--current)))\"; fi; done; if [ \"$current\" -eq \"$expected\" ]; then break; else current=\"0\"; retries=\"$((++retries))\" fi; if [ \"$retries\" = \"3\" ]; then break;fi; done"
|
||||
command = "sleep 15; current=0; required=3; instances=$(aws autoscaling describe-auto-scaling-groups --auto-scaling-group-name \"${aws_autoscaling_group.autoscalinggroup.name}\" --query 'AutoScalingGroups[*].Instances[*].InstanceId' --output text); for i in $(echo $instances); do check=$(aws elbv2 describe-target-health --target-group-arn \"${aws_alb_target_group.target_group_this.arn}\" --query \"TargetHealthDescriptions[?Target.Id == '$i'].TargetHealth.State\" --output text); while true; if [ \"$current\" == \"$required\" ]; then break;fi; if [ \"$check\" == \"healthy\" ]; then current=$((++current)); fi; do echo \"Waiting for instance $i startup\"; sleep 15; check=$(aws elbv2 describe-target-health --target-group-arn \"${aws_alb_target_group.target_group_this.arn}\" --query \"TargetHealthDescriptions[?Target.Id == '$i'].TargetHealth.State\" --output text); done; current=0; done; echo \"Waiting for final status check (1m).\"; sleep 60"
|
||||
command = "echo \"Waiting for instances spinup (2m)\"; sleep 120; current=0; required=3; instances=$(aws autoscaling describe-auto-scaling-groups --auto-scaling-group-name \"${aws_autoscaling_group.autoscalinggroup.name}\" --query 'AutoScalingGroups[*].Instances[*].InstanceId' --output text); for i in $(echo $instances); do check=$(aws elbv2 describe-target-health --target-group-arn \"${aws_alb_target_group.target_group_this.arn}\" --query \"TargetHealthDescriptions[?Target.Id == '$i'].TargetHealth.State\" --output text); while true; if [ \"$current\" == \"$required\" ]; then break;fi; if [ \"$check\" == \"healthy\" ]; then current=$((++current)); fi; do echo \"check = $check\"; echo \"Waiting for instance $i startup\"; sleep 15; check=$(aws elbv2 describe-target-health --target-group-arn \"${aws_alb_target_group.target_group_this.arn}\" --query \"TargetHealthDescriptions[?Target.Id == '$i'].TargetHealth.State\" --output text); done; current=0; done; echo \"Waiting for final status check (1m).\"; sleep 60"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ resource "aws_alb_target_group" "target_group_this" {
|
|||
port = "80"
|
||||
protocol = "HTTP"
|
||||
vpc_id = "${data.terraform_remote_state.mono_vpc.vpc_id[0]}"
|
||||
slow_start = 120
|
||||
deregistration_delay = 150
|
||||
slow_start = 180
|
||||
deregistration_delay = 120
|
||||
stickiness {
|
||||
type = "lb_cookie"
|
||||
enabled = true
|
||||
|
|
|
|||
Loading…
Reference in a new issue