PHP站点部署建议 [英] PHP Site Deployment Suggestion

查看:35
本文介绍了PHP站点部署建议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前对我的团队采用的部署方式感到非常困扰......它非常老式,我知道它不能很好地工作.但我不知道如何改变它,所以请给一些建议......

这是我们当前的设置:

  • 2 个网络服务器
  • 1 个数据库服务器
  • 1 个测试服务器

当前部署适配

  1. 我们在测试服务器上开发和工作,每个更改都手动上传到测试服务器.
  2. 当更改或功能完成后,我们会将更改提交到 SVN 存储库.
  3. 提交更改后,我们将更改上传到第一个网络服务器,那里将每分钟运行一次 cronjob 以在服务器之间同步文件.

很烦人的是,每当我们在同步作业开始时上传文件时,同步的文件就会出现损坏,因为它只上传了一半.另一件事是,每当出现部署错误时,恢复将极其困难.这些基本上就是我面临的问题,我该怎么办?

此外,由于第一个网络服务器上的文件需要随时同步到其他服务器,因此需要 cronjob.

P/S:对不起,我忘了提,SVN 服务器是托管的.我们对它没有太多控制权,但我相信我可以编辑钩子...

解决方案

使用像 Phing 这样的部署框架来管理部署到网络服务器并摆脱 cron 作业.基本上,生产系统上的发布不应该自动发生,但只有在您确定当前构建没有被破坏之后.并且它不应该依赖于开发系统.

由于 Phing 使用 XML 和 PHP 来配置和控制部署过程,因此您可以对过程进行版本控制.这是一个额外的好处,因为您可以将部署连接到应用程序的特定构建.

为了防止生产网站受到部署过程的影响,请考虑将新版本上传到单独的目录中,然后只需符号链接即可.如果出现任何问题,您可以轻松符号链接到以前的版本.

还可以考虑使用 CI 服务器.>

I'm currently quite troubled by the way of deployment my team is adopting... It's very old-fashioned and I know it doesn't work very well. But I don't exactly know how to change it, so please give some suggestions about it...

Here is our current setup:

  • 2 webservers
  • 1 database server
  • 1 test server

Current deployment adaptation

  1. We develop and work on the test server, every changes is uploaded manually to the test server.
  2. When a change or feature is complete, we then commit the changes to SVN repository.
  3. After committing the changes, we then upload our changes to the first webserver, where there will be a cronjob running every minute to sync the files between the servers.

Something very annoying is, whenever we upload a file just as the syncing job starts, the file that is sync-ed will appear corrupted, since it is only half-uploaded. Another thing is whenever there is a deployment fault, it will be extremely difficult to revert. These are basically the problem I'm facing, what should I do?

In addition, since there are files on the 1st webserver which needs to be sync-ed to the other servers anytime, so the cronjob was there for the reason.

P/S: I'm sorry I forgot to mention that, the SVN server is hosted. We don't have too much control over it, but I believe I can edit hooks...

解决方案

Use a deployment framework like Phing to manage deployment to the webservers and get rid of the cron job. Basically, a release on the production system should not happen automatically, but only after you are certain the current build is not broken. And it should not have a dependency on the dev system.

Since Phing uses XML and PHP to configure and control the deployment process, you can version control the process. This is an added benefit, as you can then keep the deployment connected to specific builds of your application.

To prevent the production website from being affected by the deployment process, consider uploading a new build into a separate directory and then just symlink to it. If anything goes wrong, you can easily symlink to a previous version.

Also consider using a CI server.

这篇关于PHP站点部署建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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