(MODE-11365) Minor tweeks in instance startup check.
This commit is contained in:
parent
748feb25e4
commit
0c32f2bcd0
2 changed files with 2 additions and 2 deletions
|
|
@ -50,7 +50,7 @@ resource "aws_autoscaling_group" "autoscalinggroup" {
|
||||||
# Wait until the number of "ok" instance status checks is equal to 1
|
# 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;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 = "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"
|
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 \"Got 3 healthy checks in a row, proceeding...\"; sleep 10"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ resource "aws_alb_target_group" "target_group_this" {
|
||||||
port = "80"
|
port = "80"
|
||||||
protocol = "HTTP"
|
protocol = "HTTP"
|
||||||
vpc_id = "${data.terraform_remote_state.mono_vpc.vpc_id[0]}"
|
vpc_id = "${data.terraform_remote_state.mono_vpc.vpc_id[0]}"
|
||||||
slow_start = 180
|
slow_start = 200
|
||||||
deregistration_delay = 120
|
deregistration_delay = 120
|
||||||
stickiness {
|
stickiness {
|
||||||
type = "lb_cookie"
|
type = "lb_cookie"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue