rails-up 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. data/LICENSE.txt +20 -0
  2. data/README.rdoc +14 -0
  3. data/Rakefile +42 -0
  4. data/VERSION +1 -0
  5. data/bin/rails-up +14 -0
  6. data/lib/rails-up.rb +0 -0
  7. data/templates/Vagrantfile +56 -0
  8. data/templates/chef/cookbooks/application/recipes/application.rb +17 -0
  9. data/templates/chef/cookbooks/application/recipes/database.rb +12 -0
  10. data/templates/chef/cookbooks/application/recipes/user.rb +7 -0
  11. data/templates/chef/cookbooks/application/templates/default/application.init.erb +93 -0
  12. data/templates/chef/cookbooks/apt/README.md +109 -0
  13. data/templates/chef/cookbooks/apt/files/default/apt-cacher +9 -0
  14. data/templates/chef/cookbooks/apt/files/default/apt-cacher.conf +144 -0
  15. data/templates/chef/cookbooks/apt/files/default/apt-proxy-v2.conf +50 -0
  16. data/templates/chef/cookbooks/apt/metadata.json +38 -0
  17. data/templates/chef/cookbooks/apt/metadata.rb +13 -0
  18. data/templates/chef/cookbooks/apt/providers/repository.rb +72 -0
  19. data/templates/chef/cookbooks/apt/recipes/cacher-client.rb +37 -0
  20. data/templates/chef/cookbooks/apt/recipes/cacher.rb +45 -0
  21. data/templates/chef/cookbooks/apt/recipes/default.rb +33 -0
  22. data/templates/chef/cookbooks/apt/resources/repository.rb +30 -0
  23. data/templates/chef/cookbooks/build-essential/README.md +24 -0
  24. data/templates/chef/cookbooks/build-essential/metadata.json +35 -0
  25. data/templates/chef/cookbooks/build-essential/metadata.rb +10 -0
  26. data/templates/chef/cookbooks/build-essential/recipes/default.rb +45 -0
  27. data/templates/chef/cookbooks/imagemagick/README.rdoc +37 -0
  28. data/templates/chef/cookbooks/imagemagick/metadata.json +46 -0
  29. data/templates/chef/cookbooks/imagemagick/metadata.rb +13 -0
  30. data/templates/chef/cookbooks/imagemagick/recipes/default.rb +25 -0
  31. data/templates/chef/cookbooks/imagemagick/recipes/rmagick.rb +33 -0
  32. data/templates/chef/cookbooks/nginx/README.md +76 -0
  33. data/templates/chef/cookbooks/nginx/attributes/default.rb +35 -0
  34. data/templates/chef/cookbooks/nginx/definitions/nginx_site.rb +35 -0
  35. data/templates/chef/cookbooks/nginx/files/default/mime.types +73 -0
  36. data/templates/chef/cookbooks/nginx/metadata.json +255 -0
  37. data/templates/chef/cookbooks/nginx/metadata.rb +86 -0
  38. data/templates/chef/cookbooks/nginx/recipes/default.rb +56 -0
  39. data/templates/chef/cookbooks/nginx/recipes/source.rb +143 -0
  40. data/templates/chef/cookbooks/nginx/templates/default/default-site.erb +33 -0
  41. data/templates/chef/cookbooks/nginx/templates/default/nginx.conf.erb +40 -0
  42. data/templates/chef/cookbooks/nginx/templates/default/nginx.init.erb +92 -0
  43. data/templates/chef/cookbooks/nginx/templates/default/nginx.sysconfig.erb +1 -0
  44. data/templates/chef/cookbooks/nginx/templates/default/nxdissite.erb +29 -0
  45. data/templates/chef/cookbooks/nginx/templates/default/nxensite.erb +38 -0
  46. data/templates/chef/cookbooks/nginx/templates/default/sv-nginx-log-run.erb +2 -0
  47. data/templates/chef/cookbooks/nginx/templates/default/sv-nginx-run.erb +3 -0
  48. data/templates/chef/cookbooks/postgresql/attributes/server.rb +44 -0
  49. data/templates/chef/cookbooks/postgresql/libraries/database.rb +18 -0
  50. data/templates/chef/cookbooks/postgresql/providers/database.rb +21 -0
  51. data/templates/chef/cookbooks/postgresql/recipes/client.rb +15 -0
  52. data/templates/chef/cookbooks/postgresql/recipes/default.rb +1 -0
  53. data/templates/chef/cookbooks/postgresql/recipes/server.rb +78 -0
  54. data/templates/chef/cookbooks/postgresql/resources/database.rb +10 -0
  55. data/templates/chef/cookbooks/postgresql/templates/default/grants.sql.erb +7 -0
  56. data/templates/chef/cookbooks/postgresql/templates/default/pg_hba.conf.erb +86 -0
  57. data/templates/chef/cookbooks/postgresql/templates/default/postgresql.conf.erb +504 -0
  58. data/templates/chef/cookbooks/redis/attributes/redis.rb +23 -0
  59. data/templates/chef/cookbooks/redis/metadata.json +279 -0
  60. data/templates/chef/cookbooks/redis/metadata.rb +98 -0
  61. data/templates/chef/cookbooks/redis/recipes/source.rb +102 -0
  62. data/templates/chef/cookbooks/redis/templates/default/redis.conf.erb +192 -0
  63. data/templates/chef/cookbooks/redis/templates/default/redis.init.erb +54 -0
  64. data/templates/chef/cookbooks/runit/attributes/default.rb +31 -0
  65. data/templates/chef/cookbooks/runit/definitions/runit_service.rb +159 -0
  66. data/templates/chef/cookbooks/runit/files/default/runit.seed +1 -0
  67. data/templates/chef/cookbooks/runit/files/default/runsvdir +0 -0
  68. data/templates/chef/cookbooks/runit/files/ubuntu-6.10/runsvdir +6 -0
  69. data/templates/chef/cookbooks/runit/files/ubuntu-7.04/runsvdir +7 -0
  70. data/templates/chef/cookbooks/runit/files/ubuntu-7.10/runsvdir +7 -0
  71. data/templates/chef/cookbooks/runit/files/ubuntu-8.04/runsvdir +7 -0
  72. data/templates/chef/cookbooks/runit/metadata.json +108 -0
  73. data/templates/chef/cookbooks/runit/metadata.rb +37 -0
  74. data/templates/chef/cookbooks/runit/recipes/default.rb +72 -0
  75. data/templates/chef/cookbooks/runit/templates/gentoo/runit-start.sh.erb +32 -0
  76. data/templates/chef/cookbooks/rvm/.gitignore +2 -0
  77. data/templates/chef/cookbooks/rvm/CHANGELOG.md +67 -0
  78. data/templates/chef/cookbooks/rvm/README.md +582 -0
  79. data/templates/chef/cookbooks/rvm/Rakefile +35 -0
  80. data/templates/chef/cookbooks/rvm/attributes/.gitkeep +0 -0
  81. data/templates/chef/cookbooks/rvm/attributes/default.rb +53 -0
  82. data/templates/chef/cookbooks/rvm/attributes/gem_package.rb +23 -0
  83. data/templates/chef/cookbooks/rvm/attributes/vagrant.rb +22 -0
  84. data/templates/chef/cookbooks/rvm/libraries/gem_package_monkeypatch.rb +34 -0
  85. data/templates/chef/cookbooks/rvm/libraries/helpers.rb +336 -0
  86. data/templates/chef/cookbooks/rvm/libraries/rvm_chef_shell_wrapper.rb +110 -0
  87. data/templates/chef/cookbooks/rvm/libraries/rvm_rubygems_package.rb +134 -0
  88. data/templates/chef/cookbooks/rvm/metadata.json +260 -0
  89. data/templates/chef/cookbooks/rvm/metadata.rb +99 -0
  90. data/templates/chef/cookbooks/rvm/providers/default_ruby.rb +46 -0
  91. data/templates/chef/cookbooks/rvm/providers/environment.rb +50 -0
  92. data/templates/chef/cookbooks/rvm/providers/gemset.rb +135 -0
  93. data/templates/chef/cookbooks/rvm/providers/global_gem.rb +99 -0
  94. data/templates/chef/cookbooks/rvm/providers/ruby.rb +100 -0
  95. data/templates/chef/cookbooks/rvm/providers/shell.rb +68 -0
  96. data/templates/chef/cookbooks/rvm/providers/wrapper.rb +58 -0
  97. data/templates/chef/cookbooks/rvm/recipes/.gitkeep +0 -0
  98. data/templates/chef/cookbooks/rvm/recipes/default.rb +72 -0
  99. data/templates/chef/cookbooks/rvm/recipes/gem_package.rb +30 -0
  100. data/templates/chef/cookbooks/rvm/recipes/system.rb +117 -0
  101. data/templates/chef/cookbooks/rvm/recipes/vagrant.rb +30 -0
  102. data/templates/chef/cookbooks/rvm/resources/default_ruby.rb +29 -0
  103. data/templates/chef/cookbooks/rvm/resources/environment.rb +29 -0
  104. data/templates/chef/cookbooks/rvm/resources/gem.rb +36 -0
  105. data/templates/chef/cookbooks/rvm/resources/gemset.rb +30 -0
  106. data/templates/chef/cookbooks/rvm/resources/global_gem.rb +33 -0
  107. data/templates/chef/cookbooks/rvm/resources/ruby.rb +29 -0
  108. data/templates/chef/cookbooks/rvm/resources/shell.rb +40 -0
  109. data/templates/chef/cookbooks/rvm/resources/wrapper.rb +32 -0
  110. data/templates/chef/cookbooks/rvm/templates/default/rvmrc.erb +14 -0
  111. data/templates/chef/cookbooks/rvm/templates/default/vagrant-chef-solo-wrapper.erb +23 -0
  112. data/templates/chef/cookbooks/varnish/attributes/varnish.rb +5 -0
  113. data/templates/chef/cookbooks/varnish/metadata.json +43 -0
  114. data/templates/chef/cookbooks/varnish/metadata.rb +9 -0
  115. data/templates/chef/cookbooks/varnish/recipes/default.rb +30 -0
  116. data/templates/chef/roles/application.rb +2 -0
  117. data/templates/chef/roles/base.rb +2 -0
  118. data/templates/chef/roles/database.rb +2 -0
  119. data/templates/chef/roles/nginx.rb +2 -0
  120. data/templates/chef/roles/redis.rb +2 -0
  121. data/templates/chef/roles/varnish.rb +2 -0
  122. metadata +209 -0
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Russ Smith
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,14 @@
1
+ = rails-up
2
+
3
+ = Install VirtualBox
4
+
5
+ Instructions for that can be found at: http://www.virtualbox.org/wiki/Downloads
6
+
7
+ = Install vagrant and rails-up into your application
8
+
9
+ gem install vagrant
10
+ vagrant box add base http://files.vagrantup.com/lucid32.box
11
+
12
+ gem install rails-up
13
+ rails-up
14
+ vagrant up
@@ -0,0 +1,42 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'rake'
5
+
6
+ require 'jeweler'
7
+ Jeweler::Tasks.new do |gem|
8
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
9
+ gem.name = "rails-up"
10
+ gem.homepage = "http://github.com/russ/rails-up"
11
+ gem.license = "MIT"
12
+ gem.summary = %Q{Automatic vagrant box for your rails project.}
13
+ gem.description = %Q{Automatic vagrant box for your rails project.}
14
+ gem.email = "russ@bashme.org"
15
+ gem.authors = ["Russ Smith"]
16
+ # Include your dependencies below. Runtime dependencies are required when using your gem,
17
+ # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
18
+ # gem.add_runtime_dependency 'jabber4r', '> 0.1'
19
+ # Include your dependencies below. Runtime dependencies are required when using your gem,
20
+ # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
21
+ # gem.add_runtime_dependency 'jabber4r', '> 0.1'
22
+ gem.add_development_dependency "bundler", "~> 1.0.0"
23
+ # Include your dependencies below. Runtime dependencies are required when using your gem,
24
+ # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
25
+ # gem.add_runtime_dependency 'jabber4r', '> 0.1'
26
+ gem.add_development_dependency "jeweler", "~> 1.6.0"
27
+ # Include your dependencies below. Runtime dependencies are required when using your gem,
28
+ # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
29
+ # gem.add_runtime_dependency 'jabber4r', '> 0.1'
30
+ gem.add_development_dependency "rcov", ">= 0"
31
+ end
32
+ Jeweler::RubygemsDotOrgTasks.new
33
+
34
+ require 'rake/rdoctask'
35
+ Rake::RDocTask.new do |rdoc|
36
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
37
+
38
+ rdoc.rdoc_dir = 'rdoc'
39
+ rdoc.title = "rails-up #{version}"
40
+ rdoc.rdoc_files.include('README*')
41
+ rdoc.rdoc_files.include('lib/**/*.rb')
42
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "rubygems"
4
+ require "fileutils"
5
+
6
+ puts "Created: Vagrantfile"
7
+ FileUtils.cp(
8
+ File.join(File.dirname(__FILE__), "../templates/Vagrantfile"),
9
+ File.join(FileUtils.pwd, "Vagrantfile"))
10
+
11
+ puts "Created: chef/"
12
+ FileUtils.cp_r(
13
+ File.join(File.dirname(__FILE__), "../templates/chef"),
14
+ File.join(FileUtils.pwd, "chef"))
File without changes
@@ -0,0 +1,56 @@
1
+ Vagrant::Config.run do |config|
2
+ config.vm.box = "base"
3
+ config.vm.network("33.33.33.10")
4
+ config.vm.forward_port("web", 80, 5678)
5
+ config.vm.customize do |vm|
6
+ vm.name = "application"
7
+ vm.memory_size = 768
8
+ end
9
+
10
+ # Share the WWW folder as the main folder for the web VM using NFS
11
+ config.vm.share_folder("v-root", "/vagrant", ".", :nfs => true)
12
+ config.vm.share_folder("cookbooks", "/var/chef", ".", :nfs => true)
13
+
14
+ # Configure to provision with local cookbooks
15
+ config.vm.provision :chef_solo do |chef|
16
+ chef.json.merge!({
17
+ :rvm => {
18
+ :rubies => [ "ruby-1.9.2" ],
19
+ :default_ruby => "ruby-1.9.2",
20
+ :group_users => [ "vagrant", "application" ],
21
+ :global_gems => [
22
+ { :name => "bundler" }
23
+ ],
24
+ :rvmrc => {
25
+ :rvm_gemset_create_on_use_flag => 1,
26
+ :rvm_trust_rvmrcs_flag => 1
27
+ }
28
+ },
29
+ :postgresql => {
30
+ :server_root_password => "application",
31
+ },
32
+ :application => {
33
+ :application_name => "application",
34
+ :application_root => "/vagrant",
35
+ :rails_env => "development"
36
+ },
37
+ :apps => {
38
+ :application => {
39
+ :database => {
40
+ :name => "application",
41
+ :username => "application",
42
+ :password => "application",
43
+ }
44
+ }
45
+ }
46
+ })
47
+
48
+ chef.roles_path = "chef/roles"
49
+ chef.cookbooks_path = "chef/cookbooks"
50
+ chef.add_role "base"
51
+ chef.add_role "database"
52
+ chef.add_role "redis"
53
+ chef.add_role "application"
54
+ chef.add_role "nginx"
55
+ end
56
+ end
@@ -0,0 +1,17 @@
1
+ template "/etc/init.d/application" do
2
+ source "application.init.erb"
3
+ mode 0755
4
+ backup false
5
+ end
6
+
7
+ bash "Bundling the application" do
8
+ user "application"
9
+ cwd "/vagrant"
10
+ code "rvm exec bundle --deployment"
11
+ end
12
+
13
+ service "application" do
14
+ supports :start => true, :stop => true, :restart => true
15
+ action [ :enable, :start ]
16
+ subscribes :restart, resources(:template => "/etc/init.d/application")
17
+ end
@@ -0,0 +1,12 @@
1
+ node[:apps].each do |name, values|
2
+ postgresql_database values[:database][:name] do
3
+ host "localhost"
4
+ port 5432
5
+ username "postgres"
6
+ password node[:postgresql][:server_root_password]
7
+ database values[:database][:name]
8
+ database_user values[:database][:username]
9
+ database_password values[:database][:password]
10
+ action :create_db
11
+ end
12
+ end
@@ -0,0 +1,7 @@
1
+ user "application" do
2
+ username "application"
3
+ home "/home/application"
4
+ comment "application"
5
+ shell "/bin/bash"
6
+ supports :manage_home => true
7
+ end
@@ -0,0 +1,93 @@
1
+ #!/bin/bash
2
+ ### BEGIN INIT INFO
3
+ # Provides: APPLICATION
4
+ # Required-Start: $all
5
+ # Required-Stop: $network $local_fs $syslog
6
+ # Default-Start: 2 3 4 5
7
+ # Default-Stop: 0 1 6
8
+ # Short-Description: Start the APPLICATION unicorns at boot
9
+ # Description: Enable APPLICATION at boot time.
10
+ ### END INIT INFO
11
+ #
12
+ # Use this as a basis for your own Unicorn init script.
13
+ # Change APPLICATION to match your app.
14
+ # Make sure that all paths are correct.
15
+
16
+ set -u
17
+ set -e
18
+
19
+ # Change these to match your app:
20
+ APP_NAME=<%= @node[:application][:application_name] %>
21
+ APP_USER=<%= @node[:application][:application_name] %>
22
+ APP_ROOT=<%= @node[:application][:application_root] %>
23
+ PID="/tmp/unicorn.pid"
24
+ RAILS_ENV=<%= @node[:application][:rails_env] %>
25
+ CURRENT_USER=$(whoami)
26
+ SUDO_CMD=""
27
+
28
+ if [ "$CURRENT_USER" = "root" ] ; then
29
+ SUDO_CMD="sudo -u $APP_USER "
30
+ elif [ "$CURRENT_USER" != "$APP_USER" ] ; then
31
+ echo "Please run as user $APP_USER (or root)"
32
+ exit 1
33
+ fi
34
+
35
+ UNICORN_CMD="cd $APP_ROOT && RAILS_ENV=$RAILS_ENV bundle exec unicorn -D -E $RAILS_ENV -c $APP_ROOT/config/unicorn.vagrant.rb"
36
+
37
+ old_pid="$PID.oldbin"
38
+
39
+ cd $APP_ROOT || exit 1
40
+
41
+ sig () {
42
+ test -s "$PID" && kill -$1 $(cat $PID)
43
+ }
44
+
45
+ oldsig () {
46
+ test -s $old_pid && kill -$1 $(cat $old_pid)
47
+ }
48
+
49
+ workersig () {
50
+ workerpid="/$APP_ROOT/shared/pids/unicorn.$2.pid"
51
+
52
+ test -s "$workerpid" && kill -$1 `cat $workerpid`
53
+ }
54
+
55
+ case ${1-help} in
56
+ start)
57
+ sig 0 && echo >&2 "Already running" && exit 0
58
+ echo $SUDO_CMD bash -l -c "$UNICORN_CMD"
59
+ $SUDO_CMD bash -l -c "$UNICORN_CMD"
60
+ ;;
61
+ stop)
62
+ sig QUIT && exit 0
63
+ echo >&2 "Not running"
64
+ ;;
65
+ force-stop)
66
+ sig TERM && exit 0
67
+ echo >&2 "Not running"
68
+ ;;
69
+ restart|reload)
70
+ sig HUP && echo reloaded OK && exit 0
71
+ echo >&2 "Couldn't reload, starting '$UNICORN_CMD' instead"
72
+ echo $SUDO_CMD bash -l -c "$UNICORN_CMD"
73
+ $SUDO_CMD bash -l -c "$UNICORN_CMD"
74
+ ;;
75
+ upgrade)
76
+ sig USR2 && exit 0
77
+ echo >&2 "Couldn't upgrade, starting '$UNICORN_CMD' instead"
78
+ echo $SUDO_CMD bash -l -c "$UNICORN_CMD"
79
+ $SUDO_CMD bash -l -c "$UNICORN_CMD"
80
+ ;;
81
+ kill_worker)
82
+ workersig QUIT $2 && exit 0
83
+ echo >&2 "Worker not running"
84
+ ;;
85
+ rotate)
86
+ sig USR1 && echo rotated logs OK && exit 0
87
+ echo >&2 "Couldn't rotate logs" && exit 1
88
+ ;;
89
+ *)
90
+ echo >&2 "Usage: $0 <start|stop|restart|upgrade|rotate|force-stop>"
91
+ exit 1
92
+ ;;
93
+ esac
@@ -0,0 +1,109 @@
1
+ Description
2
+ ===========
3
+
4
+ Configures various APT components on Debian-like systems. Also includes a LWRP.
5
+
6
+ Recipes
7
+ =======
8
+
9
+ default
10
+ -------
11
+ The default recipe runs apt-get update during the Compile Phase of the Chef run to ensure that the system's package cache is updated with the latest. It is recommended that this recipe appear first in a node's run list (directly or through a role) to ensure that when installing packages, Chef will be able to download the latest version available on the remote APT repository.
12
+
13
+ This recipe also sets up a local cache directory for preseeding packages.
14
+
15
+ cacher
16
+ ------
17
+ 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.
18
+
19
+ cacher-client
20
+ -------------
21
+ Configures the node to use the apt-cacher server as a client.
22
+
23
+ Resources/Providers
24
+ ===================
25
+
26
+ This LWRP provides an easy way to manage additional APT repositories.
27
+
28
+ # Actions
29
+
30
+ - :add: creates a repository file and builds the repository listing
31
+ - :remove: removes the repository file
32
+
33
+ # Attribute Parameters
34
+
35
+ - repo_name: name attribute. The name of the channel to discover
36
+ - uri: the base of the Debian distribution
37
+ - distribution: this is usually your release's codename...ie something like `karmic`, `lucid` or `maverick`
38
+ - components: package groupings..when it doubt use `main`
39
+ - deb_src: whether or not to add the repository as a source repo as well
40
+ - key_server: the GPG keyserver where the key for the repo should be retrieved
41
+ - 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
42
+
43
+ # Example
44
+
45
+ # add the Zenoss repo
46
+ apt_repository "zenoss" do
47
+ uri "http://dev.zenoss.org/deb"
48
+ components ["main","stable"]
49
+ action :add
50
+ end
51
+
52
+ # add the Nginx PPA; grab key from keyserver
53
+ apt_repository "nginx-php" do
54
+ uri "http://ppa.launchpad.net/nginx/php5/ubuntu"
55
+ distribution node['lsb']['codename']
56
+ components ["main"]
57
+ keyserver "keyserver.ubuntu.com"
58
+ key "C300EE8C"
59
+ action :add
60
+ end
61
+
62
+ # add the Cloudkick Repo
63
+ apt_repository "cloudkick" do
64
+ uri "http://packages.cloudkick.com/ubuntu"
65
+ distribution node['lsb']['codename']
66
+ components ["main"]
67
+ key "http://packages.cloudkick.com/cloudkick.packages.key"
68
+ action :add
69
+ end
70
+
71
+ # remove Zenoss repo
72
+ apt_repository "zenoss" do
73
+ action :remove
74
+ end
75
+
76
+ Usage
77
+ =====
78
+
79
+ Put `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.:
80
+
81
+ template "/etc/apt/sources.list.d/my_apt_sources.list" do
82
+ notifies :run, resources(:execute => "apt-get update"), :immediately
83
+ end
84
+
85
+ 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.
86
+
87
+ 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.
88
+
89
+ License and Author
90
+ ==================
91
+
92
+ Author:: Joshua Timberman (<joshua@opscode.com>)
93
+ Author:: Matt Ray (<matt@opscode.com>)
94
+ Author:: Seth Chisamore (<schisamo@opscode.com>)
95
+
96
+ Copyright 2009-2011 Opscode, Inc.
97
+
98
+ Licensed under the Apache License, Version 2.0 (the "License");
99
+ you may not use this file except in compliance with the License.
100
+ You may obtain a copy of the License at
101
+
102
+ http://www.apache.org/licenses/LICENSE-2.0
103
+
104
+ Unless required by applicable law or agreed to in writing, software
105
+ distributed under the License is distributed on an "AS IS" BASIS,
106
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
107
+ See the License for the specific language governing permissions and
108
+ limitations under the License.
109
+
@@ -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&nbsp;http://<b>my.cacher.server:3142/</b>ftp.au.debian.org/debian&nbsp;unstable&nbsp;main&nbsp;contrib&nbsp;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