4 ms·
Is git push atomic? I'm reaching the point with a PHP application where enough people are using it at any one point, every time i push an update (using lftp --m
by mappu 14y ago
Is git push atomic? I'm reaching the point with a PHP application where enough people are using it at any one point, every time i push an update (using lftp --mirror over sftp) someone gets caught in the crossfire.
My next step is deploying to a temporary folder and swapping symlinks around, but if git/hg can do an atomic update that would be much simpler.
- pyre 14y agoI do not believe that checking out all files in a repository is supposed to be a single atomic action in either git or hg.
- mappu 14y agoI didn't think so. Thanks for the clarification.
- kijin 14y agoIf you have APC (which you should), you can turn off apc.stat to make PHP ignore changes to actual files and keep serving scripts from the (now stale) opcode cache. Depending on the structure of your app, this might be good enough to keep things running smoothly during the second or two that it takes for git to update the working tree. When you're done, atomically clear the opcode cache. Turning off apc.stat also helps your pages load faster.
- saurik 14y agoNo. In fact, git doesn't even swap individual files atomically (which is what I had expected it to do): during updates the files momentarily disappear, which caused serious issues for my site and made me move back to rsync deployment recently (which has the other security advantage of not keeping the entire history of the website on the edge servers).
- nimrody 14y agoUsing symlinks is the way Capistrano does it and has the benefit of being both atomic and easy/quick to revert if something goes wrong. There's no way git checkout can be atomic.