如何在不关闭网站的情况下更新网站? [英] How to update a website without making it go down?

查看:121
本文介绍了如何在不关闭网站的情况下更新网站?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要最佳实践来更新我网站上的一个或多个文件而不会使其崩溃;

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

例如,如果我更新Model.php文件,则上传将花费几秒钟,例如替换服务器上的文件之前一两秒钟,与此同时,网站将显示一些错误,表明model.php不是发现或未完成,即使我抑制了错误,该网站最终也会死掉.

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.

最佳做法是什么?

推荐答案

我在实践中经常使用并看到的一种实践是-

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

  • 使用SVN或Git之类的版本控制系统(VCS)

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

上,使站点的Web根成为指向目录的符号链接,该目录包含站点的最新修订版本(例如,/www/domain.com/r555). 555

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

当发生更改时,签入对VCS的更改

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

具有一个脚本,该脚本将最新的修订签出到新目录中,并带有修订名称(例如/www/domain.com/r556)

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

签出完成后,更改符号链接并使其指向/www/domain.com/r556.

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

如果您拥有动态数据(例如文件上载)并且您无法在VCS中拥有这些动态数据,则存在一些障碍,但是可以在不停机的情况下进行处理.

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.

这篇关于如何在不关闭网站的情况下更新网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆