简体   繁体   English

如何在不受时间限制的情况下在生产中迁移单个(php || javascript ||…)文件

[英]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: 可能的影响是:

  • Apache cached files: I do not know how apache deal with files (php, img, ...). Apache缓存的文件:我不知道apache如何处理文件(php,img,...)。 Does it cache them, and check for update timestamp to reload, or does it reload on each http request ? 它是否缓存它们,并检查要重新加载的更新时间戳,还是在每个http请求上重新加载?
  • Linux files are changed in an atomic manner: If I cp a file with new content, apache can only see the full content final save results of my command ? Linux文件是以原子方式更改的:如果我用新内容cp一个文件,apache只能看到命令的全部内容最终保存的结果?
  • Apache execution process: Can I pause Apache, holding current requests, while copying new file versions. Apache执行过程:复制新文件版本时,我是否可以暂停Apache,保留当前请求。

I imagine the following: 想象以下情况:

  • Have files, like php 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, ...) 具有以版本命名的文件(例如php require_once文件)(例如: ABusinessClassD-v1.0.php ),支持向后兼容,并且只需从下至上逐个处理新文件的cp (数据库,静态文件(img ,...),php文件,javascript文件,...)
  • Force refresh browser code on demand. 根据需要强制刷新浏览器代码。

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.

相关问题 如何将javascript从多文件示例迁移到简单的单页中? - How to migrate javascript from a multi-file example, in to a simple, single page? 如何在没有jQuery的情况下在JavaScript中执行php文件 - How to execute php file in javascript WITHOUT jQuery 如何创建单个JavaScript正则表达式以匹配长度和多个约束? - How to create a single JavaScript regex to match both length and multiple constraints? 如何在Wordpress文件“ single.php”中添加自定义javascript代码 - How to add custom javascript code in the Wordpress file “single.php” 如何使用SailsJS和MongoDB在生产模式下迁移模型 - How to migrate models in production mode with SailsJS and MongoDB 如何在不使用FormData的情况下以JavaScript和PHP上传文件 - How can I upload file in JavaScript and PHP without using FormData 如何在没有window.open的情况下从Javascript启动PHP文件 - How to launch PHP file from Javascript without window.open 如何在不重新加载页面的情况下获取PHP文件中的javascript数据 - How to GET javascript data in PHP file without page reload 文件名中的单引号 - javascript,php - single quote in file name - javascript,php 如何在不使用document.write的情况下将多个js文件加载到单个javascript文件中? - How to load the multiple js files in single javascript file, without using document.write?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM