本文介绍了如何开始从 subversion 存储库部署 PHP 应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我听说过部署应用程序"这句话,听起来比将单个更改的文件上传到服务器要好/容易/可靠得多,但我不知道从哪里开始.

I've heard the phrase "deploying applications" which sounds much better/easier/more reliable than uploading individual changed files to a server, but I don't know where to begin.

我有一个受版本控制的 Zend Framework 应用程序(在 Subversion 存储库中).我该如何部署"我的应用程序?如果我有一个不想覆盖的上传"目录,我该怎么办?

I have a Zend Framework application that is under version control (in a Subversion repository). How do I go about "deploying" my application? What should I do if I have an "uploads" directory that I don't want to overwrite?

我通过第三方托管我的应用程序,所以除了 FTP 之外我一无所知.如果其中任何一项涉及登录我的服务器,请解释该过程.

I host my application through a third party, so I don't know much other than FTP. If any of this involves logging into my server, please explain the process.

推荐答案

自动部署 + 运行测试到临时服务器被称为持续集成.这个想法是,如果您签入破坏测试的内容,您会立即收到通知.对于 PHP,您可能需要查看 XincphpUnderControl

Automatic deploy + run of tests to a staging server is known as continuous integration. The idea is that if you check in something that breaks the tests, you would get notified right away. For PHP, you might want to look into Xinc or phpUnderControl

您通常想要自动部署到生产环境.正常的做法是编写一些脚本来自动执行任务,但您仍然需要手动启动.您可以为此使用诸如 Phing 之类的框架或其他构建工具(一种流行的选择是 Capistrano),但您也可以将几个 shell 脚本混合在一起.我个人更喜欢后者.

You'd generally not want to automatically deploy to production though. The normal thing to do is to write some scripts that automates the task, but that you still need to manually initiate. You can use frameworks such as Phing or other build-tools for this (A popular choice is Capistrano), but you can also just whisk a few shell-scripts together. Personally I prefer the latter.

脚本本身可以做不同的事情,这取决于您的应用程序和设置,但一个典型的过程是:

The scripts themselves could do different things, depending on your application and setup, but a typical process would be:

  • ssh 到生产服务器.其余命令通过 ssh 在生产服务器上运行.
  • 运行 svn export svn://path/to/repository/tags/RELEASE_VERSION/usr/local/application/releases/TIMESTAMP
  • 停止服务(Apache、守护进程)
  • run unlink/usr/local/application/current &&ln -s/usr/local/application/releases/TIMESTAMP/usr/local/application/current
  • 运行 ln -s/usr/local/application/var/usr/local/application/releases/TIMESTAMP/var
  • 运行/usr/local/application/current/scripts/migrate.php
  • 启动服务

(假设您的应用程序位于 /usr/local/application/current)

(Assuming you have your application in /usr/local/application/current)

这篇关于如何开始从 subversion 存储库部署 PHP 应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 02:03