简体   繁体   English

使用人偶从源代码构建

[英]Using puppet to build from source

How can I use puppet to build from source without using multiple Exec commands?. 如何在不使用多个Exec命令的情况下使用puppet从源代码进行构建? Do we have modules for it on forge that I could use? 我在锻造上有可用的模块吗?

It's possible to use Puppet to build applications from source without using execs, possibly with a custom written type and provider. 可以使用Puppet从源代码构建应用程序而无需使用exec,可能使用自定义的书面类型和提供程序。 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. 否则,是的,它就得在几个不同的EXEC资源, onlyifcreates等语句来阻止他们运行的每个代理运行时间。

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. Puppet的配置管理模型被称为所需状态模型:您定义系统的最终状态,然后让系统运行。 This is why exec's are generally avoided in Puppet: they don't fit a desired state model. 这就是为什么在Puppet中通常避免执行程序的原因:它们不符合所需的状态模型。 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): 这样做有一些固有的问题(这不仅是针对Puppet的,而且是大多数配置管理语言的):

  • 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 . 听起来,通过使用FPM之类的工具或仅使用本地软件包构建工具(例如rpmbuild ,通过打包可以更好地解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM