Hi Lee
I was looking at this the other day and had a couple of questions.
1. You mentioned that it is a good idea to "copy the broken release to a
safe place". Doesn't the rollback task already handle this for you? When I
run a rollback, I end up with a rolled-back-release-#{last_release}.tar.gz
in the deploy directory.
2. Do you have any suggestions about how you would decide whether it is
safe to issue a rollback based on the exit code of the cap command? If for
some reason the deploy failed before it created the new release directory,
it looks like running a rollback would do the wrong thing and rollback the
current good release. As far as I can tell, cap always returns an exit code
of 1 when it fails so I am not sure how to use that to determine if we
should actually rollback or not.
Thanks!
Ryan
On Wednesday, October 22, 2014 6:32:27 AM UTC-4, Lee Hambley wrote:
>
> Haha, no worries.
>
> We actually elected in v3 not to do an automatic rollback, because many
> people found it inconvenient to debug, and we're essentially defaulting to
> deleting stuff in production.
>
> There was many weird edge cases with assets being incorrecly removed, etc,
> etc, et... nothing that was 100% our fault, but we figured just failing
> clearly was a better way to handle that.
>
> In your own code, you can rescue it, and
> Rake::Task["deploy:rollback"].invoke, but it's probably wiser in this case
> (and, in my cases, usually) to do a switch on the shell, decide what to do,
> and then rollback.
>
> Of course a rollback is weird, because we have to delete the folder in
> order to keep the "newest release" logic working, but often if you had a
> bad deploy, you need the contents of that folder to do some forensics.
>
> For that reason, keep doing what you are doing, and consider adding a task
> to copy the broken release to a safe place, before it's removed by it is
> removed in the rollback flow
> <http://capistranorb.com/documentation/getting-started/flow/>.
>
> If for some reason cap is failing, but you get a zero-exit status, then
> let me know specifically what's going wrong, and I'll fix that, you should
> be able to rely on our exit statuses being informative.
>
> Lee Hambley
> --
> http://lee.hambley.name/
> +49 (0) 170 298 5667
>
> On 22 October 2014 12:25, Rafa García <[email protected]
> <javascript:>> wrote:
>
>> Capistrano v3 (3.2.1)
>>
>> PD: I forgot to paste gem version
>>
>> 2014-10-22 12:23 GMT+02:00 Rafa García <[email protected]
>> <javascript:>>:
>>
>>> Hi Lee :D
>>>
>>> I'm using Capistrano v3.
>>>
>>> 2014-10-22 12:20 GMT+02:00 Lee Hambley <[email protected] <javascript:>
>>> >:
>>>
>>>> Hi Rafa, (welcome back!)
>>>>
>>>> Which version, two or three ?
>>>>
>>>> Lee Hambley
>>>> --
>>>> http://lee.hambley.name/
>>>> +49 (0) 170 298 5667
>>>>
>>>> On 22 October 2014 11:33, Rafa García <[email protected]
>>>> <javascript:>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I have two applications deployed with Capistrano. In the last deploy
>>>>> we had a problem with one of them but rollback was not executed
>>>>> automatically.
>>>>>
>>>>> Deploys are done automatically with jenkins. I achieved to execute
>>>>> rollback inside jenkins task capturing status code in a condition and
>>>>> then
>>>>> executing rollback task.
>>>>>
>>>>> But I'm wondering (if it's possible) how I can do a rollback
>>>>> automatically if any of the deploy tasks fails from Capistrano?
>>>>>
>>>>> Thanks
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Capistrano" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to [email protected] <javascript:>.
>>>>> To view this discussion on the web, visit
>>>>> https://groups.google.com/d/msgid/capistrano/CALgP05YcH%3DVRDXYt4HF816ETs0Eb_akUBCn9%2BwmKZsVXigAu5Q%40mail.gmail.com
>>>>>
>>>>> <https://groups.google.com/d/msgid/capistrano/CALgP05YcH%3DVRDXYt4HF816ETs0Eb_akUBCn9%2BwmKZsVXigAu5Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Capistrano" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected] <javascript:>.
>>>> To view this discussion on the web, visit
>>>> https://groups.google.com/d/msgid/capistrano/CAN_%2BVLXTuookt36HZ-qVf1_F%3DEdN5hwFn6aXa1AbRAvD7r%3D4sw%40mail.gmail.com
>>>>
>>>> <https://groups.google.com/d/msgid/capistrano/CAN_%2BVLXTuookt36HZ-qVf1_F%3DEdN5hwFn6aXa1AbRAvD7r%3D4sw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Capistrano" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> To view this discussion on the web, visit
>> https://groups.google.com/d/msgid/capistrano/CALgP05Y7sOuzO%2BLmOJLKYaYaqSGbqC0yxJfqJ3H-xfjsm-DmYQ%40mail.gmail.com
>>
>> <https://groups.google.com/d/msgid/capistrano/CALgP05Y7sOuzO%2BLmOJLKYaYaqSGbqC0yxJfqJ3H-xfjsm-DmYQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
You received this message because you are subscribed to the Google Groups
"Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web, visit
https://groups.google.com/d/msgid/capistrano/7220954f-4d53-484c-b7ac-157b60708465%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.