intuit / simple_deploy

Maintenance Mode - Simple Deploy is an opinionated CLI tool for managing AWS Cloud Formation Stacks.
MIT License
64 stars 22 forks source link

create with option --disable-rollback #241

Open munjeli opened 10 years ago

munjeli commented 10 years ago

I love simple_deploy but I don't see how to create a stack with that option; can I pass it somehow or is not supported? I need to ssh into my failures to see where the stack ran off the track.

ghost commented 10 years ago

@munjeli

You can pass Abort-no to simple_deploy create.

simple_deploy create -e env -n stack_name -a Abort=no

Let us know if that solves your problem so we can close this.

Thanks.

munjeli commented 10 years ago

Alas, that didn't work. My stack is rolling back on failure.

ghost commented 10 years ago

My bad. I forgot that we add abort support to our cloud formation templates to support that. When I am back at a laptop I can post a snippet for you if you want to try in your template.

Sent from my iPhone

On Sep 24, 2014, at 5:42 PM, Ele Munjeli notifications@github.com<mailto:notifications@github.com> wrote:

Alas, that didn't work. My instance is rolling back on failure.

Reply to this email directly or view it on GitHubhttps://github.com/intuit/simple_deploy/issues/241#issuecomment-56759756.

bw-intuit commented 10 years ago

@munjeli are you refering to the disable rollback option below:

DisableRollback
Set to true to disable rollback of the stack if stack creation failed. You can specify either DisableRollback or OnFailure, but not both.

Default: false

Type: Boolean

Required: No

http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CreateStack.html

munjeli commented 10 years ago

Please do. For some reason I can't get it to work in the template even though I read the docs. A snippet would be helpful.

ghost commented 10 years ago

@munjeli

Here we go. The hope is you can use this so we don't have to add an option to simple_deploy.

Snippet 1:

"Parameters": {
"Abort": {
      "Description": "Should the entire deployment be aborted if bootstrapping fails?",
      "Type": "String",
      "Default": "yes",
      "AllowedValues": [ "yes", "no" ],
      "ConstraintDescription": "yes or no"
    }
}

Snippet 2:

"Mappings": {
"BootstrapSettingMap": {
      "abort": { "yes": "$?", "no": "0" }
    }
}

Snippet 3:

"Resources": {
  "InstanceLaunchConfig": {
    "UserData": { "Fn::Base64": { "Fn::Join": ["", [
     "export CFN_SIGNAL_BIN=/path/to/cfn-signal", "\n",
     "runuser -c \"/path/to/myscript\" root", "\n",
      "export CONFIGURE_EXIT_STATUS=$? ",
            "CFN_ABORT_SIGNAL=", { "Fn::FindInMap": [ "BootstrapSettingMap", "abort", { "Ref": "Abort" } ] }, "\n",
       "if [ $CONFIGURE_EXIT_STATUS -ne 0 ] && [ $CFN_ABORT_SIGNAL -ne 0 ] ; ", "then", "\n",
         "$CFN_SIGNAL_BIN -e $CFN_ABORT_SIGNAL",
              " '", { "Ref": "InstancesWaitHandle" }, "'\n",
            "shutdown -h now", "\n",
        "else", "\n",
          "$CFN_SIGNAL_BIN -e $CFN_ABORT_SIGNAL",
              " '", { "Ref": "InstancesWaitHandle" }, "'\n",
          "fi", "\n",
       ]]}}
munjeli commented 10 years ago

Wow, no wonder I didn't figure it out :P

Thanks so much, I'll run these or mod my own. It shouldn't be you supporting the option, we should be able to access the option as a regular parameter in the template. It's a bit goofy to have it as a property of the stack but not being able to access it on the template.

Close the issue!

munjeli commented 10 years ago

@brettweavnet-intuit yes, the option on the cli where I can create a stack with --disable-rollback. Tragically, there isn't a way to insert "DisableRollback": True into the template.