php – 自动化WordPress的开发和部署
有没有人曾在不同地点与多位开发人员一起工作过WordPress项目?有关分布式开发团队和自动化部署的最佳实践?
我有不同程度的开发人员团队,包括插件开发人员,主题开发人员和简单的CSS风格的tweakers,在几个不同的位置,我想为每个人设置一个良好的系统,以便能够处理他们的单独的部分和持续部署更改,而不会打扰任何人的代码. 该系统目前正在运行WordPress-MU的安装,最终将升级到3.0.理想情况下,我们会将主题和插件存储在源代码控制中,并且由于对WordPress核心代码进行了一些修改,因此还必须进入存储库.我无法找出构建存储库的最佳方法,并进行受控但有些自动化的部署. 当不同类型的插件和主题可能在文件系统或数据库中存储配置时,如何处理开发,测试,分期和生产环境中的工作和部署?我意识到答案可能是“不要使用WordPress”,但假设我必须让我知道你的想法, 谢谢你的帮助, 戴夫
以下是我到目前为止解决这个问题的方法:
源代码目录: build/ - build files for phing and environment-specific properties files build.xml src_qa.properties - properties to use the qa server as the source for a deployment dst_qa.properties - properties to use the qa server as the destination for a deployment etc... for other environments conf/ - contains environment specific configuration files,each in a subfolder named after the environment dev/ db-config.php - config file for HyperDB - http://codex.wordpress.org/HyperDB default - Apache conf that holds ServerAlias configs for multi-site WordPress hosts - useful for developers to redirect their browser to various domains in different environments htaccess.dist - for WPMU httpd.conf - main Apache config file,specific to each environment my.cnf - mysql config file wp-config.php - main wordpress config file qa (same as dev/ but with different values in each file) staging (same as dev/ but with different values in each file) prod (same as dev/ but with different values in each file) src/ - wordpress source code wp-admin/ wp-content/ mu-plugins/ plugins/ themes/ wp-includes/ test/ - holds WP test suite and custom tests for plugins,themes,etc... 我使用Hudson CI服务器(http://hudson-ci.org/)使用subversion checkout任务,phing和phpunit等进行自动化和手动构建…基本上,Hudson服务器根据您要部署的内容从subversion提取代码,而rsync的要从CI服务器部署到目标服务器的文件. 或者,在从直接部署到生产的情况下,Hudson rsync的文件从升级到CI服务器,然后备份到生产中. 我已经在hudson中建立了工作设置,以获得以下功能: core WP code - deploys core WP files and mu-plugins from src to dst svn to qa svn to staging staging to prod WP plugins/ folder - deploys only the plugins folder svn to qa svn to staging staging to prod WP themes/ folder - deploys the entire themes folder svn to qa svn to staging svn to prod Specific themes - deploys a specific theme (chosen through a drop down during the build process using Hudson's parameterized build feature - http://wiki.hudson-ci.org/display/HUDSON/Parameterized+Build) svn to qa svn to staging svn to prod hudson作业还可以将环境特定的PHP文件(例如wp-config.php,db-config.php)以及Apache和MySQL配置文件部署到每个服务器上的正确位置.在某些情况下,我们部署到多个Web服务器和多个数据库服务器,大部分构建配置都是通过phing构建文件和上述的.properties文件来处理的. 将来,当我们有一个开发集成环境时,我们可能会在任何代码的svn checkin上自动部署. 此设置允许组织中的不同开发人员使用不同的技能(主要是CSS / HTML与PHP)来分开工作,并将代码更改到正确的环境,而不会涉及一大堆不必要的人员.哈德森允许我锁定不同的部署作业,所以只有合适的人才能够配置它们并将其踢掉. 这是对我所设置的一个高级概述,让我知道你的想法.此设置中最大的烦恼是在所有不同的服务器上使用rsync的keypairs,用户帐户和文件权限. 戴夫 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |