开发者

Deploy to multiple instances

开发者 https://www.devze.com 2023-01-10 07:40 出处:网络
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.

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.

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 wo开发者_如何学Gorkflow (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.

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 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?

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

phing stage

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 deploy

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

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.

should be straightforward.

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.

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.

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


http://vimeo.com/13441373 Is a talk about Phing which may be a useful tool for you ... automated running of tasks defined in PHP. Haven't used it myself but the guy giving this talk knows his stuff.

0

精彩评论

暂无评论...
验证码 换一张
取 消