[英]How to migrate a single (php||javascript||…) file in production without time constraints
I have simple files (php||javascript||...)
running in production (apache+(php||javascript||...))
. 我在生产
(apache+(php||javascript||...))
运行着简单的文件(php||javascript||...)
(apache+(php||javascript||...))
。
I am trying to think to the proper way of migrating a simple file while not stopping serving web clients . 我正在尝试考虑在不停止为Web客户端提供服务的情况下迁移简单文件的正确方法。
Possible influences are: 可能的影响是:
cp
a file with new content, apache can only see the full content final save results of my command ? cp
一个文件,apache只能看到命令的全部内容最终保存的结果? I imagine the following: 我想象以下情况:
require_once
file, named with versions (ex: ABusinessClassD-v1.0.php
), support backward compatibility, and simply do a cp
of new files one by one, going from bottom up (database, static files (img, ...), php files, javascript files, ...) require_once
文件)(例如: ABusinessClassD-v1.0.php
),支持向后兼容,并且只需从下至上逐个处理新文件的cp
(数据库,静态文件(img ,...),php文件,javascript文件,...) Imagination != as simple as this != Reality. 想象力==就这么简单!=现实。
Please, can somebody summarize globally simple manual steps to update a simple file in an apache production, without stopping serving web clients, in a manual intentionally slow process ?
请,有人可以在一个人工缓慢的过程中汇总全局简单的手动步骤来更新apache生产中的简单文件,而不停止为Web客户端提供服务吗?
The only sure way to guarantee no issues when moving over a PHP codebase would be to have two servers or two deployments on the same server. 确保在PHP代码库上移动时没有问题的唯一肯定方法是在同一服务器上具有两个服务器或两个部署。
You have Server 1 which contains your old code. 您有包含旧代码的服务器1。 Server 2 is set up with the new code.
服务器2设置了新代码。 Then, your DNS records or load balancer/proxy settings are changed so your site is instead served from Server 2.
然后,将更改您的DNS记录或负载平衡器/代理设置,以便从服务器2服务您的站点。
Or with one server, you configure Apache to serve your application from /path/to/old
, and then set up your new version in /path/to/new
. 或使用一台服务器,将Apache配置为从
/path/to/old
服务您的应用程序,然后在/path/to/new
设置新版本。 Then you change your Apache configuration to use /path/to/new
for the application and restart the server. 然后,您将Apache配置更改为对应用程序使用
/path/to/new
并重新启动服务器。
If you ever need to use version numbers in file names ( ABusinessClassD-v1.0.php
) then you need to learn about version control software like Git or Mercurial. 如果您需要在文件名中使用版本号(
ABusinessClassD-v1.0.php
),则需要了解有关Git或Mercurial之类的版本控制软件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.