Skip to content

Commit

Permalink
Migrate aufs and device-mapper logic to separate cookbooks, closes #88
Browse files Browse the repository at this point in the history
…and #90
  • Loading branch information
bflad committed Mar 31, 2014
1 parent 49de1c0 commit dfc5373
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 44 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ Attribute deprecations so you can be sure you can upgrade:
* container LWRP Fixnum port attribute: use full String notation from Docker documentation in port attribute instead
* container LWRP public_port attribute: use port attribute instead

## 0.33.0

This release deprecates AUFS/device-mapper handling from chef-docker, but provides backwards compatibility by still including the default recipe of the new cookbooks. Please update your dependencies, Github watching/issues, and recipes to reflect the two new community cookbooks:
* aufs: [aufs on community site](http://community.opscode.com/cookbooks/aufs) / [chef-aufs on Github](https://github.com/bflad/chef-aufs)
* device-mapper: [device-mapper on community site](http://community.opscode.com/cookbooks/device-mapper) / [chef-device-mapper on Github](https://github.com/bflad/chef-device-mapper)

* Enhancement: [#88][]: Migrate AUFS logic to separate cookbook
* Enhancement: [#90][]: Migrate device-mapper logic to separate cookbook

## 0.32.2

* Bugfix: [#101][]: Explicitly install lxc on Ubuntu (when lxc is exec_driver; continue to fully support LXC as a default installation path since its been since Docker 0.1)
Expand Down
34 changes: 28 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,39 @@ This cookbook was inspired by @thoward's docker-cookbook: https://github.com/tho

Third-Party Cookbooks

* [aufs](https://github.com/bflad/chef-aufs)
* [device-mapper](https://github.com/bflad/chef-device-mapper)
* [golang](https://github.com/NOX73/chef-golang)
* [lxc](https://github.com/hw-cookbooks/lxc)
* [modules](https://github.com/Youscribe/modules-cookbook)
* [sysctl](https://github.com/onehealth-cookbooks/sysctl)

## Usage

### Default Installation

* Add `recipe[docker]` to your node's run list

### Storage Drivers

Beginning in chef-docker 1.0, storage driver installation and configuration is expected to be handled before this cookbook's execution, except where required by Docker.

#### AUFS

If you need AUFS support, consider adding the aufs cookbook to your node/recipe before docker.
* [aufs on community site](http://community.opscode.com/cookbooks/aufs)
* [chef-aufs on Github](https://github.com/bflad/chef-aufs)

Then, set the `storage_driver` attribute of this cookbook to `aufs`.

#### device-mapper

If you need device-mapper support, consider adding the device-mapper cookbook to your node/recipe before docker.
* [device-mapper on community site](http://community.opscode.com/cookbooks/device-mapper)
* [chef-device-mapper on Github](https://github.com/bflad/chef-device-mapper)

Then, set the `storage_driver` attribute of this cookbook to `devicemapper` (please note lack of dash).

## Attributes

These attributes are under the `node['docker']` namespace.
Expand Down Expand Up @@ -690,12 +718,6 @@ Log into private registry with optional port:
password 'still_hope_this_is_in_encrypted_databag'
end

## Usage

### Default Installation

* Add `recipe[docker]` to your node's run list

## Testing and Development

* Quickly testing with Vagrant: [VAGRANT.md](VAGRANT.md)
Expand Down
2 changes: 2 additions & 0 deletions metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
supports 'ubuntu', '>= 12.04'

depends 'apt'
depends 'aufs', '>= 0.1.1'
depends 'device-mapper', '>= 0.1.0'
depends 'git'
depends 'golang'
depends 'homebrew'
Expand Down
26 changes: 2 additions & 24 deletions recipes/aufs.rb
Original file line number Diff line number Diff line change
@@ -1,24 +1,2 @@
case node['platform']
when 'ubuntu'
# If aufs isn't available, do our best to install the correct linux-image-extra package.
# Use kernel release for saucy and newer, otherwise use older, more compatible regexp match
if Chef::Version.new(node['platform_version']) < Chef::Version.new('13.10')
# Original method copied from https://github.com/thoward/docker-cookbook/blob/master/recipes/default.rb
package_name = 'linux-image-extra-' + Mixlib::ShellOut.new("uname -r | grep --only-matching -e [0-9]\.[0-9]\.[0-9]-[0-9]*").run_command.stdout.strip
else
# In modern ubuntu versions, kernel release matches the kernel package name
package_name = 'linux-image-extra-' + node['kernel']['release']
end

extra_package = Mixlib::ShellOut.new('apt-cache search ' + package_name).run_command.stdout.split(' ').first
# Wait to strip until after checking for empty, to protect against nil errors
unless extra_package.nil? || extra_package.empty?
package extra_package.strip do
not_if 'modprobe -l | grep aufs'
end
end

modules 'aufs' do
action :load
end
end
# DEPRECATED: will likely be removed in chef-docker 1.0
include_recipe 'aufs'
16 changes: 2 additions & 14 deletions recipes/devicemapper.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,2 @@
# TODO: Move to its own cookbook

packages = value_for_platform(
%w(centos fedora oracle redhat) => {
'default' => %w(device-mapper device-mapper-devel device-mapper-persistent-data)
},
%w(debian ubuntu) => {
'default' => %w(libdevmapper1.02.1 libdevmapper-dev)
}
)

packages.each do |p|
package p
end
# DEPRECATED: will likely be removed in chef-docker 1.0
include_recipe 'device-mapper'

0 comments on commit dfc5373

Please sign in to comment.