多个 Java Web 应用程序的自动化部署解决方案

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1462334/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 12:32:02  来源:igfitidea点击:

Automated Deployment solution for multiple Java web-apps

javadeploymentweb-applicationsconfigurationmaven-2

提问by Pablojim

I'm looking for solutions, preferably open source, that can manage deployments of multiple interdependent java web-applications.

我正在寻找解决方案,最好是开源的,可以管理多个相互依赖的 java web 应用程序的部署。

The solution requires an ability to create and store a release specification containing multiple items for release - specific versions of each application and relevant other artifacts (database config, apache config etc.).

该解决方案需要能够创建和存储包含多个发布项目的发布规范——每个应用程序的特定版本和相关的其他工件(数据库配置、apache 配置等)。

The specification then needs to be parsed and each item then need to be deployed/executed on a target environment. Target environment is linux based. Web-apps are vanilla wars running on a j2ee standard app server.

然后需要解析规范,然后需要在目标环境上部署/执行每个项目。目标环境是基于 linux 的。Web 应用程序是在 j2ee 标准应用程序服务器上运行的普通战争。

A lot to ask?

要问很多吗?

Currently I think all the bits are in place - the binary artifacts are released with the maven release pluginand hence available from our maven repofor deployment, the databaseis versioned with dbdeployand the apache configis versioned in svn. However I don't know of any tool that can put all these steps together on multiple applications.

目前我认为所有的位都已经到位 - 二进制工件是通过maven 发布插件发布的,因此可以从我们的maven repo进行部署,数据库使用dbdeploy 进行版本控制,而apache 配置svn 中进行版本控制。但是,我不知道有任何工具可以将所有这些步骤放在多个应用程序上。

My current preferred approach is to use a form of a parameterised build for hudson to create the specification. Then a second parameterised build to select a pre-created specification and deploy/execute it on a chosen environment.

我目前的首选方法是使用参数化构建的形式为 hudson 创建规范。然后第二个参数化构建选择预先创建的规范并在选定的环境中部署/执行它。

However this seems to be a lot of work and a less than optimal custom solution.

然而,这似乎需要大量工作,而且不是最佳的定制解决方案。

Anyone know any prebuilt better ideas? or suggestions for for how to approach this - maybe a workflow engine would be better than hudson? maybe a custom web app?

任何人都知道任何预先构建的更好的想法?或有关如何处理此问题的建议 - 也许工作流引擎会比 hudson 更好?也许是一个自定义的网络应用程序?

Notes:

笔记:

The target environments are prebuilt with all requirements in place - e.g. java and app server installed, database running etc. This is less of an environment configuration question and more of a deployment question.

目标环境是根据所有要求预先构建的 - 例如安装了 Java 和应用程序服务器、运行数据库等。这不是一个环境配置问题,而是一个部署问题。

Automating deployment of single apps is a problem with many solutions e.g. cargo, ant deployment scripts etc. However I need something that can wrap multiple deployments. E.g. kick off cargo on specific versions of multiple apps and their requirements.

自动化部署单个应用程序是许多解决方案的问题,例如货物、蚂蚁部署脚本等。但是我需要一些可以包装多个部署的东西。例如,在多个应用程序的特定版本及其要求上启动货物。

采纳答案by Jim Barrows

Sounds like you need a chefto cook your configuration :)

听起来你需要一个厨师来烹饪你的配置:)

回答by Rich Seller

Deployment is a complicated business. Maven has many of the plugins you could need to manage a deployment, but it takes some configuration to get it to do exactly what you want. The following describes how each of your issues could be addressed. Though depending on your environment, it might be more trouble than it's worth.

部署是一项复杂的业务。Maven 有许多管理部署可能需要的插件,但需要一些配置才能让它完全按照你的意愿去做。下面描述了如何解决您的每个问题。虽然取决于您的环境,但它可能比它的价值更麻烦。

The maven Cargo plugincan be used to deploy the applications. Obviously this can be quite involved but Cargo is a pretty good tool for managing deployments.

Maven的货物插件可用于部署应用程序。显然这可能相当复杂,但 Cargo 是一个非常好的管理部署的工具。

The apache config could be packaged as a separate jar by your build process and deployed to the repository, then downloaded/published for use in your deployment jar (the dependency plugincan be used to pull the config jar from the repository). Alternatively Maven has an scm api that can be used to invoke arbitrary commands against your SCM repository (see this answerfor an example plugin using the SCM API.

apache 配置可以由您的构建过程打包为一个单独的 jar 并部署到存储库,然后下载/发布以在您的部署 jar 中使用(依赖插件可用于从存储库中提取配置 jar)。或者,Maven 有一个 scm api,可用于针对您的 SCM 存储库调用任意命令(有关使用 SCM API 的示例插件,请参阅此答案

As far as I know there isn't a Maven plugin for dbdeploy, but this blog postshows how the maven-antrun-plugincan be used to script the deployment.

据我所知,dbdeploy 没有 Maven 插件,但是这篇博文展示了如何使用maven-antrun-plugin来编写部署脚本。

回答by Pascal Thivent

Check out ControlTier, an open source deployment tool based on a Configuration Management Database (CMDB) repository that aims to be a complete, enterprise-ready system for automating the deployment and management of multi-tier and distributed application services. According to its website:

查看ControlTier,这是一种基于配置管理数据库 (CMDB) 存储库的开源部署工具,旨在成为一个完整的企业就绪系统,用于自动部署和管理多层和分布式应用程序服务。根据其网站

ControlTier is a community driven, cross-platform software system used to coordinate application service management activities across multiple nodes and application tiers. The project is fully open source and many of the project contributions come from DTO Solutions ongoing consulting work for large scale e-commerce, software-as-a-service, and financial services operations. Go to Installationto get and install the software.

alt text http://controltier.org/mediawiki/images/d/d2/ControlTier_HighLevel.png

ControlTier 是一个社区驱动的跨平台软件系统,用于协调跨多个节点和应用程序层的应用程序服务管理活动。该项目是完全开源的,许多项目贡献来自 DTO Solutions 正在进行的大规模电子商务、软件即服务和金融服务运营的咨询工作。转到安装以获取并安装软件。

替代文字 http://controltier.org/mediawiki/images/d/d2/ControlTier_HighLevel.png

回答by cetnar

Smart Frogis also worth looking at.

Smart Frog也值得一看。

回答by stigkj

gluseems to be a very nice choice for automating deployments. Description from its web site:

glu似乎是自动化部署的一个很好的选择。来自其网站的描述:

What is glu?

glu is a free/open source deployment and monitoring automation platform.

What problems does glu solve?

glu is solving the following problems:

  • deploy (and monitor) applications to an arbitrary large set of nodes:
    • efficiently
    • with minimum/no human interaction
    • securely
    • in a reproducible manner
  • ensure consistency over time (prevent drifting)
  • detect and troubleshoot quickly when problems arise

How does it work?

glu takes a very declarativeapproach, in which you describe/model what you want, and glu can then:

  • compute the set of actions to deploy/upgrade your applications
  • ensure that it remains consistent over time
  • detect and alert you when there is a mismatch

什么是胶?

glu 是一个免费/开源的部署和监控自动化平台。

glu能解决什么问题?

glu正在解决以下问题:

  • 将应用程序部署(和监视)到任意的大型节点集:
    • 有效率的
    • 最少/没有人机交互
    • 安全地
    • 以可重复的方式
  • 确保随着时间的推移保持一致性(防止漂移)
  • 出现问题时快速检测和排除故障

它是如何工作的?

glu 采用了一种非常声明性的方法,您可以在其中描述/建模您想要的东西,然后 glu 可以:

  • 计算部署/升级应用程序的操作集
  • 确保它随着时间的推移保持一致
  • 当不匹配时检测并提醒您

It is maintained by Yan Pujante and originated at LinkedIn which used it in-house.

它由 Yan Pujante 维护,起源于内部使用它的 LinkedIn。

回答by ali k?ksal

Since this old thread comes up first on google search I want to add a new alternative:

由于这个旧线程首先出现在谷歌搜索上,我想添加一个新的替代方案:

Ansibleexecutes commands over SSH and it is very easy to setup and use. It only takes a few hours to understand the concepts and start writing your own tasks.

Ansible通过 SSH 执行命令,设置和使用非常容易。只需几个小时即可了解概念并开始编写您自己的任务。

Excerpt from site:

网站摘录:

In addition to not requiring any daemons or bootstrapping, Ansible's Playbook language is the simplest systems management language out there. It reads like English. We believe you have other work to do, so we want you to get things done quickly and get out of your way.

除了不需要任何守护进程或引导之外,Ansible 的 Playbook 语言是最简单的系统管理语言。它读起来像英语。我们相信您还有其他工作要做,因此我们希望您能够快速完成工作并摆脱困境。

回答by Fabio Bonfante

I've very similar requirements. Focusing on application deployments instead of environment deployments, seems that http://www.kwatee.net/productperfectly fits!

我有非常相似的要求。专注于应用程序部署而不是环境部署,似乎http://www.kwatee.net/product非常适合!

  • Web interface to create/configure and control the deployments
  • Multi-platform deployment support
  • Version management, incremental updates deployments
  • Use plan shell commands when required
  • Lightweight & easy to use understand and manage
  • 用于创建/配置和控制部署的 Web 界面
  • 多平台部署支持
  • 版本管理、增量更新部署
  • 需要时使用计划 shell 命令
  • 轻量级和易于使用的理解和管理

回答by Ameer Tamboli

Looks like Apache Ace will solve your problem with some other tool like Aries. ACE keeps track of dependencies. You can collate your feature and form a distribution. You can then select targets on which distribution needs to be deployed. It provides RESTful API also.

看起来 Apache Ace 将使用 Aries 等其他工具解决您的问题。ACE 跟踪依赖项。您可以整理您的功能并形成一个分布。然后,您可以选择需要部署分发的目标。它还提供 RESTful API。

Apache ACE

阿帕奇ACE

Apache ACE is a software distribution framework that allows you to centrally manage and distribute software components, configuration data and other artifacts to target systems. It is built using OSGi and can be deployed in different topologies. The target systems are usually also OSGi based, but don't have to be.

Apache ACE 是一个软件分发框架,允许您集中管理和分发软件组件、配置数据和其他工件到目标系统。它是使用 OSGi 构建的,可以部署在不同的拓扑中。目标系统通常也是基于 OSGi 的,但并非必须如此。

http://ace.apache.org/

http://ace.apache.org/

回答by Carlos Lozano

My suggestion is to use a combination of tools (separation of concerns, the right tool for the right problem) that will help you to accomplish your objective, let me mention some of the ones that I've used:

我的建议是使用可以帮助您实现目标的工具组合(关注点分离,正确的工具解决正确的问题),让我提一下我使用过的一些工具:

in addition to the tools mentioned above, there are other that can be helpful and you can use them according to your project needs: http://www.oracle.com/technetwork/articles/java/deployment-tools-2227133.html

除了上面提到的工具之外,还有其他有用的工具,您可以根据您的项目需要使用它们:http: //www.oracle.com/technetwork/articles/java/deployment-tools-2227133.html

Now talking about the problem. The first thing that I noticed is that you mentioned that you already have your release artifacts in your repository manager (like Artifactory), so the next step that we need to do is a way to orchestrate the deployment of these artifacts at the same time, I think one option is to use the Paremeterized Build (https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Build, where you need to define multiple parameters that will contain the different versions of the artifacts that you want to deploy, once the user fills these values we will use them to pass as parameters to a rundeck job (rundeck is a tool that helps you to orchestrate tasks in different nodes), this rundeck deployment master job will receive the parameters and will orchestrate the deployment of your artifacts. Some examples of the steps that a rundeck job will contain are: Stop your Container, Backup your current Components, Start your Container, Download your artifacts from your repository manager, Create Resources in your Container, Deploy your components in your container, Execute your DB Deploy, Send an email if the process fails, etc .. Usually each of these steps are sub-jobs (that also receive parameters), and at the end we create one master job that uses/orchestrate all these sub-jobs.

现在说说问题。我注意到的第一件事是你提到你已经在你的存储库管理器中有你的发布工件(比如 Artifactory),所以我们需要做的下一步是同时编排这些工件的部署,我认为一种选择是使用参数化构建(https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Build,您需要定义多个参数,这些参数将包含您要部署的工件的不同版本,一旦用户填写这些值,我们将使用它们作为参数传递给 rundeck 作业(rundeck 是一个工具,可以帮助您编排不同节点中的任务),此 rundeck 部署主作业将接收参数并将编排您的工件的部署。rundeck 作业将包含的一些步骤示例包括:停止容器、备份当前组件、启动容器、从存储库管理器下载工件、在容器中创建资源、在容器中部署组件、执行数据库部署,如果流程失败,则发送电子邮件等。通常这些步骤中的每一个都是子作业(也接收参数),

Let me add some images examples of this type of CD process. This example is only deploying War/Ear artifacts, but it can help you to see the big picture:

让我添加一些此类 CD 过程的图像示例。此示例仅部署 War/Ear 工件,但它可以帮助您了解全局:

https://drive.google.com/folderview?id=0B-FVAopZZjDWdGl0WlNjX1RnRDQ&usp=sharing

https://drive.google.com/folderview?id=0B-FVAopZZjDWdGl0WlNjX1RnRDQ&usp=sharing

I hope this can be helpful.

我希望这会有所帮助。