Install a portage snapshot from a remote HTTP server.
Gentoo, more than other distros, makes it easy to have a "frozen repository" of packages. This is important in the data center, when you want some guarantee that your server deployments are deterministic. In other words, the same system can be built a month from now that you built today. We're adjusting Gentoo's "rolling release" capability so that it rolls at an appropriate tempo for your business.
You will no longer "emerge --sync" on these systems.
This cookbook:
- downloads a portage snapshot tarball with checksum
- confirms the checksum
- extracts the archive to a directory that can hold multiple snapshots
- maybe backs up your original system PORTDIR (if the location conflicts)
- symlinks your PORTDIR to the latest snapshot
- sets the PORTDIR value in make.conf
The symlink setup maximizes the resilience of the cookbook and also makes it easy to roll back to an old snapshot if the new one makes problems.
It is up to you to pre-place an archive/checksum where they can be
downloaded over HTTP (e.g. CloudFiles, CloudFront, standard web hosting).
Though it's possible (and useful for testing), you
mustn't link directly to a Gentoo mirror because snapshots are only
mirrored for a week.
Note that if your DISTDIR and PKGDIR are under PORTDIR, then the symlink change will orphan those old files, and the cleaning feature (below) may eventually delete them. This can be a natural way to keep old stuff from accumulating unboundedly. If you're not okay with this, just change your DISTDIR and PKGDIR to be outside of PORTDIR.
A cleaning feature, enabled by default, deletes all but the newest three snapshots. This keeps the recipe from filling your disk over time with snapshots. At this time, "newest" is determined by sorting the directories under the snapshots directory and taking the latest ones, which requires that your basename is in a date-sortable format (e.g. portage-20131009) like Gentoo publishes them.
portage_snapshot requires the portage cookbook by Vasily Mikhaylichenko https://github.com/lxmx/chef-portage.
Key | Type | Description | Default |
---|---|---|---|
['portage_snapshot'][:archive_basename] | String | The date-sortable snapshot name. | 'portage-20131009' |
['portage_snapshot'][:archive_suffix] | String | archive_basename + archive_suffix = short file name | '.tar.xz' |
['portage_snapshot'][:base_url] | String | Where to download the snapshot, excluding the /filename | 'http://myfiles.example.org' |
['portage_snapshot'][:portdir] | String | The filesystem location where the portage tree should live | '/usr/portage' |
['portage_snapshot'][:snapshots_dir] | String | A place to keep snapshots | '/var/portage_snapshots' |
['portage_snapshot'][:clean_old_snapshots] | Boolean | Whether to delete old snapshots to set an upper bound on disk usage | true |
['portage_snapshot'][:keep_n_newest_snapshots] | Integer | How many snapshots to keep if :clean_old_snapshots is true | 3 |
Include portage_snapshot
in your node's run_list
, and
specify the URL and snapshot basename for the download.
{
"name":"my_node",
"normal" : {
"portage_snapshot" : {
"base_url" : "http://mycdn.example.org/foobucket",
"archive_basename" : "portage-20131009"
}
},
"run_list": [
"recipe[portage_snapshot]"
]
}
Include portage_snapshot::update
in your node's run_list
,
optionally, to run a system update following the snapshot install
{
"name":"my_node",
"normal" : {
"portage_snapshot" : {
"base_url" : "http://mycdn.example.org/foobucket",
"archive_basename" : "portage-20131009"
}
},
"run_list": [
"recipe[portage_snapshot]",
"recipe[portage_snapshot::update]"
]
}
- Cleaning check could determine "newest" snapshots from first field in metadata/timestamp.x instead of sorting dir names. Use a ruby block for this not bash
- Check gpg signature (can be disabled)
- Allow disabling checksum download/check
Pull requests, patches, issues, e-mails welcome.
Affero GPL v3
Erik Mackdanz