Permalink
Browse files

Merge pull request #16 from hw-cookbooks/develop

Develop to Master
  • Loading branch information...
2 parents ac0c84b + a670c63 commit 43aadd76db5b4960a697a3f229aed12723dacd04 @webframp webframp committed Feb 3, 2013
View
3 .gitignore
@@ -2,3 +2,6 @@
.cache
.kitchen
bin
+.jamie/
+.jamie.local.yml
+.vagrant
View
22 .jamie.yml
@@ -0,0 +1,22 @@
+---
+driver_plugin: vagrant
+platforms:
+- name: ubuntu-12.04
+ driver_config:
+ box: opscode-ubuntu-12.04
+ box_url: https://opscode-vm.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_chef-10.18.2.box
+ run_list:
+ - recipe[apt]
+suites:
+- name: carbon
+ run_list:
+ - recipe[minitest-handler]
+ - recipe[graphite_test::carbon]
+- name: carbon_runit
+ run_list:
+ - recipe[minitest-handler]
+ - recipe[graphite_test::carbon_runit]
+- name: carbon_runit_twistd
+ run_list:
+ - recipe[minitest-handler]
+ - recipe[graphite_test::carbon_runit_twistd]
View
3 Gemfile
@@ -1,3 +1,4 @@
source :rubygems
-gem 'test-kitchen'
+gem 'jamie'
+gem 'jamie-vagrant', :group => :integration
View
113 Gemfile.lock
@@ -2,102 +2,41 @@ GEM
remote: http://rubygems.org/
specs:
archive-tar-minitar (0.5.2)
- bunny (0.7.9)
- chef (10.14.4)
- bunny (>= 0.6.0, < 0.8.0)
- erubis
- highline (>= 1.6.9)
- json (>= 1.4.4, <= 1.6.1)
- mixlib-authentication (>= 1.3.0)
- mixlib-cli (>= 1.1.0)
- mixlib-config (>= 1.1.2)
- mixlib-log (>= 1.3.0)
- mixlib-shellout
- moneta
- net-ssh (~> 2.2.2)
- net-ssh-multi (~> 1.1.0)
- ohai (>= 0.6.0)
- rest-client (>= 1.0.4, < 1.7.0)
- treetop (~> 1.4.9)
- uuidtools
- yajl-ruby (~> 1.1)
- childprocess (0.3.5)
+ celluloid (0.12.4)
+ facter (>= 1.6.12)
+ timers (>= 1.0.0)
+ childprocess (0.3.7)
ffi (~> 1.0, >= 1.0.6)
coderay (1.0.8)
erubis (2.7.0)
- ffi (1.1.5)
- foodcritic (1.6.1)
- erubis
- gherkin (~> 2.11.1)
- gist (~> 3.1.0)
- nokogiri (= 1.5.0)
- pry (~> 0.9.8.4)
- rak (~> 1.4)
- treetop (~> 1.4.10)
- yajl-ruby (~> 1.1.0)
- gherkin (2.11.2)
- json (>= 1.4.6)
- gist (3.1.0)
- hashr (0.0.22)
- highline (1.6.15)
+ facter (1.6.17)
+ ffi (1.3.1)
i18n (0.6.1)
- ipaddress (0.8.0)
+ jamie (0.1.0.beta4)
+ celluloid
+ mixlib-shellout
+ net-scp
+ net-ssh
+ pry
+ thor
+ jamie-vagrant (0.5.2)
+ jamie (~> 0.1.0.beta1)
+ vagrant (~> 1.0.5)
json (1.5.4)
- librarian (0.0.24)
- archive-tar-minitar (>= 0.5.2)
- chef (>= 0.10)
- highline
- thor (~> 0.15)
log4r (1.1.10)
- method_source (0.7.1)
- mime-types (1.19)
- mixlib-authentication (1.3.0)
- mixlib-log
- mixlib-cli (1.2.2)
- mixlib-config (1.1.2)
- mixlib-log (1.4.1)
+ method_source (0.8.1)
mixlib-shellout (1.1.0)
- moneta (0.6.0)
net-scp (1.0.4)
net-ssh (>= 1.99.1)
net-ssh (2.2.2)
- net-ssh-gateway (1.1.0)
- net-ssh (>= 1.99.1)
- net-ssh-multi (1.1)
- net-ssh (>= 2.1.4)
- net-ssh-gateway (>= 0.99.0)
- nokogiri (1.5.0)
- ohai (6.14.0)
- ipaddress
- mixlib-cli
- mixlib-config
- mixlib-log
- systemu
- yajl-ruby
- polyglot (0.3.3)
- pry (0.9.8.4)
+ pry (0.9.11.4)
coderay (~> 1.0.5)
- method_source (~> 0.7.1)
- slop (>= 2.4.4, < 3)
- rak (1.4)
- rest-client (1.6.7)
- mime-types (>= 1.16)
- slop (2.4.4)
- systemu (2.5.2)
- test-kitchen (0.6.0)
- foodcritic (~> 1.4)
- hashr (~> 0.0.20)
- highline (>= 1.6.9)
- librarian (~> 0.0.20)
- mixlib-cli (~> 1.2.2)
- vagrant (~> 1.0.2)
- yajl-ruby (~> 1.1.0)
- thor (0.16.0)
- treetop (1.4.10)
- polyglot
- polyglot (>= 0.3.1)
- uuidtools (2.1.3)
- vagrant (1.0.5)
+ method_source (~> 0.8)
+ slop (~> 3.4)
+ slop (3.4.3)
+ thor (0.17.0)
+ timers (1.1.0)
+ vagrant (1.0.6)
archive-tar-minitar (= 0.5.2)
childprocess (~> 0.3.1)
erubis (~> 2.7.0)
@@ -106,10 +45,10 @@ GEM
log4r (~> 1.1.9)
net-scp (~> 1.0.4)
net-ssh (~> 2.2.2)
- yajl-ruby (1.1.0)
PLATFORMS
ruby
DEPENDENCIES
- test-kitchen
+ jamie
+ jamie-vagrant
View
50 README.md
@@ -6,13 +6,49 @@ Installs and configures Graphite http://graphite.wikidot.com/
Requirements
============
-* Ubuntu 10.04 (Lucid) - with default settings
-* Ubuntu 11.10 (Oneiric) - change node[:graphite][:python_version] to "2.7"
+* Ubuntu 10.04 / Ubuntu 12.04
Attributes
==========
-* `node[:graphite][:password]` sets the default password for graphite "root" user.
+The name of the encrypted data bag containing the default password for
+the graphite "root" user. If this attribute is set it will not use
+`node[:graphite][:password]`.
+
+* `node['graphite']['encrypted_data_bag']['name']`
+
+
+* `node['graphite']['version']` - version of graphite to install (defaults to 0.9.10)
+* `node['graphite']['password']` - password for graphite root user(default to `change_me` and is only used if encrypted databag isn't)
+* `node['graphite']['url']` - url of the graphite server (defaults to graphite)
+* `node['graphite']['url_aliases']` - array of url aliases (defaults to nil)
+* `node['graphite']['listen_port']` - port to listen on (defaults to 80)
+* `node['graphite']['base_dir']` = "/opt/graphite"
+* `node['graphite']['doc_root']` = "/opt/graphite/webapp"
+* `node['graphite']['storage_dir']` = "/opt/graphite/storage"
+* `node['graphite']['django_root']` = "@DJANGO_ROOT@" - configurable path to your django installation
+
+* `node['graphite']['whisper']['uri']` - download url for whisper
+* `node['graphite']['whisper']['checksum']` - checksum of the whisper download
+
+* `node['graphite']['graphite_web']['uri']` - download url for the graphite web ui
+* `node['graphite']['graphite_web']['checksum']` - checksum for the graphite web ui download
+
+* `node['graphite']['carbon']['uri']` - download url for carbon
+* `node['graphite']['carbon']['checksum']` - checksum for the carbon download
+* `node['graphite']['carbon']['line_receiver_interface']` - line interface IP (defaults to 0.0.0.0)
+* `node['graphite']['carbon']['line_receiver_port']` - line interface port (defaults to 2003)
+* `node['graphite']['carbon']['pickle_receiver_interface']` - pickle receiver IP (defaults to 0.0.0.0)
+* `node['graphite']['carbon']['pickle_receiver_port']` - pickle receiver port (defaults to 2004)
+* `node['graphite']['carbon']['cache_query_interface']` - cache query IP (defaults to 0.0.0.0)
+* `node['graphite']['carbon']['cache_query_port']` - cache query port (defaults to 7002)
+* `node['graphite']['carbon']['max_updates_per_second']` - max updates to carbon per second (defaults to 1000)
+* `node['graphite']['carbon']['service_type']` - init service to use for carbon (defaults to runit)
+* `node['graphite']['carbon']['log_whisper_updates']` - log updates to whisper (defaults to false)
+
+Set the timezone for the graphite web interface, defaults to America/Los_Angeles
+
+* `node[:graphite][:timezone]`
Usage
=====
@@ -22,11 +58,3 @@ Usage
`recipe[graphite::ganglia]` integrates with Ganglia. You'll want at
least one monitor node (i.e. recipe[ganglia]) node to be running
to use it.
-
-Caveats
-=======
-
-Ships with two default schemas, stats.* (for Etsy's statsd) and a
-catchall that matches anything. The catchall retains minutely data for
-13 months, as in the default config. stats retains data every 10 seconds
-for 6 hours, every minute for a week, and every 10 minutes for 5 years.
View
5 Vagrantfile
@@ -0,0 +1,5 @@
+require 'jamie/vagrant'
+
+Vagrant::Config.run do |config|
+ Jamie::Vagrant.define_vms(config)
+end
View
46 attributes/graphite.rb
@@ -1,23 +1,35 @@
-default['graphite']['version'] = "0.9.9"
-default['graphite']['python_version'] = "2.6"
-
-default['graphite']['carbon']['uri'] = "http://launchpadlibrarian.net/82112362/carbon-#{node['graphite']['version']}.tar.gz"
-default['graphite']['carbon']['checksum'] = "b3d42e3b93c09"
-
-default['graphite']['whisper']['uri'] = "http://launchpadlibrarian.net/82112367/whisper-#{node['graphite']['version']}.tar.gz"
-default['graphite']['whisper']['checksum'] = "66c05eafe8d86"
-
-default['graphite']['graphite_web']['uri'] = "http://launchpadlibrarian.net/82112308/graphite-web-#{node['graphite']['version']}.tar.gz"
-default['graphite']['graphite_web']['checksum'] = "cc78bab7fb26b"
-
-default['graphite']['carbon']['line_receiver_interface'] = "127.0.0.1"
-default['graphite']['carbon']['pickle_receiver_interface'] = "127.0.0.1"
-default['graphite']['carbon']['cache_query_interface'] = "127.0.0.1"
-default['graphite']['carbon']['service_type'] = "runit"
+#
+# Cookbook Name:: graphite
+# Attributes:: graphite
+#
+default['graphite']['version'] = "0.9.10"
default['graphite']['password'] = "change_me"
default['graphite']['url'] = "graphite"
default['graphite']['url_aliases'] = []
-default['graphite']['listen_port'] = "80"
+default['graphite']['listen_port'] = 80
default['graphite']['base_dir'] = "/opt/graphite"
default['graphite']['doc_root'] = "/opt/graphite/webapp"
+default['graphite']['storage_dir'] = "/opt/graphite/storage"
+default['graphite']['timezone'] = "America/Los_Angeles"
+default['graphite']['django_root'] = "@DJANGO_ROOT@"
+
+default['graphite']['whisper']['uri'] = "https://launchpad.net/graphite/0.9/#{node['graphite']['version']}/+download/whisper-#{node['graphite']['version']}.tar.gz"
+default['graphite']['whisper']['checksum'] = "36b5fa917526224678da0a530a6f276d00074f0aa98acd6e2412c79521f9c4ff"
+
+default['graphite']['graphite_web']['uri'] = "https://launchpad.net/graphite/0.9/#{node['graphite']['version']}/+download/graphite-web-#{node['graphite']['version']}.tar.gz"
+default['graphite']['graphite_web']['checksum'] = "4fd1d16cac3980fddc09dbf0a72243c7ae32444903258e1b65e28428a48948be"
+
+default['graphite']['carbon']['uri'] = "https://launchpad.net/graphite/0.9/#{node['graphite']['version']}/+download/carbon-#{node['graphite']['version']}.tar.gz"
+default['graphite']['carbon']['checksum'] = "4f37e00595b5b078edb9b3f5cae318f752f4446a82623ea4da97dd7d0f6a5072"
+default['graphite']['carbon']['line_receiver_interface'] = "0.0.0.0"
+default['graphite']['carbon']['line_receiver_port'] = 2003
+default['graphite']['carbon']['pickle_receiver_interface'] = "0.0.0.0"
+default['graphite']['carbon']['pickle_receiver_port'] = 2004
+default['graphite']['carbon']['cache_query_interface'] = "0.0.0.0"
+default['graphite']['carbon']['cache_query_port'] = 7002
+default['graphite']['carbon']['max_updates_per_second'] = 1000
+default['graphite']['carbon']['service_type'] = "runit"
+default['graphite']['carbon']['log_whisper_updates'] = "False"
+
+default['graphite']['encrypted_data_bag']['name'] = nil
View
11 metadata.rb
@@ -1,17 +1,18 @@
+name "graphite"
maintainer "Heavy Water Software Inc."
maintainer_email "ops@hw-ops.com"
license "Apache 2.0"
description "Installs/Configures graphite"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
-version "0.3.1"
+version "0.4.0"
supports "ubuntu"
-depends "python"
-depends "apache2"
+depends "python"
+depends "apache2"
+depends "runit"
+depends "memcached"
-suggests "runit"
suggests "systemd"
suggests "s6"
-
suggests "graphiti"
View
54 recipes/carbon.rb
@@ -1,32 +1,57 @@
+#
+# Cookbook Name:: graphite
+# Recipe:: carbon
+#
+# Copyright 2011, Heavy Water Software Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
package "python-twisted"
package "python-simplejson"
version = node['graphite']['version']
-pyver = node['graphite']['python_version']
+pyver = node['languages']['python']['version'][0..-3]
-remote_file "/usr/src/carbon-#{version}.tar.gz" do
+remote_file "#{Chef::Config[:file_cache_path]}/carbon-#{version}.tar.gz" do
source node['graphite']['carbon']['uri']
checksum node['graphite']['carbon']['checksum']
end
execute "untar carbon" do
command "tar xzf carbon-#{version}.tar.gz"
- creates "/usr/src/carbon-#{version}"
- cwd "/usr/src"
+ creates "#{Chef::Config[:file_cache_path]}/carbon-#{version}"
+ cwd Chef::Config[:file_cache_path]
end
execute "install carbon" do
command "python setup.py install"
creates "#{node['graphite']['base_dir']}/lib/carbon-#{version}-py#{pyver}.egg-info"
- cwd "/usr/src/carbon-#{version}"
+ cwd "#{Chef::Config[:file_cache_path]}/carbon-#{version}"
end
template "#{node['graphite']['base_dir']}/conf/carbon.conf" do
owner node['apache']['user']
group node['apache']['group']
variables( :line_receiver_interface => node['graphite']['carbon']['line_receiver_interface'],
+ :line_receiver_port => node['graphite']['carbon']['line_receiver_port'],
:pickle_receiver_interface => node['graphite']['carbon']['pickle_receiver_interface'],
- :cache_query_interface => node['graphite']['carbon']['cache_query_interface'] )
+ :pickle_receiver_port => node['graphite']['carbon']['pickle_receiver_port'],
+ :cache_query_interface => node['graphite']['carbon']['cache_query_interface'],
+ :cache_query_port => node['graphite']['carbon']['cache_query_port'],
+ :max_updates_per_second => node['graphite']['carbon']['max_updates_per_second'],
+ :log_whisper_updates => node['graphite']['carbon']['log_whisper_updates'],
+ :storage_dir => node['graphite']['storage_dir'])
notifies :restart, "service[carbon-cache]"
end
@@ -35,17 +60,22 @@
group node['apache']['group']
end
-execute "carbon: change graphite storage permissions to apache user" do
- command "chown -R www-data:www-data #{node['graphite']['base_dir']}/storage"
- only_if do
- f = File.stat("#{node['graphite']['base_dir']}/storage")
- f.uid == 0 and f.gid == 0
- end
+directory node['graphite']['storage_dir'] do
+ owner node['apache']['user']
+ group node['apache']['group']
+ recursive true
+end
+
+directory "#{node['graphite']['storage_dir']}/whisper" do
+ owner node['apache']['user']
+ group node['apache']['group']
+ recursive true
end
directory "#{node['graphite']['base_dir']}/lib/twisted/plugins/" do
owner node['apache']['user']
group node['apache']['group']
+ recursive true
end
service_type = node['graphite']['carbon']['service_type']
View
21 recipes/carbon_runit.rb
@@ -1,3 +1,22 @@
+#
+# Cookbook Name:: graphite
+# Recipe:: carbon_runit
+#
+# Copyright 2011, Heavy Water Software Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
runit_service "carbon-cache" do
- finish_script true
+ finish true
end
View
19 recipes/carbon_runit_twistd.rb
@@ -1 +1,20 @@
+#
+# Cookbook Name:: graphite
+# Recipe:: carbon_runit_twistd
+#
+# Copyright 2011, Heavy Water Software Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
runit_service "twistd-carbon-cache"
View
1 recipes/default.rb
@@ -18,6 +18,7 @@
#
include_recipe "python"
+include_recipe "memcached"
include_recipe "graphite::whisper"
include_recipe "graphite::carbon"
View
86 recipes/web.rb
@@ -1,30 +1,62 @@
+#
+# Cookbook Name:: graphite
+# Recipe:: web
+#
+# Copyright 2011, Heavy Water Software Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
include_recipe "apache2::mod_python"
basedir = node['graphite']['base_dir']
+docroot = node['graphite']['doc_root']
+storagedir = node['graphite']['storage_dir']
version = node['graphite']['version']
-pyver = node['graphite']['python_version']
+pyver = node['languages']['python']['version'][0..-3]
-package "python-cairo-dev"
-package "python-django"
-package "python-django-tagging"
-package "python-memcache"
-package "python-rrdtool"
+if Chef::Config[:solo]
+ Chef::Log.warn "This recipe uses encrypted data bags. Chef Solo does not support this."
+else
+ if node['graphite']['encrypted_data_bag']['name']
+ data_bag_name = node['graphite']['encrypted_data_bag']['name']
+ password = Chef::EncryptedDataBagItem.load(data_bag_name, "graphite")
+ else
+ password = node['graphite']['password']
+ end
+end
-remote_file "/usr/src/graphite-web-#{version}.tar.gz" do
+%{ python-cairo-dev python-django python-django-tagging python-memcache python-rrdtool }.each do |pkg|
+ package pkg do
+ action :install
+ end
+end
+
+remote_file "#{Chef::Config[:file_cache_path]}/graphite-web-#{version}.tar.gz" do
source node['graphite']['graphite_web']['uri']
checksum node['graphite']['graphite_web']['checksum']
end
execute "untar graphite-web" do
command "tar xzf graphite-web-#{version}.tar.gz"
- creates "/usr/src/graphite-web-#{version}"
- cwd "/usr/src"
+ creates "#{Chef::Config[:file_cache_path]}/graphite-web-#{version}"
+ cwd Chef::Config[:file_cache_path]
end
execute "install graphite-web" do
command "python setup.py install"
creates "#{node['graphite']['doc_root']}/graphite_web-#{version}-py#{pyver}.egg-info"
- cwd "/usr/src/graphite-web-#{version}"
+ cwd "#{Chef::Config[:file_cache_path]}/graphite-web-#{version}"
end
template "/etc/apache2/sites-available/graphite" do
@@ -33,39 +65,51 @@
apache_site "graphite"
-directory "#{basedir}/storage" do
- owner node['apache']['user']
- group node['apache']['group']
+apache_site "000-default" do
+ enable false
end
-directory "#{basedir}/storage/log" do
- owner node['apache']['user']
- group node['apache']['group']
+%w{ webapp whisper }.each do |dir|
+ directory "#{storagedir}/log/#{dir}" do
+ owner node['apache']['user']
+ group node['apache']['group']
+ recursive true
+ end
end
-%w{ webapp whisper }.each do |dir|
- directory "#{basedir}/storage/log/#{dir}" do
+%w{ info.log exception.log access.log error.log }.each do |file|
+ file "#{storagedir}/log/webapp/#{file}" do
owner node['apache']['user']
group node['apache']['group']
end
end
+template "#{docroot}/graphite/local_settings.py" do
+ source "local_settings.py.erb"
+ mode 00755
+ variables(:timezone => node['graphite']['timzone'],
+ :base_dir => node['graphite']['base_dir'],
+ :doc_root => node['graphite']['doc_root'],
+ :storage_dir => node['graphite']['storage_dir'] )
+end
+
template "#{basedir}/bin/set_admin_passwd.py" do
source "set_admin_passwd.py.erb"
mode 00755
end
-cookbook_file "#{basedir}/storage/graphite.db" do
+cookbook_file "#{storagedir}/graphite.db" do
action :create_if_missing
notifies :run, "execute[set admin password]"
end
execute "set admin password" do
- command "#{basedir}/bin/set_admin_passwd.py root #{node['graphite']['password']}"
+ command "#{basedir}/bin/set_admin_passwd.py root #{password}"
action :nothing
end
-file "#{basedir}/storage/graphite.db" do
+# This is not done in the cookbook_file above to avoid triggering a password set on permissions changes
+file "#{storagedir}/graphite.db" do
owner node['apache']['user']
group node['apache']['group']
mode 00644
View
29 recipes/whisper.rb
@@ -1,19 +1,38 @@
+#
+# Cookbook Name:: graphite
+# Recipe:: whisper
+#
+# Copyright 2011, Heavy Water Software Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
version = node['graphite']['version']
-pyver = node['graphite']['python_version']
+pyver = node['languages']['python']['version'][0..-3]
-remote_file "/usr/src/whisper-#{version}.tar.gz" do
+remote_file "#{Chef::Config[:file_cache_path]}/whisper-#{version}.tar.gz" do
source node['graphite']['whisper']['uri']
checksum node['graphite']['whisper']['checksum']
end
execute "untar whisper" do
command "tar xzf whisper-#{version}.tar.gz"
- creates "/usr/src/whisper-#{version}"
- cwd "/usr/src"
+ creates "#{Chef::Config[:file_cache_path]}/whisper-#{version}"
+ cwd Chef::Config[:file_cache_path]
end
execute "install whisper" do
command "python setup.py install"
creates "/usr/local/lib/python#{pyver}/dist-packages/whisper-#{version}.egg-info"
- cwd "/usr/src/whisper-#{version}"
+ cwd "#{Chef::Config[:file_cache_path]}/whisper-#{version}"
end
View
12 templates/default/carbon.conf.erb
@@ -1,5 +1,5 @@
[cache]
-LOCAL_DATA_DIR = <%= node['graphite']['base_dir'] %>/storage/whisper/
+LOCAL_DATA_DIR = <%= @storage_dir %>/whisper/
# Specify the user to drop privileges to
# If this is blank carbon runs as the user that invokes it
@@ -16,7 +16,7 @@ MAX_CACHE_SIZE = inf
# prevent over-utilizing the disk and thus starving the rest of the system.
# When the rate of required updates exceeds this, then carbon's caching will
# take effect and increase the overall throughput accordingly.
-MAX_UPDATES_PER_SECOND = 1000
+MAX_UPDATES_PER_SECOND = <%= @max_updates_per_second %>
# Softly limits the number of whisper files that get created each minute.
# Setting this value low (like at 50) is a good way to ensure your graphite
@@ -28,17 +28,17 @@ MAX_UPDATES_PER_SECOND = 1000
MAX_CREATES_PER_MINUTE = inf
LINE_RECEIVER_INTERFACE = <%= @line_receiver_interface %>
-LINE_RECEIVER_PORT = 2003
+LINE_RECEIVER_PORT = <%= @line_receiver_port %>
PICKLE_RECEIVER_INTERFACE = <%= @pickle_receiver_interface %>
-PICKLE_RECEIVER_PORT = 2004
+PICKLE_RECEIVER_PORT = <%= @pickle_receiver_port %>
CACHE_QUERY_INTERFACE = <%= @cache_query_interface %>
-CACHE_QUERY_PORT = 7002
+CACHE_QUERY_PORT = <%= @cache_query_port %>
# By default, carbon-cache will log every whisper update. This can be excessive and
# degrade performance if logging on the same volume as the whisper data is stored.
-LOG_UPDATES = True
+LOG_UPDATES = <%= @log_whisper_updates %>
# Enable AMQP if you want to receve metrics using an amqp broker
View
8 templates/default/graphite-vhost.conf.erb
@@ -10,12 +10,12 @@ NameVirtualHost *:<%= node['graphite']['listen_port'] %>
ServerAlias <%= [node['graphite']['url_aliases']].flatten.compact.join(" ") %>
<% end %>
DocumentRoot "<%= node['graphite']['doc_root'] %>"
- ErrorLog <%= node['graphite']['base_dir'] %>/storage/log/webapp/error.log
- CustomLog <%= node['graphite']['base_dir'] %>/storage/log/webapp/access.log common
+ ErrorLog <%= node['graphite']['storage_dir'] %>/log/webapp/error.log
+ CustomLog <%= node['graphite']['storage_dir'] %>/log/webapp/access.log common
<Location "/">
SetHandler python-program
- PythonPath "['<%= node['graphite']['base_dir'] %>'] + sys.path"
+ PythonPath "['<%= node['graphite']['doc_root'] %>'] + sys.path"
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE graphite.settings
PythonDebug Off
@@ -40,6 +40,6 @@ NameVirtualHost *:<%= node['graphite']['listen_port'] %>
# must change @DJANGO_ROOT@ to be the path to your django
# installation, which is probably something like:
# /usr/lib/python2.6/site-packages/django
- Alias /media/ "@DJANGO_ROOT@/contrib/admin/media/"
+ Alias /media/ "<%= node['graphite']['django_root'] %>/contrib/admin/media/"
</VirtualHost>
View
199 templates/default/local_settings.py.erb
@@ -0,0 +1,199 @@
+## Graphite local_settings.py
+# Edit this file to customize the default Graphite webapp settings
+#
+# Additional customizations to Django settings can be added to this file as well
+
+#####################################
+# General Configuration #
+#####################################
+# Set your local timezone (Django's default is America/Chicago)
+# If your graphs appear to be offset by a couple hours then this probably
+# needs to be explicitly set to your local timezone.
+TIME_ZONE = '<%= @timezone %>'
+
+# Override this to provide documentation specific to your Graphite deployment
+#DOCUMENTATION_URL = "http://graphite.readthedocs.org/"
+
+# Logging
+#LOG_RENDERING_PERFORMANCE = True
+#LOG_CACHE_PERFORMANCE = True
+#LOG_METRIC_ACCESS = True
+
+# Enable full debug page display on exceptions (Internal Server Error pages)
+#DEBUG = True
+
+# If using RRD files and rrdcached, set to the address or socket of the daemon
+#FLUSHRRDCACHED = 'unix:/var/run/rrdcached.sock'
+
+# This lists the memcached servers that will be used by this webapp.
+# If you have a cluster of webapps you should ensure all of them
+# have the *exact* same value for this setting. That will maximize cache
+# efficiency. Setting MEMCACHE_HOSTS to be empty will turn off use of
+# memcached entirely.
+#
+# You should not use the loopback address (127.0.0.1) here if using clustering
+# as every webapp in the cluster should use the exact same values to prevent
+# unneeded cache misses. Set to [] to disable caching of images and fetched data
+MEMCACHE_HOSTS = ['127.0.0.1:11211']
+#DEFAULT_CACHE_DURATION = 60 # Cache images and data for 1 minute
+
+
+#####################################
+# Filesystem Paths #
+#####################################
+# Change only GRAPHITE_ROOT if your install is merely shifted from /opt/graphite
+# to somewhere else
+#GRAPHITE_ROOT = '<%= @base_dir %>'
+# Most installs done outside of a separate tree such as /opt/graphite will only
+# need to change these three settings. Note that the default settings for each
+# of these is relative to GRAPHITE_ROOT
+#CONF_DIR = '<%= @base_dir %>/conf'
+STORAGE_DIR = '<%= @storage_dir %>'
+#CONTENT_DIR = '<%= @doc_root %>/content'
+
+# To further or fully customize the paths, modify the following. Note that the
+# default settings for each of these are relative to CONF_DIR and STORAGE_DIR
+#
+## Webapp config files
+#DASHBOARD_CONF = '<%= @base_dir %>/conf/dashboard.conf'
+#GRAPHTEMPLATES_CONF = '<%= @base_dir %>/conf/graphTemplates.conf'
+
+## Data directories
+# NOTE: If any directory is unreadable in DATA_DIRS it will break metric browsing
+#WHISPER_DIR = '<%= @storage_dir %>/whisper'
+#RRD_DIR = '<%= @storage_dir %>/rrd'
+#DATA_DIRS = [WHISPER_DIR, RRD_DIR] # Default: set from the above variables
+#LOG_DIR = '<%= @storage_dir %>/log/webapp'
+#INDEX_FILE = '<%= @storage_dir %>/index' # Search index file
+
+
+#####################################
+# Email Configuration #
+#####################################
+# This is used for emailing rendered Graphs
+# Default backend is SMTP
+#EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
+#EMAIL_HOST = 'localhost'
+#EMAIL_PORT = 25
+#EMAIL_HOST_USER = ''
+#EMAIL_HOST_PASSWORD = ''
+#EMAIL_USE_TLS = False
+# To drop emails on the floor, enable the Dummy backend:
+#EMAIL_BACKEND = 'django.core.mail.backends.dummy.EmailBackend'
+
+
+#####################################
+# Authentication Configuration #
+#####################################
+## LDAP / ActiveDirectory authentication setup
+#USE_LDAP_AUTH = True
+#LDAP_SERVER = "ldap.mycompany.com"
+#LDAP_PORT = 389
+#LDAP_URI = "ldaps://ldap.mycompany.com:636"
+#LDAP_SEARCH_BASE = "OU=users,DC=mycompany,DC=com"
+#LDAP_BASE_USER = "CN=some_readonly_account,DC=mycompany,DC=com"
+#LDAP_BASE_PASS = "readonly_account_password"
+#LDAP_USER_QUERY = "(username=%s)" #For Active Directory use "(sAMAccountName=%s)"
+#
+# If you want to further customize the ldap connection options you should
+# directly use ldap.set_option to set the ldap module's global options.
+# For example:
+#
+#import ldap
+#ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_ALLOW)
+#ldap.set_option(ldap.OPT_X_TLS_CACERTDIR, "/etc/ssl/ca")
+#ldap.set_option(ldap.OPT_X_TLS_CERTFILE, "/etc/ssl/mycert.pem")
+#ldap.set_option(ldap.OPT_X_TLS_KEYFILE, "/etc/ssl/mykey.pem")
+# See http://www.python-ldap.org/ for further details on these options.
+
+## REMOTE_USER authentication. See: https://docs.djangoproject.com/en/dev/howto/auth-remote-user/
+#USE_REMOTE_USER_AUTHENTICATION = True
+
+# Override the URL for the login link (e.g. for django_openid_auth)
+#LOGIN_URL = '/account/login'
+
+
+##########################
+# Database Configuration #
+##########################
+# By default sqlite is used. If you cluster multiple webapps you will need
+# to setup an external database (such as MySQL) and configure all of the webapp
+# instances to use the same database. Note that this database is only used to store
+# Django models such as saved graphs, dashboards, user preferences, etc.
+# Metric data is not stored here.
+#
+# DO NOT FORGET TO RUN 'manage.py syncdb' AFTER SETTING UP A NEW DATABASE
+#
+# The following built-in database engines are available:
+# django.db.backends.postgresql # Removed in Django 1.4
+# django.db.backends.postgresql_psycopg2
+# django.db.backends.mysql
+# django.db.backends.sqlite3
+# django.db.backends.oracle
+#
+# The default is 'django.db.backends.sqlite3' with file 'graphite.db'
+# located in STORAGE_DIR
+#
+# Users with Django 1.2 or greater should use the new dictionary
+# specification as the old database specification style is removed in 1.4
+#DATABASES = {
+# 'default': {
+# 'NAME': '<%= @storage_dir %>/graphite.db',
+# 'ENGINE': 'django.db.backends.sqlite3',
+# 'USER': '',
+# 'PASSWORD': '',
+# 'HOST': '',
+# 'PORT': ''
+# }
+#}
+#
+# Users still on Django 1.1 must use the old method instead:
+#DATABASE_ENGINE = 'django.db.backends.mysql'
+#DATABASE_NAME = 'graphite' # Or path to the database file if using sqlite3
+#DATABASE_USER = 'graphite'
+#DATABASE_PASSWORD = 'graphite-is-awesome'
+#DATABASE_HOST = 'mysql.mycompany.com'
+#DATABASE_PORT = '3306'
+
+
+#########################
+# Cluster Configuration #
+#########################
+# (To avoid excessive DNS lookups you want to stick to using IP addresses only in this entire section)
+#
+# This should list the IP address (and optionally port) of the webapp on each
+# remote server in the cluster. These servers must each have local access to
+# metric data. Note that the first server to return a match for a query will be
+# used.
+#CLUSTER_SERVERS = ["10.0.2.2:80", "10.0.2.3:80"]
+
+## These are timeout values (in seconds) for requests to remote webapps
+#REMOTE_STORE_FETCH_TIMEOUT = 6 # Timeout to fetch series data
+#REMOTE_STORE_FIND_TIMEOUT = 2.5 # Timeout for metric find requests
+#REMOTE_STORE_RETRY_DELAY = 60 # Time before retrying a failed remote webapp
+#REMOTE_FIND_CACHE_DURATION = 300 # Time to cache remote metric find results
+
+## Remote rendering settings
+# Set to True to enable rendering of Graphs on a remote webapp
+#REMOTE_RENDERING = True
+# List of IP (and optionally port) of the webapp on each remote server that
+# will be used for rendering. Note that each rendering host should have local
+# access to metric data or should have CLUSTER_SERVERS configured
+#RENDERING_HOSTS = []
+#REMOTE_RENDER_CONNECT_TIMEOUT = 1.0
+
+# If you are running multiple carbon-caches on this machine (typically behind a relay using
+# consistent hashing), you'll need to list the ip address, cache query port, and instance name of each carbon-cache
+# instance on the local machine (NOT every carbon-cache in the entire cluster). The default cache query port is 7002
+# and a common scheme is to use 7102 for instance b, 7202 for instance c, etc.
+#
+# You *should* use 127.0.0.1 here in most cases
+#CARBONLINK_HOSTS = ["127.0.0.1:7002:a", "127.0.0.1:7102:b", "127.0.0.1:7202:c"]
+#CARBONLINK_TIMEOUT = 1.0
+
+#####################################
+# Additional Django Settings #
+#####################################
+# Uncomment the following line for direct access to Django settings such as
+# MIDDLEWARE_CLASSES or APPS
+#from graphite.app_settings import *
View
2 templates/default/sv-carbon-cache-finish.erb
@@ -1,5 +1,5 @@
#!/bin/sh
-PIDFILE="<%= node['graphite']['base_dir'] %>/storage/carbon-cache-a.pid"
+PIDFILE="<%= node['graphite']['storage_dir'] %>/carbon-cache-a.pid"
if [ -e $PIDFILE ]; then
rm -v $PIDFILE
View
2 templates/default/sv-carbon-cache-run.erb
@@ -1,3 +1,3 @@
#!/bin/sh
exec 2>&1
-exec chpst -u <%= node['apache']['user'] %>:<%= node['apache']['group'] %> -l <%= node['graphite']['base_dir'] %>/storage/carbon-cache.lock -- <%= node['graphite']['base_dir']%>/bin/carbon-cache.py --debug start
+exec chpst -u <%= node['apache']['user'] %> -l <%= node['graphite']['storage_dir'] %>/carbon-cache.lock -- <%= node['graphite']['base_dir']%>/bin/carbon-cache.py --debug start
View
2 templates/default/sv-twistd-carbon-cache-run.erb
@@ -1,3 +1,3 @@
#!/bin/sh
exec 2>&1
-exec chpst -u <%= node['apache']['user'] %>:<%= node['apache']['group'] %> -l <%= node['graphite']['base_dir'] %>/storage/carbon-cache.lock -- bash -c twistd --nodaemon --umask=0022 carbon-cache -c <%= node['graphite']['base_dir']%>/conf/carbon.conf --instance=a start
+exec chpst -u <%= node['apache']['user'] %> -l <%= node['graphite']['storage_dir'] %>/carbon-cache.lock -- bash -c twistd --nodaemon --umask=0022 carbon-cache -c <%= node['graphite']['base_dir']%>/conf/carbon.conf --instance=a start

0 comments on commit 43aadd7

Please sign in to comment.