Ask Your Question
2

How can I use Puppet to build from source?

asked 2012-11-13 12:30:41 -0500

haus gravatar image

I have a webserver and I want to download, unpack, configure and compile and install apache. How can I get Puppet to do this for me only once?

edit retag flag offensive close merge delete

6 Answers

Sort by » oldest newest most voted
11

answered 2012-11-28 13:58:28 -0500

gh gravatar image

While you could have a series of exec{} resources that each check that the commands need to be run have been run and build relationships between them for ordering, you do not want to go down that road.

All software installed on a system should be done through that OS's packaging software, not through compilation. Then you can just use a package{} resource. This also gives you the benefit of leveraging the packaging software that acts as a source of truth for installed packages and generally knows the files on disk for each package.

If you want to custom ... (more)

edit flag offensive delete link more
5

answered 2012-12-19 05:58:58 -0500

example42 gravatar image

updated 2012-12-19 06:07:48 -0500

Confirming what others have said about package management, if you need to download, extract and install a tarball for whatever reason, (Installation of apache from source, installation of a web app, installation of a custom app) with Puppet you might find interesting the this define, that has been done exactly for this purpose: https://github.com/example42/puppi/blob/master/manifests/netinstall.pp

To use it in a Manifest:

  • Have puppi in your modulepath

  • Write something like (not tested):

    puppi::netinstall { 'apache':
      url                 => 'http://mirror.nohup.it/apache//httpd/httpd-2.4.3.tar.bz2',
      destination_dir     => '/var/tmp/apache', # Must Exist ...
(more)
edit flag offensive delete link more
0

answered 2012-12-18 15:17:28 -0500

reidmv gravatar image

Using native packages is almost always the sanest way to go, as other answers suggest. That said, Puppet as a framework is capable of supporting build-from-source style application deployments.

A generic stub of what a defined type for building from source might look like:
https://gist.github.com/2597027

The gist is unfinished and most notably does not include "unless" statements or refreshonly parameters, but gets the idea across in a simple way.

edit flag offensive delete link more
0

answered 2012-12-18 08:59:31 -0500

bmurts gravatar image

updated 2012-12-18 13:49:13 -0500

To follow up Garrett's post, it is the recommended method to utilize the OS's built-in package manager to help with consistency, updates, etc. but it can be done.

Currently, in my Ruby module I'm compiling from source for the YAML library and actual Ruby v1.9.3. It is not ideal and I hope to switch to a package for easier management, but currently I'm following the word passed down from those with the higher pay grade.

To give you an idea what I went through (which could probably use some refactoring as I get better ... (more)

edit flag offensive delete link more

Comments

if you compile in Exec[] resource, you might need to increase timeout, default is 5 minutes, which turned out to be not sufficient for us to compile ruby on some ...(more)

asq gravatar imageasq ( 2012-12-18 11:18:53 -0500 )edit

@asq, correct. I manually override the timeout parameter in my 'ruby_make' Exec and set it to '0' to disable the default timeout @ line 61 in my gist

bmurts gravatar imagebmurts ( 2012-12-18 13:48:08 -0500 )edit

If you want to custom compile software and building packages seems like a lot of overhead, check out FPM[1]. It lets you easily take a directory and convert it into a versioned package. Thanks http://qwikfix.co.uk/sky-customer-services/

googleclone gravatar imagegoogleclone ( 2016-08-05 05:45:45 -0500 )edit
0

answered 2012-12-18 15:00:21 -0500

riffraff169 gravatar image

updated 2012-12-18 15:01:35 -0500

There is a staging module puppet-staging: git@github.com:nanliu/puppet-staging.git that will do some good stuff. I am currently using it to deploy tomcat7 from tar.

But again, native packaging is best.

edit flag offensive delete link more
-1

answered 2012-12-19 03:04:18 -0500

In addition to @gh's answer, I'd say if you really want to build software on your machines, you should use a source-based distribution, such as Gentoo, instead of a binary-based distribution like Debian/Ubuntu/RedHat… Then you could use the portage provider for the package type.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2012-11-13 12:30:41 -0500

Seen: 8,746 times

Last updated: Dec 19 '12