使用 Ant 或类似工具进行自动化部署

发布于 2024-10-13 21:38:56 字数 384 浏览 6 评论 0原文

我想梳理一下我们的部署过程,我希望使用Ant或类似的构建工具来设计和实现特定SVN修订版到多个服务器的一键部署。

我们使用 ColdFusion 作为我们的应用程序服务器,因此我们通常只是将一组更改的文件上传到我们的所有服务器。没有编译步骤。

该过程如下:

  • 从 SVN 获取特定修订版并将其导出到临时目录 将
  • 目录中的所有文件复制/FTP 到一组 Web 服务器
  • 根据测试/登台/生产等的需要切换部署目标
  • 。将来我们想在此过程中添加数据库模式更改

是否可以使用 Ant 来完成此操作,或者是否有更好的开源工具来完成这项工作?我对 SVN 集成特别感兴趣。

我很想听听这方面的任何经验。提前致谢。

I want to sort out out our deployment process and I was hoping to use Ant or a similar build tool to design and implement a one-click deployment of a specific SVN revision to multiple servers.

We use ColdFusion as our application server so we usually just upload a set of changed files to all our servers. There is no compile step.

The process would be as follows:

  • Get a particular revision from SVN and export it to a temp dir
  • Copy/FTP all the files in the directory to a set of web servers
  • Switch the deployment destination as required for test / staging / production etc.
  • In future we'd like to add database schema changes to this process

Is it possible to do this using Ant or are there better open source tools for the job? I'm interested in SVN intergration in particular.

I'd love to hear any experiences in this area. Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

你的他你的她 2024-10-20 21:38:56

是的,这方面有很多来源:

http://subversion.open.collab.net /articles/IntegratingSubversionIntoYourAntBuild.html

http://ant.apache.org/manual /Tasks/ftp.htmlhttp://www.developer.com/ java/print.php/998241

另外,我不确定 Cold Fusion 世界中的等效项是什么,但您应该研究单元测试和 linting 工具。 linting 工具可以检查无效的语法和基本结构。无效的语法部分是关键......因为如果出现问题,您可以停止任务,而不是部署已知损坏的代码。

只需设置各个目标(任务)并按正确的顺序将它们串在一起即可。

Yes, there are numerous sources on this one:

http://subversion.open.collab.net/articles/IntegratingSubversionIntoYourAntBuild.html

http://ant.apache.org/manual/Tasks/ftp.html or http://www.developer.com/java/print.php/998241

Also, I'm not sure what the equivalent is in the Cold Fusion world, but you should look into Unit Testing and a linting tool. A linting tool can check for invalid syntax and basic structures. The invalid syntax part is key.. because you can have the task stop if there's a problem as opposed to deploying known-broken code.

It's just a matter of setting up the individual targets (tasks) and stringing them together in the right order.

给不了的爱 2024-10-20 21:38:56

如果您准备好学习一点,我建议您切换到 Maven 和朋友。 Maven 基本上使得整个开发、测试、部署和管理变得非常简单和可靠。

有一些插件可以在整个过程中为您提供帮助。 SVN 与 Maven 集成,因此您不会遇到任何问题。

以下是简短列表

  1. 使用 Maven SCM 插件 签出/导出代码。
  2. Maven 将为您执行特定的构建并打包代码。
  3. 使用Maven Cargo插件将打包的artifact/Jar/War上传到您的服务器。您也可以重新启动服务器。
  4. 你在 Maven 中有 build-profiles ,你可以定义构建和基于平台(Unix、Mac、Windows...)和环境(开发、测试、生产等)的部署行为。
  5. 在发布时,您可能希望将代码版本提升到下一个快照版本。这在 Maven 中也是自动化的。
  6. Maven 与 Liquibase 的集成非常棒。它使您的数据库更改执行得如此可靠,以至于您会发现差异。您将像管理 Java 代码一样管理数据库更改。在生产环境中工作时,小的可回滚的变更集给了我们很大的信心。

If you are ready for a bit of learning, I would suggest you to switch to Maven and friends. Maven is basically makes the whole develop, test, deploy and manage very simple and reliable.

There are plugins that are going to help you in the whole process. SVN is intergrated with Maven so, you would not have any issues.

Here is short list

  1. Use Maven SCM plugin to checkout/export the code.
  2. Maven will perform specific build for you and package the code.
  3. Use Maven Cargo plugin to upload the packaged artifact/Jar/War to your server. You can restart the server as well.
  4. You have build-profiles in Maven, you can define build and deployment behaviors based on platform (Unix, Mac, Windows,...) and environments (dev, test, prod, etc).
  5. On release, you may want to bump-up the code version to next SNAPSHOT release. This is also automated in Maven.
  6. Maven's integration with Liquibase is just awesome. It makes your database changes to execute so reliably that you will find a difference. You will be managing DB changes same as your Java code. In small rollbackable pieces of change-sets gives a lot of confidence while working on production environment.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文