rubber 2.1.2 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. data/.travis.yml +2 -4
  2. data/CHANGELOG +98 -0
  3. data/LICENSE +10 -336
  4. data/lib/rubber/cloud/aws.rb +8 -8
  5. data/lib/rubber/commands/cron.rb +1 -1
  6. data/lib/rubber/commands/util.rb +46 -0
  7. data/lib/rubber/encryption.rb +46 -0
  8. data/lib/rubber/environment.rb +24 -5
  9. data/lib/rubber/recipes/rubber.rb +1 -1
  10. data/lib/rubber/recipes/rubber/instances.rb +97 -37
  11. data/lib/rubber/recipes/rubber/setup.rb +9 -4
  12. data/lib/rubber/recipes/rubber/static_ips.rb +3 -2
  13. data/lib/rubber/version.rb +1 -1
  14. data/rubber.gemspec +1 -2
  15. data/templates/apache/config/rubber/rubber-apache.yml +2 -2
  16. data/templates/base/config/deploy.rb +1 -1
  17. data/templates/base/config/rubber/common/crontab +1 -3
  18. data/templates/base/config/rubber/common/gemrc +5 -0
  19. data/templates/base/config/rubber/common/rubber.profile +0 -3
  20. data/templates/base/config/rubber/common/ruby.profile +9 -0
  21. data/templates/base/config/rubber/deploy-setup.rb +45 -65
  22. data/templates/base/config/rubber/rubber-ruby.yml +21 -0
  23. data/templates/base/config/rubber/rubber.yml +8 -3
  24. data/templates/base/script/rubber +7 -3
  25. data/templates/collectd/config/rubber/role/passenger/collectd-passenger.rb.conf +2 -2
  26. data/templates/collectd/config/rubber/role/passenger/passenger-status-sudoers.conf +2 -2
  27. data/templates/complete_unicorn_nginx/config/rubber/rubber-complete.yml +2 -3
  28. data/templates/complete_unicorn_nginx/templates.yml +0 -1
  29. data/templates/elasticsearch/config/rubber/deploy-elasticsearch.rb +1 -1
  30. data/templates/elasticsearch/config/rubber/rubber-elasticsearch.yml +1 -1
  31. data/templates/graphite/config/rubber/deploy-graphite.rb +9 -52
  32. data/templates/graphite/config/rubber/role/graphite_server/carbon.conf +1 -1
  33. data/templates/graphite/config/rubber/role/graphite_server/graphite-collectd-ping.conf +11 -0
  34. data/templates/graphite/config/rubber/role/graphite_server/monit-graphite_server.conf +8 -0
  35. data/templates/graphite/config/rubber/role/graphite_web/graphite_web-upstart.conf +15 -0
  36. data/templates/graphite/config/rubber/role/graphite_web/monit-graphite_web.conf +7 -0
  37. data/templates/graphite/config/rubber/role/graphite_web/uwsgi.ini +16 -0
  38. data/templates/graphite/config/rubber/rubber-graphite.yml +6 -4
  39. data/templates/graphite/templates.yml +2 -0
  40. data/templates/mongrel/config/rubber/deploy-mongrel.rb +1 -1
  41. data/templates/monit/config/rubber/role/mongrel/monit-mongrel.conf +2 -2
  42. data/templates/munin/config/rubber/role/munin/munin-plugins.conf +3 -3
  43. data/templates/munin/config/rubber/role/passenger/munin-passenger-memory.conf +1 -1
  44. data/templates/munin/config/rubber/role/passenger/munin-passenger-sudoers.conf +2 -2
  45. data/templates/munin/config/rubber/role/passenger/munin-passenger.conf +1 -1
  46. data/templates/munin/config/rubber/role/passenger_nginx/munin-passenger-memory.conf +1 -1
  47. data/templates/munin/config/rubber/role/passenger_nginx/munin-passenger-sudoers.conf +2 -2
  48. data/templates/munin/config/rubber/role/passenger_nginx/munin-passenger.conf +1 -1
  49. data/templates/passenger/config/rubber/deploy-passenger.rb +5 -11
  50. data/templates/passenger/config/rubber/role/passenger/passenger-apache-vhost.conf +12 -0
  51. data/templates/passenger/config/rubber/rubber-passenger.yml +3 -3
  52. data/templates/passenger_nginx/config/rubber/role/passenger_nginx/nginx.conf +1 -1
  53. data/templates/passenger_nginx/config/rubber/rubber-passenger_nginx.yml +2 -2
  54. data/templates/postgresql/config/rubber/deploy-postgresql.rb +47 -0
  55. data/templates/redis/config/rubber/rubber-redis.yml +1 -1
  56. data/templates/resque/templates.yml +0 -1
  57. data/templates/sidekiq/config/rubber/deploy-sidekiq.rb +35 -0
  58. data/templates/sidekiq/config/rubber/role/sidekiq/monit-sidekiq.conf +10 -0
  59. data/templates/sidekiq/config/rubber/rubber-sidekiq.yml +2 -0
  60. data/templates/sidekiq/templates.rb +2 -0
  61. data/templates/sidekiq/templates.yml +4 -0
  62. data/templates/solr/config/rubber/common/solr_sunspot.yml +10 -0
  63. data/templates/solr/config/rubber/deploy-solr.rb +78 -0
  64. data/templates/solr/config/rubber/rubber-solr.yml +10 -0
  65. data/templates/solr/templates.yml +3 -0
  66. data/templates/sphinx/config/rubber/deploy-sphinx.rb +4 -4
  67. data/templates/torquebox/config/rubber/deploy-torquebox.rb +16 -4
  68. data/templates/torquebox/config/rubber/role/app/torquebox-apache-vhost.conf +15 -5
  69. data/templates/torquebox/config/rubber/role/torquebox/graylog-logging-module.xml +9 -0
  70. data/templates/torquebox/config/rubber/role/torquebox/standalone-ha.xml +25 -7
  71. data/templates/torquebox/config/rubber/role/torquebox/standalone.conf +2 -2
  72. data/templates/torquebox/config/rubber/rubber-torquebox.yml +6 -3
  73. data/templates/zookeeper/config/rubber/rubber-zookeeper.yml +1 -1
  74. data/test/command_test.rb +7 -5
  75. data/test/commands/cron_test.rb +22 -18
  76. data/test/commands/util_test.rb +40 -0
  77. data/test/encryption_test.rb +59 -0
  78. data/test/environment_test.rb +14 -0
  79. data/test/fixtures/obfuscated/rubber.yml +3 -0
  80. data/test/fixtures/obfuscated/secret.yml +1 -0
  81. metadata +33 -12
  82. data/templates/base/config/rubber/rubber-rvm.yml +0 -42
  83. data/templates/complete_passenger/templates.rb +0 -9
  84. data/templates/complete_passenger_nginx/templates.rb +0 -8
  85. data/templates/complete_unicorn_nginx/config/rubber/role/haproxy/haproxy-unicorn.conf +0 -21
  86. data/templates/complete_unicorn_nginx/templates.rb +0 -8
  87. data/templates/graphite/config/rubber/role/graphite_web/graphite-vhost.conf +0 -62
@@ -1,6 +1,6 @@
1
1
 
2
2
  roles:
3
3
  apache:
4
- packages: [apache2]
4
+ packages: [apache2, libapache2-mod-proxy-html, libcurl4-openssl-dev, libapache2-mod-xsendfile]
5
5
  web_tools:
6
- packages: [libapache2-mod-proxy-html]
6
+ packages: [apache2, libapache2-mod-proxy-html, libcurl4-openssl-dev, libapache2-mod-xsendfile]
@@ -6,7 +6,7 @@ on :load do
6
6
  set :application, rubber_env.app_name
7
7
  set :runner, rubber_env.app_user
8
8
  set :deploy_to, "/mnt/#{application}-#{Rubber.env}"
9
- set :copy_exclude, [".git/*", ".bundle/*", "log/*", ".rvmrc"]
9
+ set :copy_exclude, [".git/*", ".bundle/*", "log/*", ".rvmrc", ".rbenv-version"]
10
10
  end
11
11
 
12
12
  # Use a simple directory tree copy here to make demo easier.
@@ -4,9 +4,7 @@
4
4
 
5
5
  %>
6
6
 
7
- # cron clears out environment variables, but Rubber.root/script/rubber uses
8
- # "rvm do default" to run, so no longer any need to setup ruby env vars here,
9
- # all we need is PATH
7
+ # cron clears out environment variables. All we need is PATH.
10
8
  PATH=<%= ENV['PATH'] %>
11
9
 
12
10
  MAILTO=<%= rubber_env.admin_email %>
@@ -0,0 +1,5 @@
1
+ <%
2
+ @path = "/etc/gemrc"
3
+ %>
4
+ ---
5
+ gem: --no-ri --no-rdoc
@@ -8,6 +8,3 @@ export RUBBER_ENV=<%= Rubber.env %>
8
8
  export RAILS_ENV=<%= Rubber.env %>
9
9
  alias current="cd <%= current_path %>"
10
10
  alias release="cd <%= Rubber.root %>"
11
-
12
- # Always use rubygems
13
- export RUBYOPT="rubygems"
@@ -0,0 +1,9 @@
1
+ <%
2
+ @path = "/etc/profile.d/ruby.sh"
3
+ %>
4
+
5
+ # Always use rubygems.
6
+ export RUBYOPT="rubygems"
7
+
8
+ # Use the installed Ruby.
9
+ export PATH="<%= rubber_env.ruby_path %>/bin:$PATH"
@@ -1,83 +1,63 @@
1
1
  namespace :rubber do
2
2
  namespace :base do
3
-
3
+
4
4
  rubber.allow_optional_tasks(self)
5
5
 
6
- before "rubber:setup_gem_sources", "rubber:base:install_rvm"
7
- task :install_rvm do
8
- rubber.sudo_script "install_rvm", <<-ENDSCRIPT
9
- if [[ ! `rvm --version 2> /dev/null` =~ "#{rubber_env.rvm_version}" ]]; then
10
- cd /tmp
11
- curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer -o rvm-installer
12
- chmod +x rvm-installer
13
- rm -f /etc/rvmrc
14
- rvm_path=#{rubber_env.rvm_prefix} ./rvm-installer --version #{rubber_env.rvm_version}
6
+ before "rubber:setup_gem_sources", "rubber:base:install_ruby_build"
7
+ task :install_ruby_build do
8
+ rubber.sudo_script "install_ruby_build", <<-ENDSCRIPT
9
+ if [[ ! `ruby-build --version 2> /dev/null` =~ "#{rubber_env.ruby_build_version}" ]]; then
10
+ echo "Installing ruby-build v#{rubber_env.ruby_build_version}"
11
+ wget -q https://github.com/sstephenson/ruby-build/archive/v#{rubber_env.ruby_build_version}.tar.gz -O /tmp/ruby-build.tar.gz
15
12
 
16
- # Set up the rubygems version
17
- sed -i 's/rubygems_version=.*/rubygems_version=#{rubber_env.rubygems_version}/' #{rubber_env.rvm_prefix}/config/db
13
+ # Install ruby-build.
14
+ tar -C /tmp -zxf /tmp/ruby-build.tar.gz
15
+ cd /tmp/ruby-build-*
16
+ ./install.sh
18
17
 
19
- # Set up the rake version
20
- sed -i 's/rake.*/rake -v#{rubber_env.rake_version}/' #{rubber_env.rvm_prefix}/gemsets/default.gems
21
- sed -i 's/rake.*/rake -v#{rubber_env.rake_version}/' #{rubber_env.rvm_prefix}/gemsets/global.gems
18
+ # Clean up after ourselves.
19
+ cd /root
20
+ rm -rf /tmp/ruby-build-*
21
+ rm -f /tmp/ruby-build.tar.gz
22
22
 
23
- # Set up the .gemrc file
24
- if [[ ! -f ~/.gemrc ]]; then
25
- echo "--- " >> ~/.gemrc
26
- fi
23
+ # Get rid of RVM if this is an older rubber installation.
24
+ if type rvm &> /dev/null; then
25
+ rvm implode
27
26
 
28
- if ! grep -q 'gem: ' ~/.gemrc; then
29
- echo "gem: --no-ri --no-rdoc" >> ~/.gemrc
30
- fi
27
+ rm -rf /usr/local/rvm
28
+ rm -f /usr/bin/rvm*
29
+ rm -f ~/.gemrc
31
30
  fi
31
+ fi
32
32
  ENDSCRIPT
33
33
  end
34
34
 
35
- # ensure that the rvm profile script gets sourced by reconnecting
36
- after "rubber:base:install_rvm" do
37
- teardown_connections_to(sessions.keys)
38
- end
39
-
40
- after "rubber:base:install_rvm", "rubber:base:install_rvm_ruby"
41
- task :install_rvm_ruby do
42
- opts = get_host_options('rvm_ruby')
43
-
44
- # sudo_script only takes a single hash with host -> VAR, so combine our
45
- # two vars so we can extract them out in the bash script
46
- install_opts = get_host_options('rvm_install_options')
47
- install_opts.each do |k, v|
48
- opts[k] = "#{opts[k]} #{v}"
49
- end
50
-
51
- install_rvm_ruby_script = <<-ENDSCRIPT
52
- rvm_ver=$1
53
- shift
54
- install_opts=$*
55
-
56
- if [[ ! `rvm list default 2> /dev/null` =~ "$rvm_ver" ]]; then
57
- echo "RVM is compiling/installing ruby $rvm_ver, this may take a while"
58
-
59
- nohup rvm install $rvm_ver $install_opts &> /tmp/install_rvm_ruby.log &
60
- sleep 1
35
+ after "rubber:base:install_ruby_build", "rubber:base:install_ruby"
36
+ task :install_ruby do
37
+ rubber.sudo_script "install_ruby", <<-ENDSCRIPT
38
+ installed_ruby_ver=`which ruby | cut -d / -f 5`
39
+ desired_ruby_ver="#{rubber_env.ruby_version}"
40
+ if [[ ! $installed_ruby_ver =~ $desired_ruby_ver ]]; then
41
+ echo "Compiling and installing ruby $desired_ruby_ver. This may take a while ..."
61
42
 
62
- while true; do
63
- if ! ps ax | grep -q "[r]vm install"; then break; fi
64
- echo -n .
65
- sleep 5
66
- done
43
+ nohup ruby-build #{rubber_env.ruby_version} #{rubber_env.ruby_path} &> /tmp/install_ruby.log &
44
+ sleep 1
67
45
 
68
- # need to set default after using once or something in env is broken
69
- rvm use $rvm_ver &> /dev/null
70
- rvm use $rvm_ver --default
46
+ while true; do
47
+ if ! ps ax | grep -q "[r]uby-build"; then break; fi
48
+ echo -n .
49
+ sleep 5
50
+ done
71
51
 
72
- # Something flaky with $PATH having an entry for "bin" which breaks
73
- # munin, the below seems to fix it
74
- rvm use $rvm_ver
75
- rvm repair environments
76
- rvm use $rvm_ver
77
- fi
52
+ echo "export RUBYOPT=rubygems\nexport PATH=#{rubber_env.ruby_path}/bin:$PATH" > /etc/profile.d/ruby.sh
53
+ echo "--- \ngem: --no-ri --no-rdoc" > /etc/gemrc
54
+ fi
78
55
  ENDSCRIPT
79
- opts[:script_args] = '$CAPISTRANO:VAR$'
80
- rubber.sudo_script "install_rvm_ruby", install_rvm_ruby_script, opts
56
+ end
57
+
58
+ # ensure that the profile script gets sourced by reconnecting
59
+ after "rubber:base:install_ruby" do
60
+ teardown_connections_to(sessions.keys)
81
61
  end
82
62
 
83
63
  after "rubber:install_packages", "rubber:base:configure_git" if scm == "git"
@@ -90,7 +70,7 @@ namespace :rubber do
90
70
  fi
91
71
  ENDSCRIPT
92
72
  end
93
-
73
+
94
74
  # We need a rails user for safer permissions used by deploy.rb
95
75
  after "rubber:install_packages", "rubber:base:custom_install"
96
76
  task :custom_install do
@@ -0,0 +1,21 @@
1
+ # ruby-build needs some extra packages to compile/install ruby runtimes
2
+ # curl is required.
3
+ # patch is required (for ree, some ruby head's).
4
+ # For JRuby (if you wish to use it) you will need:
5
+ # aptitude install curl sun-java6-bin sun-java6-jre sun-java6-jdk
6
+ # For MRI & ree (if you wish to use it) you will need:
7
+ # aptitude install curl bison build-essential zlib1g-dev libssl-dev libreadline5-dev libxml2-dev git-core
8
+ # For IronRuby (if you wish to use it) you will need:
9
+ # aptitude install curl mono-2.0-devel
10
+
11
+ packages: [build-essential, git-core, subversion, curl, autoconf, bison, ruby, zlib1g-dev, libssl-dev, libreadline6-dev, libxml2-dev, libyaml-dev]
12
+
13
+ # REQUIRED: The version of ruby-build to use for building ruby.
14
+ ruby_build_version: 20130206
15
+
16
+ # REQUIRED: Set to the version string for the ruby version you wish to use
17
+ # Run "ruby-build --definitions" to see the list of possible options
18
+ ruby_version: 1.9.3-p385
19
+
20
+ # REQUIRED: Installation path for ruby.
21
+ ruby_path: "/usr/local/rubies/#{ruby_version}"
@@ -30,6 +30,11 @@ domain: foo.com
30
30
  #
31
31
  # rubber_secret: "#{File.expand_path('~') + '/.ec2' + (Rubber.env == 'production' ? '' : '_dev') + '/rubber-secret.yml' rescue ''}"
32
32
 
33
+ # OPTIONAL: Encryption key that was used to obfuscate the contents of rubber-secret.yml with "rubber util:obfuscation"
34
+ # Not that much better when stored in here, but you could use a ruby snippet in here to fetch it from a key server or something
35
+ #
36
+ # rubber_secret_key: "XXXyyy=="
37
+
33
38
  # REQUIRED All known cloud providers with the settings needed to configure them
34
39
  # There's only one working cloud provider right now - Amazon Web Services
35
40
  # To implement another, clone lib/rubber/cloud/aws.rb or make the fog provider
@@ -52,7 +57,7 @@ cloud_providers:
52
57
  #
53
58
  access_key: XXX
54
59
  secret_access_key: YYY
55
- account: ZZZ
60
+ account: 'ZZZ'
56
61
 
57
62
  # REQUIRED: The name of the amazon keypair and location of its private key
58
63
  #
@@ -78,8 +83,8 @@ cloud_providers:
78
83
  # Ubuntu 12.04 Precise instance-store 64-bit: ami-eafa5883
79
84
  #
80
85
  # m1.small or m1.large or m1.xlarge
81
- image_type: m1.small
82
- image_id: ami-eafa5883
86
+ image_type: c1.medium
87
+ image_id: ami-d726abbe
83
88
 
84
89
  # OPTIONAL: EC2 spot instance request support.
85
90
  #
@@ -3,6 +3,10 @@
3
3
  export RUBBER_ROOT=`dirname $0`/..
4
4
  export BUNDLE_GEMFILE=$RUBBER_ROOT/Gemfile
5
5
 
6
- # run through "rvm do" so we work in crontab - default rvm ruby
7
- # version is set during bootstrap
8
- rvm default do bundle exec rubber "$@"
6
+ if type rvm &> /dev/null; then
7
+ # run through "rvm do" so we work in crontab - default rvm ruby
8
+ # version is set during bootstrap
9
+ rvm default do bundle exec rubber "$@"
10
+ else
11
+ bundle exec rubber "$@"
12
+ fi
@@ -36,7 +36,7 @@ INTERVAL = (ENV["COLLECTD_INTERVAL"] || 60).to_i
36
36
  loop do
37
37
  start_time = Time.now.to_i
38
38
 
39
- status = `sudo <%= rubber_env.rvm_gem_home %>/bin/passenger-status`
39
+ status = `sudo <%= rubber_env.ruby_path %>/bin/passenger-status`
40
40
  unless $?.success?
41
41
  $stderr.puts "failed executing passenger-status"
42
42
  exit 1
@@ -59,7 +59,7 @@ loop do
59
59
  puts "PUTVAL #{HOSTNAME}/passenger/gauge-total_sessions interval=#{INTERVAL} N:#{total_sessions}"
60
60
 
61
61
 
62
- status = `sudo <%= rubber_env.rvm_gem_home %>/bin/passenger-memory-stats | tail -1`
62
+ status = `sudo <%= rubber_env.ruby_path %>/bin/passenger-memory-stats | tail -1`
63
63
  unless $?.success?
64
64
  $stderr.puts "failed executing passenger-memory-stats"
65
65
  exit 1
@@ -4,5 +4,5 @@
4
4
  %>
5
5
  Defaults env_keep += GEM_PATH
6
6
 
7
- nobody ALL=(ALL) NOPASSWD: <%= rubber_env.rvm_gem_home %>/bin/passenger-status
8
- nobody ALL=(ALL) NOPASSWD: <%= rubber_env.rvm_gem_home %>/bin/passenger-memory-stats
7
+ nobody ALL=(ALL) NOPASSWD: <%= rubber_env.ruby_path %>/bin/passenger-status
8
+ nobody ALL=(ALL) NOPASSWD: <%= rubber_env.ruby_path %>/bin/passenger-memory-stats
@@ -1,7 +1,6 @@
1
1
  role_dependencies:
2
- web: [haproxy]
3
- app: [unicorn_nginx]
4
- web_tools: [unicorn_nginx]
2
+ app: [unicorn]
3
+ web_tools: [nginx]
5
4
 
6
5
  web_port: 80
7
6
  web_ssl_port: 443
@@ -1,7 +1,6 @@
1
1
  description: A fairly complete and scalable deployment setup using unicorn and nginx
2
2
  dependent_templates:
3
3
  - base
4
- - haproxy
5
4
  - nginx
6
5
  - unicorn
7
6
  - monit
@@ -9,7 +9,7 @@ namespace :rubber do
9
9
  task :install, :roles => :elasticsearch do
10
10
  rubber.sudo_script 'install_elasticsearch', <<-ENDSCRIPT
11
11
  if [[ ! -d "#{rubber_env.elasticsearch_dir}" ]]; then
12
- wget --no-check-certificate -qNP /tmp https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-#{rubber_env.elasticsearch_version}.zip
12
+ wget --no-check-certificate -qNP /tmp http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-#{rubber_env.elasticsearch_version}.zip
13
13
  unzip -d #{rubber_env.elasticsearch_prefix} /tmp/elasticsearch-#{rubber_env.elasticsearch_version}.zip
14
14
  rm /tmp/elasticsearch-#{rubber_env.elasticsearch_version}.zip
15
15
 
@@ -1,4 +1,4 @@
1
- elasticsearch_version: 0.19.3
1
+ elasticsearch_version: 0.19.12
2
2
  elasticsearch_prefix: /usr/local
3
3
  elasticsearch_dir: "#{elasticsearch_prefix}/elasticsearch-#{elasticsearch_version}"
4
4
  elasticsearch_data_dir: "/mnt/elasticsearch/data"
@@ -1,8 +1,8 @@
1
1
 
2
2
  namespace :rubber do
3
-
3
+
4
4
  namespace :graphite do
5
-
5
+
6
6
  rubber.allow_optional_tasks(self)
7
7
 
8
8
  after "rubber:install_packages", "rubber:graphite:install_collectd_graphite_plugin"
@@ -21,53 +21,6 @@ namespace :rubber do
21
21
  ENDSCRIPT
22
22
  end
23
23
 
24
- # graphite collectd plugin needs newer collectd (>= 4.9)
25
- before "rubber:install_packages", "rubber:graphite:setup_apt_backport_of_collectd"
26
-
27
- task :setup_apt_backport_of_collectd do
28
- sources = <<-EOF
29
- deb http://gb.archive.ubuntu.com/ubuntu/ maverick main universe
30
- deb-src http://gb.archive.ubuntu.com/ubuntu/ maverick main universe
31
- EOF
32
- sources.gsub!(/^[ \t]*/, '')
33
-
34
- prefs = <<-EOF
35
- Package: *
36
- Pin: release a=maverick
37
- Pin-Priority: 400
38
-
39
- Package: libxml2
40
- Pin: release a=maverick
41
- Pin-Priority: 900
42
-
43
- Package: libxml2-dev
44
- Pin: release a=maverick
45
- Pin-Priority: 900
46
-
47
- Package: collectd-core
48
- Pin: release a=maverick
49
- Pin-Priority: 900
50
-
51
- Package: collectd-utils
52
- Pin: release a=maverick
53
- Pin-Priority: 900
54
-
55
- Package: collectd
56
- Pin: release a=maverick
57
- Pin-Priority: 900
58
- EOF
59
- prefs.gsub!(/^[ \t]*/, '')
60
-
61
- rubber.sudo_script 'setup_apt_backport_of_collectd', <<-ENDSCRIPT
62
- release=`lsb_release -sr`
63
- needs_backport=`echo "$release <= 10.04" | bc`
64
- if [[ $needs_backport == 1 && ! -f /etc/apt/preferences.d/rubber-collectd ]]; then
65
- echo -e #{sources.inspect} > /etc/apt/sources.list.d/rubber-collectd.list
66
- echo -e #{prefs.inspect} > /etc/apt/preferences.d/rubber-collectd
67
- fi
68
- ENDSCRIPT
69
- end
70
-
71
24
  task :install_graphite_from_repo, :roles => [:graphite_server, :graphite_web] do
72
25
  rubber.sudo_script 'install_graphite_from_repo', <<-ENDSCRIPT
73
26
  if [[ ! -d "/opt/graphite" ]]; then
@@ -142,6 +95,10 @@ namespace :rubber do
142
95
  cd /tmp/#{rubber_env.graphite_carbon_package_url.gsub(/.*\//, '').gsub('.tar.gz', '')}
143
96
  python setup.py install
144
97
 
98
+ rm -rf /opt/graphite/storage
99
+ mkdir #{rubber_env.graphite_storage_dir}
100
+ chown www-data:www-data #{rubber_env.graphite_storage_dir}
101
+ ln -s #{rubber_env.graphite_storage_dir} /opt/graphite/storage
145
102
  fi
146
103
  ENDSCRIPT
147
104
  end
@@ -183,7 +140,7 @@ namespace :rubber do
183
140
  else
184
141
  after "rubber:graphite:server:install", "rubber:graphite:web:install"
185
142
  end
186
-
143
+
187
144
  after "rubber:graphite:server:bootstrap", "rubber:graphite:web:bootstrap"
188
145
 
189
146
  desc <<-DESC
@@ -234,12 +191,12 @@ EOF
234
191
 
235
192
  desc "Start graphite system monitoring"
236
193
  task :start, :roles => :graphite_web do
237
- rsudo "service apache2 start"
194
+ rsudo "service graphite-web start"
238
195
  end
239
196
 
240
197
  desc "Stop graphite system monitoring"
241
198
  task :stop, :roles => :graphite_web do
242
- rsudo "service apache2 stop || true"
199
+ rsudo "service graphite-web stop || true"
243
200
  end
244
201
 
245
202
  desc "Restart graphite system monitoring"
@@ -78,7 +78,7 @@ PICKLE_RECEIVER_PORT = 2004
78
78
  USE_INSECURE_UNPICKLER = False
79
79
 
80
80
  CACHE_QUERY_INTERFACE = 0.0.0.0
81
- CACHE_QUERY_PORT = 7002
81
+ CACHE_QUERY_PORT = <%= rubber_env.graphite_carbon_port %>
82
82
 
83
83
  # Set this to False to drop datapoints received after the cache
84
84
  # reaches MAX_CACHE_SIZE. If this is True (the default) then sockets
@@ -0,0 +1,11 @@
1
+ <%
2
+ @path = '/etc/collectd/conf.d/graphite-ping.conf'
3
+ %>
4
+
5
+ LoadPlugin ping
6
+
7
+ <Plugin "ping">
8
+ <% rubber_instances.each do |ic| %>
9
+ Host "<%= ic.full_name %>"
10
+ <% end %>
11
+ </Plugin>