I'm maintaining a website for a company and since the software running this website is still pretty young I have to make updates pretty frequently. The problem is that while I'm updating the php code and the database the site is down.
One solution to point the domain to a temporary version of the site while I'm maintaining it but I really don't want to do that manually.
My question now is if there's any software (open source preferably) out there to update and maintain a web application while avoiding any downtime (facebook for example is updated frequently and I'm assuming that they have some sort of sophisticated system to update their code without interrupting the access).
Also, I don't want to replace every file over and over again so it would be cool if this tool thingy keeps track of changes and only updates files that were changed.
Well it would help if we knew what you were running in terms of OS and server software. However, in any case, there's little you can do to keep a server online while you make updates, especially if you're using databases and php. You would pretty much have to be able to store the site and the entire database in the RAM. You could try cloning the hdds you need so you could have multiple copies of everything, but redirecting all your pages to a new set of hard drives and back again would take serious time. But, if you have access to a spare machine, clone your server. Either by manually setting it up just the same as your main server, or (if you can get/build a system with more or less the same hardware) image the necessary hard drives and copy them to the clone. Make your changes, updates, etc. on the clone and test them.
Then use port forwarding (you probably already are) on your network switch/router to move the traffic from your full time server, to the clone. When you do this, the change takes 1 or 2 seconds. Then make the changes on your full time server and transfer the traffic back (another 1 or 2 second). In the end, your server gets updated with a total of 2-4 seconds downtime. The end result is, a few people might have to reload a page, and they'll probably never suspect that the server was changed or "offline".