如何从Subversion版本库开始部署PHP应用程序? [英] How to get started deploying PHP applications from a subversion repository?

查看:141
本文介绍了如何从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版本库中)。我如何去部署我的应用程序?如果我有一个不想覆盖的uploads目录,该怎么办?

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,您可能需要查看 Xinc phpUnderControl

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,守护程序)

  • 运行 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

  • 开始服务

  • ssh to production server. The rest of the commands are run at the production server, through ssh.
  • run svn export svn://path/to/repository/tags/RELEASE_VERSION /usr/local/application/releases/TIMESTAMP
  • stop services (Apache, daemons)
  • run unlink /usr/local/application/current && ln -s /usr/local/application/releases/TIMESTAMP /usr/local/application/current
  • run ln -s /usr/local/application/var /usr/local/application/releases/TIMESTAMP/var
  • run /usr/local/application/current/scripts/migrate.php
  • start services

/ usr / local / application / current )

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

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

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