-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deployment shouldn't use a static temp directory #45
Comments
But if we change the temp dir name, if two deploys are happening simultaneously, only one will actually deploy. The real solution is probably to fail if a deployment is in-progress. Just checking for the existence of the temp dir won't be adequate, however, because it could be leftover if a deploy fails partway through. Ideas? |
I think it's okay if two deploys happen at the same time and whichever ends last wins. This relates to the work @brianloveswords is doing right now on http://github.com/brianloveswords/deployer, though, so I'm curious what he thinks. @MattSurabian too! |
Also of interest: |
Do we need to consider that people might be running other playbooks than |
Multiple people running The only thing I want to address in this issue is handling concurrent deploys gracefully so we don't wind up with a site in production that is borked. I will admit the situation seems almost as rare as the configure one, but given how easy it is to mitigate, it seems worthwhile to put in the effort. A temp directory suffixed with a hash is easy to implement and would mean The only (sane) alternative that comes to mind is checking for the existence of fixed temp directory and bailing out, telling the user to force. This is bad though, because a temp directory could easily be left hanging around if a deploy was cut off mid-process, and wouldn't work well in situations where we are automating things (re: @brianloveswords work on deployer). Finally, in addition to doing this, we should probably address this concern with simple communication. At previous gigs (where lots of people were competent in how to deploy), we all agreed to announce in chat when a deploy was kicked off. Also, the deployment scripts posted messages in chat as it rolled out across our infra. |
Sounds like a good idea! |
Beyond that, 1. "Last one" meaning currently "last request-to-deploy message received". In an unlikely edge case where two messages come fairly close to each other and one gets delayed for some reason or needs to retry, the temporally earlier deploy message might end up getting received after the later message. We can mitigate this programmatically by adding a delay to the queue processor and sorting the messages by time sent so we process them in the order-of-intent rather than order-of-receipt. We can also mitigate this socially by telling people to avoid triggering two deploys in quick succession. |
I was really surprised when I searched Google for |
I'm wondering if there's a way to write a task that would go at the top of each playbook where this mattered to check to see if that playbook is also being run in another process. Of course, I'm seeing stuff like this, which isn't exactly helpful at first glance.
|
At the very least, we could have a playbook fail if it detects another ansible process. Thoughts? |
@cowboy what about touching a file in |
D'oh
|
Maybe blocks would help with lock cleanup?
But I have no context for this stuff. I'm going to leave you all alone now! |
@jugglinmike That also wouldn't work in the case of someone killing the Ansible process midway. I really think this is a problem for Ansible itself, not for userland to resolve (except in the case of @brianloveswords's work, where a series of commits could kick off a ton of deploys and we can't guarantee that every one will use whatever special hack we put in place). For the purposes of this issue, I believe our problem would be resolved with the |
Just leaving a note to myself, or whoever implements this... This line: |
if two deploys are happening simultaneously for some reason, they'll clobber.
The text was updated successfully, but these errors were encountered: