使用puppet从源代码构建(Using puppet to build from source)

系统教程 行业动态 更新时间:2024-06-14 16:58:30
使用puppet从源代码构建(Using puppet to build from source)

如何在不使用多个Exec命令的情况下使用puppet从源代码构建? 我们可以使用伪造的模块吗?

How can I use puppet to build from source without using multiple Exec commands?. Do we have modules for it on forge that I could use?

最满意答案

可以使用Puppet从源代码构建应用程序而不使用execs,可能使用自定义编写类型和提供程序。 否则,是的,它必须是一些不同的exec资源,只有onlyif , creates等语句才能在每次代理运行时阻止它们运行。

Puppet的配置管理模型被称为期望的状态模型:您定义系统的最终状态并让系统。 这就是为什么在Puppet中通常会避免使用exec的原因:它们不适合所需的状态模型。 它还可以更新应用程序,或处理未知数,例如创建所需文件的编译部分失败。

在我看来, 我不建议使用配置管理从源代码构建应用程序 。 这样做有一些固有的问题(这不仅适用于Puppet,而是适用于大多数配置管理语言):

较慢的运行,因为运行编译可能会更长并且检测到它完成通常是一个稍微棘手的任务 半完成状态或失败的问题:如果编译中途中断,则更难以检测和解决 使编译具有幂等性:您必须将命令包装在逻辑中,以检测安装是否已完成。 但是,这很困难,因为即使编译以失败结束,也可能发生标记文件或特定二进制文件的检测 升级或更改:没有简单的方法来升级或更改应用程序。 一个包将更容易做到这一点。

这听起来像是通过包装,使用FPM等工具或仅使用本机包构建工具(如rpmbuild来提供更好的服务。

It's possible to use Puppet to build applications from source without using execs, possibly with a custom written type and provider. Otherwise, yes, it'd have to be a few different exec resources with onlyif, creates etc. statements to stop them running every time the agent ran.

Puppet's model of configuration management is known as a desired state model: you define the end state of the system and let the system. This is why exec's are generally avoided in Puppet: they don't fit a desired state model. It also makes things like updating the application, or dealing with unknowns like a partial failure of the compilation that creates a required file.

In my opinion, I would not recommend using configuration management to build applications from source at all. There are a few issue inherent with doing so (this is not just for Puppet, but most config management languages):

Slower runs, as running the compilation can be longer and detecting that it's complete is normally a slightly trickier tasks Issues with half complete state or failure: if the compilation breaks halfway through it's both harder to detect and resolve Making the compilation idempotent: You have to wrap the command in logic that detects if the installation has already been done. However, this is difficult, as things like the detection of a flag file or particular binary could occur even when the compilation ends in failure Upgrading or changing: There's no easy way to upgrade or change the application. A package would be easier to do this with.

This sounds like something that would be better served by packaging, using tools such as FPM or just native package building tools such as rpmbuild.

更多推荐

本文发布于:2023-04-15 03:27:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/9edd6abf710e78e66381d65149683469.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:源代码   puppet   source   build

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!