我大部分时间都是一个孤独的开发人员,致力于许多大型的、主要基于 PHP 的项目。我希望专业化和自动化处理代码库更改的方式,并创建一个持续集成流程,使无需进行根本性更改即可过渡到团队工作。
我现在正在做的是,我为每个项目都有一个本地测试环境;我每个项目都使用SVN;更改在本地进行测试,然后通常通过 FTP 传输到在线版本。 API文档是从源代码手动生成的;单元测试是我正在慢慢进入的事情,它还不是我日常生活的一部分。
我设想的“构建周期”将执行以下操作:
-
本地测试后,变更集将被签入 SVN。
-
我开始构建过程。 SVN HEAD 修订版被签出,必要时进行修改,并准备好上传。
-
API 文档会自动生成 - 如果我还没有详细设置它,请使用默认模板,扫描整个代码库。
-
新版本通过 FTP 部署到远程位置(包括一些目录重命名、chmodding、导入数据库等。)这是我已经喜欢的phing 非常有用,但我当然愿意接受替代方案。
-
运行驻留在预定义位置的单元测试。我可以使用电子邮件、RSS 或(最好是)HTML 输出来了解他们的失败或成功,我可以抓取这些输出并将其放入网页中。
-
(可选)预定义位置中的最终用户“changelog”文本文件将使用提交消息的预定义部分进行更新(“现在可以过滤“foo”和“bar”此消息不一定与 SVN 提交消息相同,后者可能包含更多内部信息。
-
诸如代码指标、代码风格检查之类的东西现在不是我的主要关注点,但从长远来看,它们肯定会的。开箱即用的解决方案受到了非常好的欢迎。
我正在寻找
还有
我忙于工作,所以我非常倾向于简单的解决方案。另一方面,如果缺少某个功能,我会因为它太有限而哭泣。 :) 也欢迎点击式解决方案。我还推荐可以与 PHP 项目配合使用的商业产品。
我的设置
我在本地 Windows(确切地说是 7)上工作,大多数客户端项目都在 LAMP 堆栈上运行,通常在共享托管上(= 无远程 SSH)。
我正在寻找可以在自己的环境中运行的解决方案。我已经准备好为此设置一个 Linux VM,没问题。仅当托管解决方案提供所描述的所有方面,或者足够灵活以与流程的其他部分交互时,我才感兴趣。
赏金
我接受我认为会给我最大里程的答案。这里有很多优秀的意见,我希望我能接受多个答案。谢谢大家!
I am a lone developer most of my time, working on a number of big, mainly PHP-based projects. I want to professionalize and automate how changes to the code base are handled, and create a Continuous Integration process that makes the transition to work in a team possible without having to make fundamental changes.
What I am doing right now is, I have a local test environment for every project; I use SVN for each project; changes are tested locally, and then transferred to the on-line version, usually via FTP. API documentation is generated manually from the source code; Unit tests are something I am getting into slowly, and it's not yet part of my daily routine.
The "build cycle" I am envisioning would do the following:
-
A changeset gets checked into SVN after having been tested locally.
-
I start the build process. The SVN HEAD revision gets checked out, modified if necessary, and made ready for upload.
-
API Documentation gets generated automatically - if I haven't set it up in detail yet, using a default template, scanning the whole code base.
-
The new revision is deployed to the remote location via FTP (Including some directory renaming, chmodding, importing databases, and the likes.) This is something I already like phing for very much, but I'm open for alternatives of course.
-
Unit tests residing in a predefined location are run. I am informed about their failure or success using E-Mail, RSS or (preferably) HTML output that I can grab and put into a web page.
-
(optionally) a end-user "changelog" text file in a pre-defined location gets updated with a pre-defined part of the commit message ("It is now possible to filter for both "foo" and "bar" at the same time). This message is not necessarily identical with the SVN commit message, which probably contains much more internal information.
-
Stuff like code metrics, code style checking and so on are not my primary focus right now, but on the long run, they certainly will. Solutions that bring this out-of-the-box are very kindly looked upon.
I am looking for
-
Feedback and experiences from people who are or were in a similar situation, and have successfully implemented a solution for this
-
Especially, good step-by-step tutorials and walkthroughs on how to set this up
-
Solutions that provide as much automation as possible, for example by creating a skeleton API, test cases and so on for each new project.
and also
- Product recommendations. What I know so far is phing/ant for building, and phpUnderControl or Hudson for the reporting part. I like them all as far as I can see, but I have of course no detailed experience with them.
I am swamped with work, so I have a strong inclination towards simple solutions. On the other hand, if a feature is missing, I'll cry about it being too limited. :) Point-and-click solutions are welcome, too. I am also to commercial product recommendations that can work with PHP projects.
My setup
I am working on Windows locally (7, to be exact) and most client projects are run on a LAMP stack, often on shared hosting (= no remote SSH).
I am looking for solutions that I can run in my own environment. I am ready to set up a Linux VM for this, no problem. Hosted solutions are interesting for me only if they provide all of the aspects described, or are flexible enough to interact with the other parts of the process.
Bounty
I am accepting the answer that I feel will give me the most mileage. There is a lot of excellent input here, I wish I could accept more than one answer. Thanks everyone!
发布评论
评论(9)
我已经使用过 buildbot,CruiseControl.net、CruiseControl 和 哈德森。尽管我真的很喜欢 CruiseControl*,但对于非常复杂的依赖情况来说,这实在是太麻烦了。 buildbot 并不容易设置,但它有一个很好的光环(我只是喜欢 python,仅此而已)。但 Hudson 胜过前三个,因为:
。 警告:我只使用 Linux 作为上述构建服务器的基础(CC.net 在 mono),但根据文档,它们都应该跨平台运行。
设置 hudson 服务器
先决条件:
从这里开始,它只是:
这将在您的控制台上运行一个小型服务器实例,如果您事先没有在该端口上运行任何其他内容,那么您应该能够在
http://localhost:8080
上浏览安装(您可以通过传递上述命令的--httpPort=ANOTHER_HTTP_PORT
选项),“安装”过程中一切顺利。如果您转到可用插件目录 (
http://localhost:8080/pluginManager/available
),您将找到支持上述任务的插件(默认安装 subversion 支持)。如果这引起了您的兴趣,您应该安装一个 java 应用程序服务器,例如 tomcat 或 码头。 安装说明适用于所有主要应用程序服务器
更新 :Kohsuke Kawaguchi 构建了一个适用于 hudson 的 Windows 服务安装程序 在 hudson
中设置项目
以下演练中的链接假定 hudson 的运行实例位于
http://localhost: 8080
http://localhost:8080/view/All/newJob
)构建一个自由-样式软件项目
在列表中*/5 * * * *
构建要设置 hudson 没有插件的进程,您可以通过构建设置中的 shell 脚本直接调用它们,也可以 编写您自己的插件
陷阱:
祝您好运!
I've been through buildbot, CruiseControl.net, CruiseControl and Hudson. All though I really liked CruiseControl*, it was just too much of a hassle with really complex dependency cases. buildbot is not easy to set up, but it's got a nice aura (I just like python, that's all). But hudson won over the former three because:
Caveat: I only ever used linux as base for the above mentioned build servers (CC.net ran on mono), but they should all - according to the docs - run cross-platform.
Setting up a hudson server
Prerequisites:
From here, it's just:
This will run a small server instance right off your console, and you should be able to browse the installation at your
http://localhost:8080
, if you don't have anything else running on that port in advance (you can specify another port by passing the--httpPort=ANOTHER_HTTP_PORT
option to the above command) and everything went well in the 'installation' process.If you go to the available plugins directory (
http://localhost:8080/pluginManager/available
), you'll find plugins for supporting your above mentioned tasks (subversion support is installed per default).If that has whet you appetite, you should install a java application server, such as tomcat or jetty. Installation instructions are available for all major application servers
Update: Kohsuke Kawaguchi has constructed a windows service installer for hudson
Setting up a project in hudson
The links in the following walk-through assumes a running instance of hudson located at
http://localhost:8080
http://localhost:8080/view/All/newJob
) from the menu on the leftBuild a free-style software project
on the list*/5 * * * *
For setting up processes for which hudson have no plugins, you can either call them directly through a shell script from within the build setup, or you could write you own plugin
Pitfalls:
Good luck!
您正在寻找的术语是“持续集成”。
以下是使用 GIT + phpundercontrol 的示例:http:// maff.ailoo.net/2009/09/continuous-integration-phpundercontrol-git/
CruiseControl(这是一个 CI 服务器),可以使用托管 SVN/GIT 作为源。所以你甚至可以将它与 GitHub 或 Beanstalk 或其他东西一起使用。
然后你可以将其与以下类型的软件集成:
你也可以尝试这个托管 CI: http://www.php-ci.net/hosting/create-project
但请记住,如果您自己集成这些工具,则需要自定义支持。
您是否也考虑过项目管理和补丁管理?
您可以使用Redmine进行项目管理。它集成了持续集成支持,但仅作为客户端(而不是 CI 服务器)。
尝试使用托管的 SVN/GIT/等。解决方案,因为他们将覆盖您的备份并保持服务器运行,因此您可以专注于开发。
有关如何设置 Hudson 的教程,请参阅:http://toptopic .wordpress.com/2009/02/26/php-and-hudson/
The term you are looking for is "continous integration."
Here is an example of someone who uses GIT + phpundercontrol: http://maff.ailoo.net/2009/09/continuous-integration-phpundercontrol-git/
CruiseControl (which is a CI server), can use Hosted SVN/GIT as a source. So you can even use it with GitHub or Beanstalk or something else.
Then you can integrate that with the following kind of software:
You could also try this hosted CI: http://www.php-ci.net/hosting/create-project
Keep in mind though, that those tools need custom support if you integrate them yourself.
Have you also thought about project management and patch management?
You can use Redmine for project management. It has integrated continuous integration support, but only as client side (not as CI server).
Try using a hosted SVN/GIT/etc. solution, because they will cover your backups and keep their servers running, so you can focus on development.
For a tutorial on how to setup Hudson, see: http://toptopic.wordpress.com/2009/02/26/php-and-hudson/
我将 Atlassian 的 Bamboo 持续集成服务器用于我的主要 PHP 项目(以及他们的其他产品,例如fisheye(存储库浏览),jira(问题跟踪器)和 clover< /a>(代码覆盖率))。
它支持 SVN,现在支持 Git,并且拥有出色的用户界面。它适用于 Linux、Windows 和 Mac,并且可以在自己的 Tomcat 服务器上独立运行,这对于那些不喜欢花几天时间来设置工具的人(比如我)来说非常有用。尽管它看起来可能很贵,但作为一名孤独的开发人员,我以 10 美元的价格购买了入门套件许可证(软件 10 美元)。这对于小型团队来说非常有用,值得一看。
I use Atlassian's Bamboo continous integration server for my main PHP project (along with their other products such as fisheye (repository browsing), jira (issue tracker) and clover (code coverage)).
It supports SVN and now supports Git and it has a great user interface. It is available for linux, windows and mac and can run standalone on its own tomcat server which is great for people (like me) who does not like to take days to setup their tools). Although it may look expensive, being a lone developer myself I purchased the starter kit license for 10$ (10$ by software). This is great for small teams and it is worth the look.
PHPTesting PHPCI 这是一个很好的、用 php 构建的持续集成服务器。
另外,它是免费和开源的。 :)
它有很多插件..
PHPCI 包括以下集成插件:
PHPTesting PHPCI This is nice, continuous integration server built in php.
Plus, its free and open source. :)
it has number of plugins..
PHPCI includes integration plugins for:
我主要是一名系统管理员,但有时我也会编写 PHP 代码。作为一个业余项目,我创建了一些脚本,这些脚本将使使用 Jenkins 建立一个完整的 PHP CI 环境变得简单而轻松。它还为您运行一个示例项目,以便您可以了解每个构建步骤的配置方式。
如果您想尝试一下,您只需要一个 Debian/Ubuntu 盒子和 shell 访问权限。
http://yauh .de/articles/379/setting-up-a-ci-environment-for-php-projects-using-jenkins-ci
更新 要在我的答案中添加一些内容:
您可以只需使用 Ansible 设置适用于 PHP 的 Jenkins CI。从 v1.4 开始,它支持角色,您可以从 Galaxy.ansibleworks.com 社区站点下载这些角色,它将为您完成繁重的工作。它称为 jenkins-php。
I am mostly a sys admin but sometimes I code PHP as well. As a side project I created some scripts that will make it simple and painless to set up a full blown PHP CI environment using Jenkins. It also runs a sample project for you so you can see how each build step is configured.
If you want to try it out all you need is a Debian/Ubuntu box and shell access.
http://yauh.de/articles/379/setting-up-a-ci-environment-for-php-projects-using-jenkins-ci
Update To add some content to my answer:
You can simply set up a Jenkins CI for PHP using Ansible. Since v1.4 it supports roles which you can download from their galaxy.ansibleworks.com community site and it will do the heavy lifting for you. It is called jenkins-php.
我建议使用 Jenkins http://jenkins-ci.org/ 它是免费且开源的。
它的设置非常简单,可在多个平台上运行,并与其他持续集成工具(例如用于测量技术债务的 SonarQube(+ SQUALE)和用于测试自动化的修昔底德)良好集成。
我强烈建议使用 GIT 或 GIT Hub 来代替 SVN 进行版本控制。从我的角度来看,它只是一个更好的版本控制系统,可以帮助您以后扩展开发工作。
由于您主要使用 PHP 项目,因此您还可以使用一些其他工具。
PHPUnit - 用于单元测试
PHP CodeSniffer - 检查编码标准
PHP Depend - 显示您的 PHP 代码依赖性
XDEBUG - 用于性能测试
所有这些工具都由 Jenkins 作业触发,有助于提高代码的质量和性能。
祝你好运并享受!
I would suggest using Jenkins http://jenkins-ci.org/ it's free and it's open source.
It's pretty straight forward to setup, works on multiple platforms and integrates well with other continuous integration tools like SonarQube (+ SQUALE) to measure technical debt and Thucydides for testing automation.
I would highly suggest using GIT or GIT Hub for version control instead of SVN. From my point of view it's just a better version control system that will help you scale your development efforts later.
Since you're working mostly with PHP project there are some other tools you can use.
PHPUnit - For unit testing
PHP CodeSniffer - Check for coding standards
PHP Depend - Shows your PHP code dependencies
XDEBUG - For performance testing
All of these tools and be triggered with a Jenkins job and helps with the quality and performance of your code.
Good luck and Enjoy!
我不使用很多产品,甚至不使用您使用的产品类型,但我会给您我的经验。
我与生产环境并行运行测试环境。我本身没有本地测试。如果将某些东西放入真正的测试环境太困难,那么我会修复我的构建过程。我不认为在本地测试有什么意义,因为环境不同。更新:我在本地做的唯一一件事就是在上传任何内容之前运行“php -l”。停止愚蠢的错误。
构建过程适用于当前工作区中的任何内容,其中包括未提交的代码。这不是每个人都喜欢的,但我会经常进行测试。在进入 PROD 之前,一切都已提交。
我的构建过程的一部分(与您的类似)创建了两个 META 文件。其中一个包含最后(通常)100 个更改,还提供当前的更改列表编号。显示了安装了哪些更改。另一个包含 CLIENTSPEC(以 Perforce 术语来说),它准确地向我显示了此构建中使用了哪些分支。这些共同为我提供了可重复的构建。
我不会直接构建到目标环境,而是构建到服务器上的暂存区域。我使用 SSH,所以这是有道理的。这给了我一些优势。最重要的是,它可以避免在大上传时中途死亡。它还为我提供了存储 META 文件的位置,并且所有构建文件都会自动存档(因此我可以直接返回到任何构建)。该脚本还记录更新(因此日志流中有一个条目,我可以看到前和后)并踢出所有守护进程(我使用 daemontools 所以“svc -t”)。所有这些在目标机器上都会更好。
另一问题是数据库更改。我保留了数据库模式的主脚本,每次模式更改时都会更新该脚本。每个更改也会进入一个changes.sql脚本,该脚本与构建一起上传到暂存区域。该脚本作为安装脚本的一部分运行。
I do not use many of the products, or even types of products that you use, but I will give you my experience.
I run a TEST environment in parrallel with my PROD environment. I have no local testing per se. If it is too hard to get soemthing up into a real TEST environment, then I fix my build process. I don't see the point in testing locally, as the environments are different. UPDATE: The only thing I do locally is run "php -l" before I upload anything. Stops the stupid mistakes.
The build process works with whatever is in the current workspace, which includes uncommitted code. This is not everyone's cup of tea, but I am going to TEST very often. Everything gets committed before going to PROD.
Part of my build process (similar to yours) creates two META files. One contains the last (typically) 100 changes and also gives me the current changelist number. The shows me what changes are installed. The other contains the CLIENTSPEC (in Perforce terms) which shows me exactly what branches were used in this build. Together these give me reproducible builds.
I do not build straight to the target environment, but to a staging area on the server. I use SSH so this makes sense. This gives me a few advantages. Most importantly it avoids dying half way through a large upload. It also gives me a place to store META files, and all the build files are automatically archived (so I can go straight back to any build). The script also logs the update (so there is an entry in the log stream and I can see pre- and post-) and kicks all daemons (I use daemontools so "svc -t"). All of these are better off on the target machine.
One other issue is DB changes. I keep a master script of the DB schema, which I update every time the schema changes. Each of the changes also go into a changes.sql script, which is uploaded with the build to the staging area. The script is run as part of the install script.
我最近开始了同样的过程,并使用 Beanstalk 进行 svn 托管。
付费帐户有两个漂亮的功能(我认为从下午 15 美元开始):
我确信还有其他托管或自托管 svn 服务器具有这两个功能,但 beanstalk 是我有经验的一个,它工作得非常非常好
还有一个 API,我想它可以用于进一步集成部署进入你的流程。
I've recently begun the same kind of process, and am using Beanstalk for svn hosting.
There are two nifty features in the paid accounts (start at $15pm i think):
I'm sure there are other hosted or self-hosting svn servers with these two features, but beanstalk is the one i have experience of and it's working very, very well
There's also an API, which I imagine could be used to integrate deployment further in to your process.
请考虑 fazend.com,这是一个免费的托管 CI 平台,可自动执行配置和安装过程。您不需要设置版本控制、错误跟踪、CI 服务器、测试环境等。一切都是按需完成的。
Consider fazend.com, a free hosted CI platform, which automates configuration and installation procedures. You don't need to setup version control, bug tracking, CI server, test environment, etc. Everything is done on-demand.