Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I need the best practice for updating one or more files on my website without making it go down;

example, if i update Model.php file, the upload will take few seconds, like one or two seconds before it replaces the file on the server, in the meantime, the website will show some error that model.php is not found, or not complete, even if i suppress the errors, the website will die eventually.

what is the best practice for that?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
196 views
Welcome To Ask or Share your Answers For Others

1 Answer

One practice I've often used and seen in practice is -

  • use a Version Control System (VCS) like SVN or Git

  • on the live server, make the site's web root a symbolic link to a directory containing the latest revision of your web site (eg. /www/domain.com/r555) for revision no. 555

  • when a change comes up, check in changes to the VCS

  • have a script that checks out the latest revision to a new directory, carrying the revision name (say, /www/domain.com/r556)

  • when the checkout is done, change the symbolic link and make it point to /www/domain.com/r556.

There are a few snags if you have dynamic data like file uploads and such that you can't have in the VCS, but they can all be dealt with without downtime.

Things like database changes may still require some kind of maintenance mode, though.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...