Skip to content

Commit 052eb01

Browse files
committed
use apt-cacher-ng instead of apt-cacher. apt-cacher-ng works better with mixed Debian & Ubuntu repos and supposedly scales better
1 parent 6cfd325 commit 052eb01

File tree

6 files changed

+27
-192
lines changed

6 files changed

+27
-192
lines changed

README.md

+15-12
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
Description
22
===========
33

4-
This cookbook includes recipes to execute apt-get update to ensure the local APT package cache is up to date or manage apt-cacher and cacher clients. It also includes a LWRP for managing APT repositories in /etc/apt/sources.list.d.
4+
This cookbook includes recipes to execute apt-get update to ensure the local APT package cache is up to date. There are recipes for managing the apt-cacher-ng caching proxy and proxy clients. It also includes a LWRP for managing APT repositories in /etc/apt/sources.list.d.
55

66
Changes
77
=======
88

9+
## v1.3.0:
10+
11+
* COOK-593: switched from apt-cacher to apt-cacher-ng to better support multiple distributions.
12+
913
## v1.2.2:
1014

1115
* COOK-804: apt-get update resource in apt cookbook changed names
@@ -28,14 +32,14 @@ This recipe should appear first in the run list of Debian or Ubuntu nodes to ens
2832

2933
This recipe also sets up a local cache directory for preseeding packages.
3034

31-
cacher
32-
------
35+
cacher-ng
36+
---------
3337

34-
Installs the apt-cacher package and service so the system can provide APT caching. You can check the usage report at http://{hostname}:3142/report. The cacher recipe includes the `cacher-client` recipe, so it helps seed itself.
38+
Installs the `apt-cacher-ng` package and service so the system can provide APT caching. You can check the usage report at http://{hostname}:3142/acng-report.html. The `cacher-ng` recipe includes the `cacher-client` recipe, so it helps seed itself.
3539

3640
cacher-client
3741
-------------
38-
Configures the node to use the apt-cacher server as a client.
42+
Configures the node to use the `apt-cacher-ng` server as a client.
3943

4044
Resources/Providers
4145
===================
@@ -64,7 +68,7 @@ This LWRP provides an easy way to manage additional APT repositories. Adding a n
6468
uri "http://dev.zenoss.org/deb"
6569
components ["main","stable"]
6670
end
67-
71+
6872
# add the Nginx PPA; grab key from keyserver
6973
apt_repository "nginx-php" do
7074
uri "http://ppa.launchpad.net/nginx/php5/ubuntu"
@@ -73,20 +77,20 @@ This LWRP provides an easy way to manage additional APT repositories. Adding a n
7377
keyserver "keyserver.ubuntu.com"
7478
key "C300EE8C"
7579
end
76-
80+
7781
# add the Cloudkick Repo
7882
apt_repository "cloudkick" do
7983
uri "http://packages.cloudkick.com/ubuntu"
8084
distribution node['lsb']['codename']
8185
components ["main"]
8286
key "http://packages.cloudkick.com/cloudkick.packages.key"
8387
end
84-
88+
8589
# remove Zenoss repo
8690
apt_repository "zenoss" do
8791
action :remove
8892
end
89-
93+
9094
Usage
9195
=====
9296

@@ -98,7 +102,7 @@ Put `recipe[apt]` first in the run list. If you have other recipes that you want
98102

99103
The above will run during execution phase since it is a normal template resource, and should appear before other package resources that need the sources in the template.
100104

101-
Put `recipe[apt::cacher]` in the run_list for a server to provide APT caching and add `recipe[apt::cacher-client]` on the rest of the Debian-based nodes to take advantage of the caching server.
105+
Put `recipe[apt::cacher-ng]` in the run_list for a server to provide APT caching and add `recipe[apt::cacher-client]` on the rest of the Debian-based nodes to take advantage of the caching server.
102106

103107
License and Author
104108
==================
@@ -107,7 +111,7 @@ Author:: Joshua Timberman (<[email protected]>)
107111
Author:: Matt Ray (<[email protected]>)
108112
Author:: Seth Chisamore (<[email protected]>)
109113

110-
Copyright 2009-2011 Opscode, Inc.
114+
Copyright 2009-2012 Opscode, Inc.
111115

112116
Licensed under the Apache License, Version 2.0 (the "License");
113117
you may not use this file except in compliance with the License.
@@ -120,4 +124,3 @@ distributed under the License is distributed on an "AS IS" BASIS,
120124
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
121125
See the License for the specific language governing permissions and
122126
limitations under the License.
123-

files/default/apt-cacher

-9
This file was deleted.

files/default/apt-cacher.conf

-144
This file was deleted.

metadata.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
license "Apache 2.0"
44
description "Configures apt and apt services and an LWRP for managing apt repositories"
55
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
6-
version "1.2.2"
6+
version "1.3.0"
77
recipe "apt", "Runs apt-get update during compile phase and sets up preseed directories"
8-
recipe "apt::cacher", "Set up an APT cache"
9-
recipe "apt::cacher-client", "Client for the apt::cacher server"
8+
recipe "apt::cacher-ng", "Set up an apt-cacher-ng caching proxy"
9+
recipe "apt::cacher-client", "Client for the apt::cacher-ng caching proxy"
1010

1111
%w{ ubuntu debian }.each do |os|
1212
supports os

recipes/cacher-client.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Cookbook Name:: apt
33
# Recipe:: cacher-client
44
#
5-
# Copyright 2011, Opscode, Inc.
5+
# Copyright 2011, 2012 Opscode, Inc.
66
#
77
# Licensed under the Apache License, Version 2.0 (the "License");
88
# you may not use this file except in compliance with the License.
@@ -33,11 +33,11 @@
3333
servers << cacher
3434
end
3535
else
36-
servers += search(:node, 'recipes:apt\:\:cacher')
36+
servers += search(:node, 'recipes:apt\:\:cacher-ng')
3737
end
3838

3939
if servers.length > 0
40-
Chef::Log.info("apt-cacher server found on #{servers[0]}.")
40+
Chef::Log.info("apt-cacher-ng server found on #{servers[0]}.")
4141
proxy = "Acquire::http::Proxy \"http://#{servers[0].ipaddress}:3142\";\n"
4242
file "/etc/apt/apt.conf.d/01proxy" do
4343
owner "root"
@@ -47,7 +47,7 @@
4747
action :create
4848
end
4949
else
50-
Chef::Log.info("No apt-cacher server found.")
50+
Chef::Log.info("No apt-cacher-ng server found.")
5151
file "/etc/apt/apt.conf.d/01proxy" do
5252
action :delete
5353
only_if {File.exists?("/etc/apt/apt.conf.d/01proxy")}
+5-20
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#
22
# Cookbook Name:: apt
3-
# Recipe:: cacher
3+
# Recipe:: cacher-ng
44
#
5-
# Copyright 2008-2011, Opscode, Inc.
5+
# Copyright 2008-2012, Opscode, Inc.
66
#
77
# Licensed under the Apache License, Version 2.0 (the "License");
88
# you may not use this file except in compliance with the License.
@@ -16,30 +16,15 @@
1616
# See the License for the specific language governing permissions and
1717
# limitations under the License.
1818
#
19-
package "apt-cacher" do
19+
20+
package "apt-cacher-ng" do
2021
action :install
2122
end
2223

23-
service "apt-cacher" do
24+
service "apt-cacher-ng" do
2425
supports :restart => true, :status => false
2526
action [ :enable, :start ]
2627
end
2728

28-
cookbook_file "/etc/apt-cacher/apt-cacher.conf" do
29-
source "apt-cacher.conf"
30-
owner "root"
31-
group "root"
32-
mode 0644
33-
notifies :restart, resources(:service => "apt-cacher")
34-
end
35-
36-
cookbook_file "/etc/default/apt-cacher" do
37-
source "apt-cacher"
38-
owner "root"
39-
group "root"
40-
mode 0644
41-
notifies :restart, resources(:service => "apt-cacher")
42-
end
43-
4429
#this will help seed the proxy
4530
include_recipe "apt::cacher-client"

0 commit comments

Comments
 (0)