engineyard-visualvm 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/Gemfile +16 -0
- data/LICENSE.txt +23 -0
- data/README.md +102 -0
- data/Rakefile +76 -0
- data/Vagrantfile +94 -0
- data/bin/ey-visualvm +9 -0
- data/cookbooks/apt/README.md +122 -0
- data/cookbooks/apt/files/default/apt-cacher +9 -0
- data/cookbooks/apt/files/default/apt-cacher.conf +144 -0
- data/cookbooks/apt/files/default/apt-proxy-v2.conf +50 -0
- data/cookbooks/apt/metadata.json +34 -0
- data/cookbooks/apt/metadata.rb +13 -0
- data/cookbooks/apt/providers/repository.rb +73 -0
- data/cookbooks/apt/recipes/cacher-client.rb +44 -0
- data/cookbooks/apt/recipes/cacher.rb +45 -0
- data/cookbooks/apt/recipes/default.rb +50 -0
- data/cookbooks/apt/resources/repository.rb +30 -0
- data/cookbooks/gems/recipes/default.rb +16 -0
- data/cookbooks/java/README.md +102 -0
- data/cookbooks/java/attributes/default.rb +29 -0
- data/cookbooks/java/files/default/java.seed +11 -0
- data/cookbooks/java/metadata.json +50 -0
- data/cookbooks/java/metadata.rb +16 -0
- data/cookbooks/java/recipes/default.rb +21 -0
- data/cookbooks/java/recipes/openjdk.rb +39 -0
- data/cookbooks/java/recipes/sun.rb +93 -0
- data/cookbooks/jruby/attributes/default.rb +2 -0
- data/cookbooks/jruby/recipes/default.rb +24 -0
- data/cookbooks/server/recipes/default.rb +9 -0
- data/cookbooks/server/templates/default/server.sh.erb +27 -0
- data/cookbooks/vagrant_main/recipes/default.rb +4 -0
- data/engineyard-visualvm.gemspec +28 -0
- data/ext/org/jruby/ext/jmx/Agent.java +169 -0
- data/ext/org/jruby/ext/jmx/JavaHome.java +7 -0
- data/ext/org/jruby/ext/jmx/RMIServerSocketFactoryImpl.java +37 -0
- data/lib/engineyard-visualvm.rb +8 -0
- data/lib/engineyard-visualvm/agent.jar +0 -0
- data/lib/engineyard-visualvm/cli.rb +205 -0
- data/lib/engineyard-visualvm/version.rb +11 -0
- data/spec/engineyard-visualvm_spec.rb +164 -0
- data/spec/spec_helper.rb +30 -0
- metadata +154 -0
@@ -0,0 +1,9 @@
|
|
1
|
+
# apt-cacher startup configuration file
|
2
|
+
|
3
|
+
# IMPORTANT: check the apt-cacher.conf file before using apt-cacher as daemon.
|
4
|
+
|
5
|
+
# set to 1 to start the daemon at boot time
|
6
|
+
AUTOSTART=1
|
7
|
+
|
8
|
+
# extra settings to override the ones in apt-cacher.conf
|
9
|
+
# EXTRAOPT=" daemon_port=3142 limit=30 "
|
@@ -0,0 +1,144 @@
|
|
1
|
+
# This file has been modified by ./apt-proxy-to-apt-cacher
|
2
|
+
# Some lines may have been appended at the bottom of this file
|
3
|
+
# This file has been modified by /usr/share/apt-cacher/apt-proxy-to-apt-cacher
|
4
|
+
# Some lines may have been appended at the bottom of this file
|
5
|
+
#################################################################
|
6
|
+
# This is the config file for apt-cacher. On most Debian systems
|
7
|
+
# you can safely leave the defaults alone.
|
8
|
+
#################################################################
|
9
|
+
|
10
|
+
# cache_dir is used to set the location of the local cache. This can
|
11
|
+
# become quite large, so make sure it is somewhere with plenty of space.
|
12
|
+
cache_dir=/var/cache/apt-cacher
|
13
|
+
|
14
|
+
# The email address of the administrator is displayed in the info page
|
15
|
+
# and traffic reports.
|
16
|
+
admin_email=root@localhost
|
17
|
+
|
18
|
+
# For the daemon startup settings please edit the file /etc/default/apt-cacher.
|
19
|
+
|
20
|
+
# Daemon port setting, only useful in stand-alone mode. You need to run the
|
21
|
+
# daemon as root to use privileged ports (<1024).
|
22
|
+
daemon_port = 3142
|
23
|
+
|
24
|
+
# optional settings, user and group to run the daemon as. Make sure they have
|
25
|
+
# sufficient permissions on the cache and log directories. Comment the settings
|
26
|
+
# to run apt-cacher as the native user.
|
27
|
+
group=www-data
|
28
|
+
user=www-data
|
29
|
+
|
30
|
+
# optional setting, binds the listening daemon to one specified IP. Use IP
|
31
|
+
# ranges for more advanced configuration, see below.
|
32
|
+
# daemon_addr=localhost
|
33
|
+
|
34
|
+
# If your apt-cacher machine is directly exposed to the Internet and you are
|
35
|
+
# worried about unauthorised machines fetching packages through it, you can
|
36
|
+
# specify a list of IPv4 addresses which are allowed to use it and another
|
37
|
+
# list of IPv4 addresses which aren't.
|
38
|
+
# Localhost (127.0.0.1) is always allowed. Other addresses must be matched
|
39
|
+
# by allowed_hosts and not by denied_hosts to be permitted to use the cache.
|
40
|
+
# Setting allowed_hosts to "*" means "allow all".
|
41
|
+
# Otherwise the format is a comma-separated list containing addresses,
|
42
|
+
# optionally with masks (like 10.0.0.0/22), or ranges of addresses (two
|
43
|
+
# addresses separated by a hyphen, no masks, like '192.168.0.3-192.168.0.56').
|
44
|
+
allowed_hosts=*
|
45
|
+
denied_hosts=
|
46
|
+
|
47
|
+
# And similiarly for IPv6 with allowed_hosts_6 and denied_hosts_6.
|
48
|
+
# Note that IPv4-mapped IPv6 addresses (::ffff:w.x.y.z) are truncated to
|
49
|
+
# w.x.y.z and are handled as IPv4.
|
50
|
+
allowed_hosts_6=fec0::/16
|
51
|
+
denied_hosts_6=
|
52
|
+
|
53
|
+
# This thing can be done by Apache but is much simplier here - limit access to
|
54
|
+
# Debian mirrors based on server names in the URLs
|
55
|
+
#allowed_locations=ftp.uni-kl.de,ftp.nerim.net,debian.tu-bs.de
|
56
|
+
|
57
|
+
# Apt-cacher can generate usage reports every 24 hours if you set this
|
58
|
+
# directive to 1. You can view the reports in a web browser by pointing
|
59
|
+
# to your cache machine with '/apt-cacher/report' on the end, like this:
|
60
|
+
# http://yourcache.example.com/apt-cacher/report
|
61
|
+
# Generating reports is very fast even with many thousands of logfile
|
62
|
+
# lines, so you can safely turn this on without creating much
|
63
|
+
# additional system load.
|
64
|
+
generate_reports=1
|
65
|
+
|
66
|
+
# Apt-cacher can clean up its cache directory every 24 hours if you set
|
67
|
+
# this directive to 1. Cleaning the cache can take some time to run
|
68
|
+
# (generally in the order of a few minutes) and removes all package
|
69
|
+
# files that are not mentioned in any existing 'Packages' lists. This
|
70
|
+
# has the effect of deleting packages that have been superseded by an
|
71
|
+
# updated 'Packages' list.
|
72
|
+
clean_cache=1
|
73
|
+
|
74
|
+
# The directory to use for apt-cacher access and error logs.
|
75
|
+
# The access log records every request in the format:
|
76
|
+
# date-time|client ip address|HIT/MISS/EXPIRED|object size|object name
|
77
|
+
# The error log is slightly more free-form, and is also used for debug
|
78
|
+
# messages if debug mode is turned on.
|
79
|
+
# Note that the old 'logfile' and 'errorfile' directives are
|
80
|
+
# deprecated: if you set them explicitly they will be honoured, but it's
|
81
|
+
# better to just get rid of them from old config files.
|
82
|
+
logdir=/var/log/apt-cacher
|
83
|
+
|
84
|
+
# apt-cacher can use different methods to decide whether package lists need to
|
85
|
+
# be updated,
|
86
|
+
# A) looking at the age of the cached files
|
87
|
+
# B) getting HTTP header from server and comparing that with cached data. This
|
88
|
+
# method is more reliable and avoids desynchronisation of data and index files
|
89
|
+
# but needs to transfer few bytes from the server every time somebody requests
|
90
|
+
# the files ("apt-get update")
|
91
|
+
# Set the following value to the maximum age (in hours) for method A or to 0
|
92
|
+
# for method B
|
93
|
+
expire_hours=0
|
94
|
+
|
95
|
+
# Apt-cacher can pass all its requests to an external http proxy like
|
96
|
+
# Squid, which could be very useful if you are using an ISP that blocks
|
97
|
+
# port 80 and requires all web traffic to go through its proxy. The
|
98
|
+
# format is 'hostname:port', eg: 'proxy.example.com:8080'.
|
99
|
+
http_proxy=proxy.example.com:8080
|
100
|
+
|
101
|
+
# Use of an external proxy can be turned on or off with this flag.
|
102
|
+
# Value should be either 0 (off) or 1 (on).
|
103
|
+
use_proxy=0
|
104
|
+
|
105
|
+
# External http proxy sometimes need authentication to get full access. The
|
106
|
+
# format is 'username:password'.
|
107
|
+
http_proxy_auth=proxyuser:proxypass
|
108
|
+
|
109
|
+
# Use of external proxy authentication can be turned on or off with this flag.
|
110
|
+
# Value should be either 0 (off) or 1 (on).
|
111
|
+
use_proxy_auth=0
|
112
|
+
|
113
|
+
# Rate limiting sets the maximum bandwidth in bytes per second to use
|
114
|
+
# for fetching packages. Syntax is fully defined in 'man wget'.
|
115
|
+
# Use 'k' or 'm' to use kilobits or megabits / second: eg, 'limit=25k'.
|
116
|
+
# Use 0 or a negative value for no rate limiting.
|
117
|
+
limit=0
|
118
|
+
|
119
|
+
# Debug mode makes apt-cacher spew a lot of extra debug junk to the
|
120
|
+
# error log (whose location is defined with the 'logdir' directive).
|
121
|
+
# Leave this off unless you need it, or your error log will get very
|
122
|
+
# big. Acceptable values are 0 or 1.
|
123
|
+
debug=0
|
124
|
+
|
125
|
+
# Adapt the line in the usage info web page to match your server configuration
|
126
|
+
# example_sources_line=deb http://<b>my.cacher.server:3142/</b>ftp.au.debian.org/debian unstable main contrib non-free
|
127
|
+
|
128
|
+
# Print a 410 (Gone) HTTP message with the specified text when accessed via
|
129
|
+
# CGI. Useful to tell users to adapt their sources.list files when the
|
130
|
+
# apt-cacher server is beeing relocated (via apt-get's error messages while
|
131
|
+
# running "update")
|
132
|
+
#cgi_advise_to_use = Please use http://cacheserver:3142/ as apt-cacher access URL
|
133
|
+
#cgi_advise_to_use = Server relocated. To change sources.list, run perl -pe "s,/apt-cacher\??,:3142," -i /etc/apt/sources.list
|
134
|
+
|
135
|
+
# Server mapping - this allows to hide real server names behind virtual paths
|
136
|
+
# that appear in the access URL. This method is known from apt-proxy. This is
|
137
|
+
# also the only method to use FTP access to the target hosts. The syntax is simple, the part of the beginning to replace, followed by a list of mirror urls, all space separated. Multiple profile are separated by semicolons
|
138
|
+
# path_map = debian ftp.uni-kl.de/pub/linux/debian ftp2.de.debian.org/debian ; ubuntu archive.ubuntu.com/ubuntu ; security security.debian.org/debian-security ftp2.de.debian.org/debian-security
|
139
|
+
# Note that you need to specify all target servers in the allowed_locations
|
140
|
+
# options if you make use of it. Also note that the paths should not overlap
|
141
|
+
# each other. FTP access method not supported yet, maybe in the future.
|
142
|
+
|
143
|
+
# extra setting from apt-proxy configuration
|
144
|
+
path_map = ubuntu us.archive.ubuntu.com/ubuntu ; ubuntu-security security.ubuntu.com/ubuntu ; debian debian.osuosl.org/debian/ ; security security.debian.org/debian-security
|
@@ -0,0 +1,50 @@
|
|
1
|
+
[DEFAULT]
|
2
|
+
;; All times are in seconds, but you can add a suffix
|
3
|
+
;; for minutes(m), hours(h) or days(d)
|
4
|
+
|
5
|
+
;; commented out address so apt-proxy will listen on all IPs
|
6
|
+
;; address = 127.0.0.1
|
7
|
+
port = 9999
|
8
|
+
cache_dir = /var/cache/apt-proxy
|
9
|
+
|
10
|
+
;; Control files (Packages/Sources/Contents) refresh rate
|
11
|
+
min_refresh_delay = 1s
|
12
|
+
complete_clientless_downloads = 1
|
13
|
+
|
14
|
+
;; Debugging settings.
|
15
|
+
debug = all:4 db:0
|
16
|
+
|
17
|
+
time = 30
|
18
|
+
passive_ftp = on
|
19
|
+
|
20
|
+
;;--------------------------------------------------------------
|
21
|
+
;; Cache housekeeping
|
22
|
+
|
23
|
+
cleanup_freq = 1d
|
24
|
+
max_age = 120d
|
25
|
+
max_versions = 3
|
26
|
+
|
27
|
+
;;---------------------------------------------------------------
|
28
|
+
;; Backend servers
|
29
|
+
;;
|
30
|
+
;; Place each server in its own [section]
|
31
|
+
|
32
|
+
[ubuntu]
|
33
|
+
; Ubuntu archive
|
34
|
+
backends =
|
35
|
+
http://us.archive.ubuntu.com/ubuntu
|
36
|
+
|
37
|
+
[ubuntu-security]
|
38
|
+
; Ubuntu security updates
|
39
|
+
backends = http://security.ubuntu.com/ubuntu
|
40
|
+
|
41
|
+
[debian]
|
42
|
+
;; Backend servers, in order of preference
|
43
|
+
backends =
|
44
|
+
http://debian.osuosl.org/debian/
|
45
|
+
|
46
|
+
[security]
|
47
|
+
;; Debian security archive
|
48
|
+
backends =
|
49
|
+
http://security.debian.org/debian-security
|
50
|
+
http://ftp2.de.debian.org/debian-security
|
@@ -0,0 +1,34 @@
|
|
1
|
+
{
|
2
|
+
"name": "apt",
|
3
|
+
"description": "Configures apt and apt services and an LWRP for managing apt repositories",
|
4
|
+
"long_description": "Description\n===========\n\nThis 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.\n\nRecipes\n=======\n\ndefault\n-------\n\nThis recipe installs the `update-notifier-common` package to provide the timestamp file used to only run `apt-get update` if the cache is less than one day old.\n\nThis recipe should appear first in the run list of Debian or Ubuntu nodes to ensure that the package cache is up to date before managing any `package` resources with Chef.\n\nThis recipe also sets up a local cache directory for preseeding packages.\n\ncacher\n------\n\nInstalls 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.\n\ncacher-client\n-------------\nConfigures the node to use the apt-cacher server as a client.\n\nResources/Providers\n===================\n\nThis LWRP provides an easy way to manage additional APT repositories. Adding a new repository will notify running the `execute[apt-get-update]` resource.\n\n# Actions\n\n- :add: creates a repository file and builds the repository listing\n- :remove: removes the repository file\n\n# Attribute Parameters\n\n- repo_name: name attribute. The name of the channel to discover\n- uri: the base of the Debian distribution\n- distribution: this is usually your release's codename...ie something like `karmic`, `lucid` or `maverick`\n- components: package groupings..when it doubt use `main`\n- deb_src: whether or not to add the repository as a source repo as well\n- key_server: the GPG keyserver where the key for the repo should be retrieved\n- key: if a `key_server` is provided, this is assumed to be the fingerprint, otherwise it is the URI to the GPG key for the repo\n\n# Examples\n\n # add the Zenoss repo\n apt_repository \"zenoss\" do\n uri \"http://dev.zenoss.org/deb\"\n components [\"main\",\"stable\"]\n action :add\n end\n \n # add the Nginx PPA; grab key from keyserver\n apt_repository \"nginx-php\" do\n uri \"http://ppa.launchpad.net/nginx/php5/ubuntu\"\n distribution node['lsb']['codename']\n components [\"main\"]\n keyserver \"keyserver.ubuntu.com\"\n key \"C300EE8C\"\n action :add\n end\n \n # add the Cloudkick Repo\n apt_repository \"cloudkick\" do\n uri \"http://packages.cloudkick.com/ubuntu\"\n distribution node['lsb']['codename']\n components [\"main\"]\n key \"http://packages.cloudkick.com/cloudkick.packages.key\"\n action :add\n end\n \n # remove Zenoss repo\n apt_repository \"zenoss\" do\n action :remove\n end\n \nUsage\n=====\n\nPut `recipe[apt]` first in the run list. If you have other recipes that you want to use to configure how apt behaves, like new sources, notify the execute resource to run, e.g.:\n\n template \"/etc/apt/sources.list.d/my_apt_sources.list\" do\n notifies :run, resources(:execute => \"apt-get update\"), :immediately\n end\n\nThe 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.\n\nPut `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.\n\nChanges\n=======\n\n## v1.2.0:\n\n* COOK-136: Limit apt-get update to one run per day unless notified.\n* COOK-471: ignore failure on apt-get update\n* COOK-533: add support for deb and `deb_src` repos with `apt_repository`\n\nLicense and Author\n==================\n\nAuthor:: Joshua Timberman (<joshua@opscode.com>)\nAuthor:: Matt Ray (<matt@opscode.com>)\nAuthor:: Seth Chisamore (<schisamo@opscode.com>)\n\nCopyright 2009-2011 Opscode, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n",
|
5
|
+
"maintainer": "Opscode, Inc.",
|
6
|
+
"maintainer_email": "cookbooks@opscode.com",
|
7
|
+
"license": "Apache 2.0",
|
8
|
+
"platforms": {
|
9
|
+
"ubuntu": ">= 0.0.0",
|
10
|
+
"debian": ">= 0.0.0"
|
11
|
+
},
|
12
|
+
"dependencies": {
|
13
|
+
},
|
14
|
+
"recommendations": {
|
15
|
+
},
|
16
|
+
"suggestions": {
|
17
|
+
},
|
18
|
+
"conflicting": {
|
19
|
+
},
|
20
|
+
"providing": {
|
21
|
+
},
|
22
|
+
"replacing": {
|
23
|
+
},
|
24
|
+
"attributes": {
|
25
|
+
},
|
26
|
+
"groupings": {
|
27
|
+
},
|
28
|
+
"recipes": {
|
29
|
+
"apt": "Runs apt-get update during compile phase and sets up preseed directories",
|
30
|
+
"apt::cacher": "Set up an APT cache",
|
31
|
+
"apt::cacher-client": "Client for the apt::cacher server"
|
32
|
+
},
|
33
|
+
"version": "1.2.0"
|
34
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
maintainer "Opscode, Inc."
|
2
|
+
maintainer_email "cookbooks@opscode.com"
|
3
|
+
license "Apache 2.0"
|
4
|
+
description "Configures apt and apt services and an LWRP for managing apt repositories"
|
5
|
+
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
6
|
+
version "1.2.0"
|
7
|
+
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"
|
10
|
+
|
11
|
+
%w{ ubuntu debian }.each do |os|
|
12
|
+
supports os
|
13
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: apt
|
3
|
+
# Provider:: repository
|
4
|
+
#
|
5
|
+
# Copyright 2010-2011, Opscode, Inc.
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
action :add do
|
21
|
+
unless ::File.exists?("/etc/apt/sources.list.d/#{new_resource.repo_name}-source.list")
|
22
|
+
Chef::Log.info "Adding #{new_resource.repo_name} repository to /etc/apt/sources.list.d/#{new_resource.repo_name}-source.list"
|
23
|
+
# add key
|
24
|
+
if new_resource.keyserver && new_resource.key
|
25
|
+
execute "install-key #{new_resource.key}" do
|
26
|
+
command "apt-key adv --keyserver #{new_resource.keyserver} --recv #{new_resource.key}"
|
27
|
+
action :nothing
|
28
|
+
end.run_action(:run)
|
29
|
+
elsif new_resource.key && (new_resource.key =~ /http/)
|
30
|
+
key_name = new_resource.key.split(/\//).last
|
31
|
+
remote_file "#{Chef::Config[:file_cache_path]}/#{key_name}" do
|
32
|
+
source new_resource.key
|
33
|
+
mode "0644"
|
34
|
+
action :nothing
|
35
|
+
end.run_action(:create_if_missing)
|
36
|
+
execute "install-key #{key_name}" do
|
37
|
+
command "apt-key add #{Chef::Config[:file_cache_path]}/#{key_name}"
|
38
|
+
action :nothing
|
39
|
+
end.run_action(:run)
|
40
|
+
end
|
41
|
+
# build our listing
|
42
|
+
repository = "deb"
|
43
|
+
repository = "deb-src" if new_resource.deb_src
|
44
|
+
repository = "# Created by the Chef apt_repository LWRP\n" + repository
|
45
|
+
repository += " #{new_resource.uri}"
|
46
|
+
repository += " #{new_resource.distribution}"
|
47
|
+
new_resource.components.each {|component| repository += " #{component}"}
|
48
|
+
# write out the file, replace it if it already exists
|
49
|
+
file "/etc/apt/sources.list.d/#{new_resource.repo_name}-source.list" do
|
50
|
+
owner "root"
|
51
|
+
group "root"
|
52
|
+
mode 0644
|
53
|
+
content repository + "\n"
|
54
|
+
action :nothing
|
55
|
+
end.run_action(:create)
|
56
|
+
execute "update package index" do
|
57
|
+
command "apt-get update"
|
58
|
+
ignore_failure true
|
59
|
+
action :nothing
|
60
|
+
end.run_action(:run)
|
61
|
+
new_resource.updated_by_last_action(true)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
action :remove do
|
66
|
+
if ::File.exists?("/etc/apt/sources.list.d/#{new_resource.repo_name}-source.list")
|
67
|
+
Chef::Log.info "Removing #{new_resource.repo_name} repository from /etc/apt/sources.list.d/"
|
68
|
+
file "/etc/apt/sources.list.d/#{new_resource.repo_name}-source.list" do
|
69
|
+
action :delete
|
70
|
+
end
|
71
|
+
new_resource.updated_by_last_action(true)
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: apt
|
3
|
+
# Recipe:: cacher-client
|
4
|
+
#
|
5
|
+
# Copyright 2011, Opscode, Inc.
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
#remove Acquire::http::Proxy lines from /etc/apt/apt.conf since we use 01proxy
|
21
|
+
#these are leftover from preseed installs
|
22
|
+
execute "Remove proxy from /etc/apt/apt.conf" do
|
23
|
+
command "sed --in-place '/^Acquire::http::Proxy/d' /etc/apt/apt.conf"
|
24
|
+
only_if "grep Acquire::http::Proxy /etc/apt/apt.conf"
|
25
|
+
end
|
26
|
+
|
27
|
+
servers = search(:node, 'recipes:apt\:\:cacher') || []
|
28
|
+
if servers.length > 0
|
29
|
+
Chef::Log.info("apt-cacher server found on #{servers[0]}.")
|
30
|
+
proxy = "Acquire::http::Proxy \"http://#{servers[0].ipaddress}:3142\";\n"
|
31
|
+
file "/etc/apt/apt.conf.d/01proxy" do
|
32
|
+
owner "root"
|
33
|
+
group "root"
|
34
|
+
mode "0644"
|
35
|
+
content proxy
|
36
|
+
action :create
|
37
|
+
end
|
38
|
+
else
|
39
|
+
Chef::Log.info("No apt-cacher server found.")
|
40
|
+
file "/etc/apt/apt.conf.d/01proxy" do
|
41
|
+
action :delete
|
42
|
+
only_if {File.exists?("/etc/apt/apt.conf.d/01proxy")}
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: apt
|
3
|
+
# Recipe:: cacher
|
4
|
+
#
|
5
|
+
# Copyright 2008-2011, Opscode, Inc.
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
package "apt-cacher" do
|
20
|
+
action :install
|
21
|
+
end
|
22
|
+
|
23
|
+
service "apt-cacher" do
|
24
|
+
supports :restart => true, :status => false
|
25
|
+
action [ :enable, :start ]
|
26
|
+
end
|
27
|
+
|
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
|
+
|
44
|
+
#this will help seed the proxy
|
45
|
+
include_recipe "apt::cacher-client"
|
@@ -0,0 +1,50 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: apt
|
3
|
+
# Recipe:: default
|
4
|
+
#
|
5
|
+
# Copyright 2008-2011, Opscode, Inc.
|
6
|
+
# Copyright 2009, Bryan McLellan <btm@loftninjas.org>
|
7
|
+
#
|
8
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
# you may not use this file except in compliance with the License.
|
10
|
+
# You may obtain a copy of the License at
|
11
|
+
#
|
12
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
#
|
14
|
+
# Unless required by applicable law or agreed to in writing, software
|
15
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
# See the License for the specific language governing permissions and
|
18
|
+
# limitations under the License.
|
19
|
+
#
|
20
|
+
|
21
|
+
# Run apt-get update to create the stamp file
|
22
|
+
execute "apt-get-update" do
|
23
|
+
command "apt-get update"
|
24
|
+
ignore_failure true
|
25
|
+
not_if do ::File.exists?('/var/lib/apt/periodic/update-success-stamp') end
|
26
|
+
action :nothing
|
27
|
+
end
|
28
|
+
|
29
|
+
# provides /var/lib/apt/periodic/update-success-stamp on apt-get update
|
30
|
+
package "update-notifier-common" do
|
31
|
+
notifies :run, resources(:execute => "apt-get-update"), :immediately
|
32
|
+
end
|
33
|
+
|
34
|
+
execute "apt-get-update-periodic" do
|
35
|
+
command "apt-get update"
|
36
|
+
ignore_failure true
|
37
|
+
only_if do
|
38
|
+
File.exists?('/var/lib/apt/periodic/update-success-stamp') &&
|
39
|
+
File.mtime('/var/lib/apt/periodic/update-success-stamp') < Time.now - 86400
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
%w{/var/cache/local /var/cache/local/preseeding}.each do |dirname|
|
44
|
+
directory dirname do
|
45
|
+
owner "root"
|
46
|
+
group "root"
|
47
|
+
mode 0644
|
48
|
+
action :create
|
49
|
+
end
|
50
|
+
end
|