ReleaseEngineering/How To/Install a Package with Puppet

< ReleaseEngineering‎ | How To
Revision as of 23:11, 17 February 2011 by Djmitche (talk | contribs) (Created page with "{{Release Engineering How To|Install a Package with Puppet}} After pushing file deployment over NFS to its limit we replaced it with native package formats for software deploymen...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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.

Manifests

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 {
    "gcc433-4.3.3-0moz1":
        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
make install
cd ..
# DMG creation
hg clone http://hg.mozilla.org/build/puppet-manifests
./puppet-manifests/create-dmg.sh /tools/python-2.5.2 python-2.5.2 python /tools

The first argument to create-dmg.sh 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 {
    "python-2.5.2.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.