ReleaseEngineering/How To/Install a Package with Puppet

From MozillaWiki
Jump to: navigation, search

After pushing file deployment over NFS to its limit we replaced it with native package formats for software deployment. This switch was made around June, 2010.

RPM (CentOS, Fedora)

We use a combination of 3rd party and in-house RPMs to deploy to our Linux machines. On the manifest side we use the 'rpm' package provider wrapped in a custom type to ensure installation.

To build or upgrade a homegrown RPM, see ReleaseEngineering/How To/Create a new RPM.


The manifests are pretty simple once have an RPM. We use a wrapper type called 'install_rpm' to perform installation. You can use it as follows:

install_rpm {
        creates => "/tools/gcc-4.3.3/installed/bin/gcc",
        pkgname => "gcc433";

The name needs to match the package name + version. Note that RPM requires a 'vendor' version, which is where the 0moz1 comes from. Creates needs to be a file that the package creates, preferably the last one to get installed.

DMG+pkg (Mac)

Mac machines use pkg installers wrapped in a DMG file as a package format. On the manifest side, we use the 'pkgdmg' package provider wrapped in a custom type to deploy them. For things which are distributed in a DMG+pkg (such as Xcode) you can skip down to the manifests.

When an upstream DMG file is not available it needs to be created by hand. To do this, we do a manual installation once and then using a script to create the DMG+pkg. Here's an example, which creates a Python 2.5.2 DMG:

# The installation
tar jxvf Python-2.5.2.tar.bz2
cd Python-2.5.2
./configure --prefix=/tools/python-2.5.2
make install
cd ..
# DMG creation
hg clone
./puppet-manifests/ /tools/python-2.5.2 python-2.5.2 python /tools

The first argument to is the directory to package, which will include the directory itself. The second argument is the name to use on the DMG/pkg filenames. The third is the string to use in the package identifier, it must be alphanumeric only. Lastly, the directory to install the package to.

On the manifests side of things a simple use of the install_dmg type will ensure a package gets installed:

install_dmg {
        creates => "/tools/python-2.5.2/share",

The argument to "creates" should be one of the last files that will be created by the package. Internally, install_dmg checks for this file and mark the package as installed if it exists, skipping installation.

If you intend to use a package on multiple platforms always ensure to test on them before rolling out any manifest changes. When in doubt, create a package on each target platform.