Page 1 of 1

Dev servers and seamless updates

Posted: Tue Jan 29, 2008 5:29 am
by shiznatix
Sorry if this is the wrong forum but since we don't have a "servers forum" I post here.

So at my work I have an in-house server and a server in London and also a server in Switzerland but thats used for other stuff. I do all of my testing work on my in-house server and then once I get a solid patch to a bug ready here, I just use a quick little rsync command to throw the stuff up on the London site. Everything works very well except for when it comes time to do massive overhauls.

The first full-blown code change was about the end of August last year. I basically just replaced the entire site with a "sorry, we are doing database work, be back soon" and went to work. There was a lot to be done like recompiling mysql, php, apache to update everything to the required versions. Then there was a change in the entire database which took a while and then a copy of all these new files into their proper places and configuring my few configuration files and then doing quick tests to make sure everything was working properly. Needless to say the site was down for quite some time.

Now is the time for the next step. Friday is the move for a complete overhaul in code but thats basically the only change. The database only gets a few changes to a couple tables and all versions of software stay the same. Although this time I don't see the site being down more than a half hour (lock the db up and do a complete backup of all files/tables) my boss still does not want this. He wants a complete seamless move, like nothing ever happened and everything goes on.

Now my question is how does one go about doing this? My admin skills are not very 1337 so I don't know any fancy tricks or anything. How can I move all the code over and it just be like POOF all is done? I know other sites do this, somehow, and I am asking you guys how it is done.

Re: Dev servers and seamless updates

Posted: Tue Jan 29, 2008 5:59 am
by Weirdan
you can employ symlinks like this:

Code: Select all

 
/var/www/docroot -> /var/www/version1.0
/var/www/version1.0  <========= current version
/var/www/version1.2  <========= new version
 
Once you configured and tested the code in version1.2 folder, you just point docroot to new version. If anything went wrong, you can quickly repoint it to previous version.

Re: Dev servers and seamless updates

Posted: Tue Jan 29, 2008 6:29 am
by Chris Corbyn
Having multiple app servers behind a director actually come in really handy for this. Under normal circumstances you have two or more app nodes running the same code base, requests hit the director which forwards the traffic onto any one of the app nodes (thus balancing the load). When you come to deploy a massive code change, you simply pull on of the app nodes out of the cluster, make the changes, test them by accessing that app node directly by IP or domain name if it has one, then set that as the live node and make the same changes on the others in turn, throwing them back into the cluster as you go. The advantage with this is that changes to PHP/Apache/MySQL etc can all be done without worrying about breaking the "live" site.

Amazon's EC2 makes it a lot easier than I make it sound.

With one server, yeah I go with ~Weirdan's suggestion... You can always create a new virtualhost for the staging version before you push it live.

Re: Dev servers and seamless updates

Posted: Tue Jan 29, 2008 2:49 pm
by Kieran Huggins
I think the biggest problem is the database changes - I'd do it at 2 in the morning 8)

Re: Dev servers and seamless updates

Posted: Tue Jan 29, 2008 3:22 pm
by Weirdan
Kieran Huggins wrote:I think the biggest problem is the database changes - I'd do it at 2 in the morning 8)
Doing updates on production databases when you're sleepy is bad for your career.

Re: Dev servers and seamless updates

Posted: Tue Jan 29, 2008 3:32 pm
by arjan.top
Kieran Huggins wrote:I think the biggest problem is the database changes - I'd do it at 2 in the morning 8)
but it is not 2am all over the world