This repository has been archived by the owner on Sep 16, 2021. It is now read-only.
forked from hectcastro/chef-statsd
/
dashboard.rb
70 lines (58 loc) · 1.61 KB
/
dashboard.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
include_recipe "apache2::mod_python"
[ "python-cairo-dev", "python-django", "python-django-tagging", "python-memcache", "python-rrdtool" ].each do |graphite_package|
package graphite_package do
action :install
end
end
python_pip "graphite-web" do
version node["graphite"]["version"]
action :install
end
template "/opt/graphite/conf/graphTemplates.conf" do
mode "0644"
source "graphTemplates.conf.erb"
owner node["apache"]["user"]
group node["apache"]["group"]
notifies :restart, "service[apache2]"
end
template "/opt/graphite/webapp/graphite/local_settings.py" do
mode "0644"
source "local_settings.py.erb"
owner node["apache"]["user"]
group node["apache"]["group"]
variables(
:timezone => node["graphite"]["dashboard"]["timezone"],
:memcache_hosts => node["graphite"]["dashboard"]["memcache_hosts"]
)
notifies :restart, "service[apache2]"
end
apache_site "000-default" do
enable false
end
web_app "graphite" do
template "graphite.conf.erb"
docroot "/opt/graphite/webapp"
server_name "graphite"
end
[ "log", "whisper" ].each do |dir|
directory "/opt/graphite/storage/#{dir}" do
owner node["apache"]["user"]
group node["apache"]["group"]
end
end
directory "/opt/graphite/storage/log/webapp" do
owner node["apache"]["user"]
group node["apache"]["group"]
end
cookbook_file "/opt/graphite/storage/graphite.db" do
owner node["apache"]["user"]
group node["apache"]["group"]
action :create_if_missing
end
logrotate_app "dashboard" do
cookbook "logrotate"
path "/opt/graphite/storage/log/webapp/*.log"
frequency "daily"
rotate 7
create "644 root root"
end