如何做php应用的部署 [英] How to do deployment for php application

查看:135
本文介绍了如何做php应用的部署的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个慈善组织的php应用程序,我现在正处于定义部署实践的阶段。



我们的应用程序正在使用Zend Framework和教义。该应用程序将被推出到不同的服务器,每个服务器具有不同的配置文件。这些机器都是Windows和Linux(但是所有的都是Apache和php 5.2 +)。



源代码在Subversion版本库中可用,我们要构建和存储我们的包在Linux服务器上。



最好我们希望更新过程与在应用程序目录中运行update命令一样简单,其中up​​date命令还会更新数据库(with原则脚本)并确保框架的依赖性。此更新命令必须是机器上的命令(我们不能将ssh插入到其中)。最好我们可以选择下载一个新版本,或者提供一个已经下载的tarball和一个新版本。 (但只有下载或只有tarball也可以)



安装和更新的软件包(新版本)也优选由单个命令构建。



我一直在读一点关于phar,梨,phing,但我不知道最好的方法是这样做。连续集成服务器并不是必需的,但我想到在构建版本后自动部署测试环境。



最初只需更新php应用程序就很容易,最初填写一个配置文件可以手动完成。

解决方案

我将首先将各种服务器的应用程序根目录作为SVN工作副本。您可以添加mod_rewrite(或IIRF ASAPI过滤器为IIS)规则,以确保人们无法直接解决您的.svn目录。



然后,更新到最新的源可以就像SVN更新一样简单。对于您的数据库更新需求,我将在SVN中维护数据库修改脚本。您可能需要在批处理/ shell脚本中包装SVN更新,以便在脚本下载后执行数据库更新。



对于现场的变更管理服务器,我也有他们的工作副本不是中继,而是一个发布分支。当您准备发布时,您可以将中继合并到发行版分支中。这将允许您测试部署,并确保它在实时服务器上执行前是稳固的。它也有一个很好的副作用,给你一个很好的副本的网站发布版本,以防您需要跟踪发布后的问题。



最后,依赖关于这些更新的强度和时间,您可能还想让您的更新脚本翻转维护开关,以便用户暂时遇到正确的消息,而不是损坏的站点。


I am currently developing a php-application for a charity organization and I am now in the stage of defining the deployment practices.

Our application is using both Zend Framework and Doctrine. The application will be rolled out to different servers, each with a different configuration file. The machines are both Windows and Linux (but all with Apache and php 5.2+).

The source is available in a subversion repository and we want to build and store our packages on a Linux server.

Preferably we want the update process to be as easy as running an update command in the application directory, where the update command also updates the database (with the doctrine scripts) and ensures dependencies of the frameworks. This update command must be a command on the machine (we can't ssh into them). Preferably we have the option of downloading a new version or providing an already downloaded tarball with a new version. (but only downloading or only tarball is also ok)

The packages with installations and updates (new versions) are also preferably build by a single command.

I have been reading a bit about phar's, pear, phing but I have no clue what the best way to do this is. A continuous integration server is not really necessary, but I think about deploying test environments automatically after building a version.

Initially only the updating of the php app has to be very easy, filling initially a configuration file when installing can be done by hand.

解决方案

I'd start by making the application root of the various servers an SVN working copy. You can add in mod_rewrite (or IIRF ASAPI filters for IIS) rules to ensure people can't address your .svn directories directly.

Then, updating to the latest source can be as simple as an SVN update. For your database update needs, I'd maintain the database modification scripts also in SVN. You'll likely need to wrap the SVN update in a batch/shell script in order to perform the database updates after the scripts are downloaded.

For change management on the live servers, I'd also have their working copies not of trunk, but a release branch. You can merge trunk into the release branch when you are ready for a release. This will allow you to test the deploy and make sure it's solid before performing it on the live servers. It also has the nice side-effect of giving you a nice replica of the site-release versions in case you need to track down issues post-launch.

Lastly, depending on the intensity and timing of these updates, you may also want to have your update script flip an "under maintenance" switch so that users are temporarily met with a proper message rather than a broken site.

这篇关于如何做php应用的部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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