Skip to content

Commit 390a488

Browse files
committed
Chef stack updates for daemon-instance provisioning
- Don't fail stack update when daemon-instance provisioning fails. - Don't re-run user-data shell script on daemon instance. - Increase daemon-instance timeout to 2 hours. [ci skip]
1 parent f0ca594 commit 390a488

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

aws/cloudformation/bootstrap_chef_stack.sh.erb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#!/bin/bash -x
22
# UserData bootstrap script for CloudFormation stack instances.
33

4+
<% unless daemon -%>
45
# Modify cloud-init to re-run this user-data script every time instance restarts.
56
# Ref: http://stackoverflow.com/a/10455027
67
sed -i 's/scripts-user$/\[scripts-user, always\]/' /etc/cloud/cloud.cfg
8+
<% end -%>
79

810
# Bootstrap prerequisites
911
apt-get update
@@ -70,10 +72,12 @@ JSON
7072
# Provision via Chef.
7173
OPTIONS="<%=local_mode ? '-z ' : ''%> -b $BRANCH -n $NODE_NAME -r '$RUN_LIST' -e $ENVIRONMENT"
7274
sudo -u ubuntu bash -c "aws s3 cp s3://$S3_BUCKET/chef/bootstrap-$STACK.sh - | sudo bash -s -- $OPTIONS"
73-
[ $? -eq 0 ] && STATUS=SUCCESS || STATUS=FAILURE
75+
[ $? -eq 0 ] && STATUS=SUCCESS || STATUS=<%=daemon ? 'SUCCESS' : 'FAILURE'%>
7476

77+
<% unless daemon -%>
7578
# Workaround for version-controlled files modified by seed.
7679
sudo -u ubuntu bash -c "cd /home/ubuntu/$ENVIRONMENT && git reset --hard"
80+
<% end -%>
7781

7882
# Signal CloudFormation resource.
7983
aws cloudformation signal-resource \

aws/cloudformation/cloud_formation_stack.yml.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ Resources:
464464
Type: AWS::EC2::Instance
465465
CreationPolicy:
466466
ResourceSignal:
467-
Timeout: PT60M
467+
Timeout: PT2H
468468
Properties:
469469
ImageId: <%=image_id%>
470470
InstanceType: !Ref InstanceType

0 commit comments

Comments
 (0)