views:

184

answers:

1

We are currently talking about deploying a website via rsync. However, during rsyncing the application is left in an inconsistent state, as some files may already be synced while others still are left with the old version right? How do people deal with this issue? I guess the same problem exists when deploying via svn/git/cvs. Should I just close the site, rsync, and open up again? Or do people simply ignore this inconsistency problem?

+2  A: 

Use a two-step deployment. rsync to a test directory, ideally test it, then swap the production and test deployments around. The first time you do this, you might not have a ready-to-go test directory, but you can fix this by simply rsync-ing from production to test.

Marcelo Cantos
How would you realize such a swap around? Ideally this shouldn't require a webserver restart. The only way I can imagine is via symlinking the document root to the current production environment. Then the switch would be to move the symlink. Is this possible without first deleting the link?
zedoo
That's probably not going to work very well, if at all. The best way to swap over two web servers is via load balancing. Allow both servers to run concurrently, take the old one out of the loop, and shut it down when it becomes idle (finishes delivering its last response). Of course, this technique has important implications for how you perform upgrades. For instance, your database upgrades need to happen in advance while the old system is online, and must be benign from the old system's perspective.
Marcelo Cantos
Okay I'll think about if that's worth the implementation effort. You can't recommend a book on the topic can you?
zedoo
_Scalable Internet Architectures_ is a good reference for this kind of stuff. I don't know if it specifically discusses the above, since I don't have my copy on hand, but it's a good book to have, regardless. I've seen online blogs about the technique too (it's essentially how companies like eBay manage upgrades), but I can't locate them just now.
Marcelo Cantos