部署到多个实例 [英] Deploy to multiple instances

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

问题描述

我一直在看几个系统(Phing,ControlTier),并且也阅读了这个网站上的所有相关问题,但是我不知道我找到了我的要求的最佳解决方案。

I have been looking at a couple of systems (Phing, ControlTier) and have also read all relevant questions on this site however I'm not sure I have found the best solution for my requirements.

我有一个PHP网站,本质上是一个价格比较购物网站的代码库。然后将其部署到许多不同的服务器,根据销售的产品,每个服务器都有自己的主题和数据库。当对代码库进行更改或修复时,这需要通过典型的工作流程(备份,部署,测试,回滚/提交)推送到每个服务器。理想情况下,我想使用现有的东西来实现这个滚动,但是可以看看该选项。

I have a PHP website which is essentially a codebase for a price comparison shopping site. This is then deployed to many different servers, each of which has their own theme and database according to the products sold. When changes or bugfixes are made to the code base, this then needs pushing out to each server, with a typical workflow (backup, deploy, test, rollback / commit). Ideally I'd like to use something existing to achieve this rathe rthan rolling my own however may look at that option.

系统的未来版本可能支持运行多个站点从一个单一的代码库,目前是不可能的,部分原因是我继承了大量的代码,而且我的SEO团队向我保证,拥有多个服务器和IP是一件好事。

A future version of the system may support running multiple sites from a single codebase however that is currently not possible, partly as I have inherited a lot of the code, and also as my SEO team assure me that having multiple servers and IPs is a good thing.

对于这种类型的部署的最佳设置的任何建议都是非常感激的。

Any advice as to the best setup for this type of deployment is much appreciated.

推荐答案

Phing可以做很多东西给你几行(配置)代码。我接受你已经有一个实现,处理你的代码库的不同实例的标签?

Phing can do alot of things for you in few lines of (configuration) code. I take it you allready have an implementation in place that deals with the "themabelity" of the different instances of your codebase?

你可以使用phing来实现3个简单的命令,每个人自动执行涉及部署的手动工作。

You yould use phing to implement 3 simple commands, each automating the manual work involved with deploying.

phing stage

当svn提交发生时,从SVN获取,使用svn钩子(只有当一个新标签被创建为/myrepos/tags/2/2.1.7时才可以这样做),以便它可以成为简单的连续集成的一部分。所以svn up可以发生在一个分段服务器,您可以在您的即时运送代码(phpunit,frontend,manual ..)上运行最终测试。

It will fetch from SVN when a svn commit happens, using svn hooks (lets say only when a new tag gets created as "/myrepos/tags/2/2.1.7") so that it could be part of a simple continuous integration. So the svn up COULD happen at a staging server where you run final tests on your ready-to-ship code (phpunit, frontend, manual ..).

phing部署

当您对结果满意时出现问题。
在所有服务器上备份您的数据,然后在上述步骤中复制已签出并进行测试的代码。 SCP-task在phing中可用,但是您需要php ssh2扩展名(PECL模块)

Issue when you are content with the results. Backups your data on all servers, then copies over the code that has been checked out and tested in the step above. SCP-tasks are available in phing but you need the php ssh2 extension (PECL module)

phing roll back

如果一切正常,您可以停止,但如果您必须收回部署的更改(全部),则可以实施从备份中复制的phing rollback。

If everything is right you can stop, but if you have to take back your deployed changes (all) you could implement a "phing rollback" which copies over from the backup.

应该是直接的。

如果您喜欢
Server1,您可以迭代服务器并填充或映射不同的变量 - >themeblue
Server2 - >themered
并仅复制您需要启用正确样式的主题目录或配置文件。

You can iterate over your servers and have different variables filled or mapped if you like "Server1" -> "themeblue" "Server2" -> "themered" and copy over only the theme directories or config files that you need to enable the right style.

知道Ant的人也可以使用phing,但是phing的优势在于它很容易部署。它的可扩展性也是一个真正的加分。你知道php吗您可以编写一个新的操作或过滤器,您可以在将来的部署中重复使用。

People that know Ant can work with phing too but phing has the advantage that it is very easy to deploy. Its extensability is a real plus too. You know php? You can write a new action or a filter that you can reuse in future deployment scenarious.

如果我是你,我会给予一个放假。

I would give phing a go if I were you.

哦,随时加入freenode的#phing。它相当空,但我们可以改变;)

Oh and feel free to join #phing on freenode. Its quite empty but we can change that ;)

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

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