SVN网站开发部署解决方案
情况是这样的:我们有多个具有不同程度命令行经验的开发人员,我们正在为我们的网站整合部署解决方案.生产环境是2台SUSE Linux box.开发环境也是 SUSE Linux box.每个开发人员在他们的主目录中都有/将有一个 SVN 树的副本,用于开发和测试.
Here is the situation: we have multiple developers with varying degrees of commandline experience and we are putting together a deployment solution for our websites. The production environment is 2 SUSE Linux boxes. The development environment is a SUSE Linux box as well. Each developer has/will have a copy of the SVN tree in their home directory for development and testing.
目标是拥有一个易于使用且易于恢复的发布系统,可与多个生产服务器配合使用.如果非网络开发人员(仍然是不在网络世界中的编码员)也可以轻松恢复任何网站,那将是一个奖励.在理想情况下,发布就像在要发布的网站上运行单个命令一样简单.此命令将更新生产服务器并在其唤醒后留下恢复路径.
The goal is to have a release system that is easy to use and easy to revert that will work with multiple production servers. It would be a bonus if a non-web developer (still a coder just not in the web world) could easily revert any of the websites as well. In an optimal world, release would be as simple as running a single command on the website that you want to release. This command would update the production servers and leave a revert path in it's wake.
我们目前的部署解决方案有点笨拙,很难恢复,而且慢得像泥巴.我们目前使用 SVN 检入所有文件.然后运行一个脚本,该脚本基本上在 SVN 中创建一个标签.然后运行第二个脚本,该脚本进入 2 个生产服务器中的每一个,并运行svn up".
Our current deployment solution is a bit clunky, quite difficult to revert and slow as dirt. We currently check in all files using SVN. Then a script is run that essentially creates a tag in SVN. A second script is then run that goes onto each of the 2 production servers and runs an 'svn up'.
有什么建议吗?
推荐答案
Capistrano 是一个很好的解决方案.尽管最初是为 Ruby on Rails 平台开发的,但我已经在许多 PHP 项目中成功地使用了它.它自动执行通过 SSH 执行的操作.部署是原子的,因为每个部署都被检出到一个新目录.
Capistrano is a great solution. Although originally developed for the Ruby on Rails platform, I've used it successfully on a number of PHP projects. It automates actions performed via SSH. Deployments are atomic because each deployment is checked out to a new directory.
当前副本是通过使用符号链接打开的.最新版本的源代码来自 Subversion.您还可以设置静态配置文件以在生产环境中使用.
The current copy is switched on by use of a symbolic link. The latest version of the source is pulled from Subversion. You can also set up static configuration files to use in the production environment.
Capistrano 还支持回滚,但如果您在部署之间进行数据库更改,则必须小心.考虑使用类似 dbdeploy 或 rails migrations 来解决这个问题.
Capistrano also supports rollbacks, although you have to be careful here if you are making database changes between deployments. Consider using something like dbdeploy or rails migrations to solve this problem.
相关文章