This question is regarding deployment of web applications.
Intro (you can skip)
I'm using django, and the way my hosting provider have set up their django support ends up causing the webapp to be scattered in at least three locations:
- Actual application code in
- Site settings/urls/templates in
So when I deploy/upgrade the website, I need to update several directories at once.
Is there a way to make an atomic file copying? I'm not "expert" at linux systems by any means, so please forgive my ignorance.
The copy operation involved several directory trees, either two or three, basically:
copy _tree1 to tree1 copy _tree2 to tree2
By atomic, I mean:
- It's either fully copied, or not copied at all. It should never be in a state of some-copied-but-some-failed.
- It's done in the shortest amount of time possible. Ideally there should be no point in time where the system sees the copy as it's happening in progress, it either sees the old version of the files or the new version; at no point in time shall it see the old version of file A but the new version of file B. If that's not entirely possible, then it should take no more than a few milli seconds.
My idea is to have something like double buffering: I prepare everything in a staging area, for instance,
_tree_x, and then
copy move it to
tree_x with should be an atomic operation that simply changes pointers on the disk.
I think that a single such
copy move operation is atomic in linux, (is it not?), but I need several such operations to be atomic as well; I want them to be treated as if they were a single move operation.