rubber 2.12.2 → 2.13.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.
- checksums.yaml +4 -4
- data/CHANGELOG +27 -0
- data/lib/rubber/cli.rb +0 -1
- data/lib/rubber/cloud/aws_table_store.rb +1 -1
- data/lib/rubber/cloud/fog_storage.rb +1 -1
- data/lib/rubber/cloud/vsphere.rb +23 -1
- data/lib/rubber/commands/vulcanize.rb +1 -1
- data/lib/rubber/dns/aws.rb +4 -3
- data/lib/rubber/generator.rb +6 -2
- data/lib/rubber/instance.rb +48 -6
- data/lib/rubber/recipes/rubber.rb +8 -0
- data/lib/rubber/recipes/rubber/deploy.rb +9 -3
- data/lib/rubber/recipes/rubber/instances.rb +1 -0
- data/lib/rubber/recipes/rubber/setup.rb +10 -2
- data/lib/rubber/recipes/rubber/static_ips.rb +1 -1
- data/lib/rubber/recipes/rubber/utils.rb +8 -2
- data/lib/rubber/version.rb +1 -1
- data/templates/apache/config/rubber/deploy-apache.rb +1 -1
- data/templates/apache/config/rubber/role/web_tools/tools-apache-vhost.conf +8 -0
- data/templates/apache/config/rubber/rubber-apache.yml +2 -2
- data/templates/base/config/rubber/deploy-util.rb +3 -3
- data/templates/base/config/rubber/rubber.yml +8 -3
- data/templates/cassandra/config/rubber/deploy-cassandra.rb +2 -2
- data/templates/collectd/config/rubber/role/collectd/collectd-ping.conf +11 -2
- data/templates/collectd/config/rubber/role/collectd/thresholds.conf +1 -1
- data/templates/collectd/script/collectd/role/redis/redis_info.rb +0 -1
- data/templates/cruise/config/rubber/role/cruise/my.cnf +1 -1
- data/templates/graphite/config/rubber/deploy-graphite.rb +125 -69
- data/templates/graphite/config/rubber/role/graphite_server/carbon.conf +150 -26
- data/templates/graphite/config/rubber/role/graphite_server/graphite-carbon-default.conf +8 -0
- data/templates/graphite/config/rubber/role/graphite_server/graphite_server-upstart.conf +3 -0
- data/templates/graphite/config/rubber/role/graphite_server/storage-schemas.conf +2 -1
- data/templates/graphite/config/rubber/role/graphite_web/crontab +1 -1
- data/templates/graphite/config/rubber/role/graphite_web/dashboard.conf +1 -1
- data/templates/graphite/config/rubber/role/graphite_web/dashboard.html +1 -1
- data/templates/graphite/config/rubber/role/graphite_web/graphite.wsgi +4 -1
- data/templates/graphite/config/rubber/role/graphite_web/local_settings.py +171 -41
- data/templates/graphite/config/rubber/role/graphite_web/uwsgi.ini +6 -3
- data/templates/graphite/config/rubber/rubber-graphite.yml +7 -1
- data/templates/graphite/templates.rb +9 -0
- data/templates/graylog/config/rubber/common/graylog-rsyslog.conf +1 -1
- data/templates/graylog/config/rubber/role/graylog_server/graylog2.conf +2 -2
- data/templates/jenkins/config/rubber/role/jenkins/jenkins-apache-vhost.conf +5 -0
- data/templates/memcached/config/rubber/role/memcached/memcached.conf +1 -1
- data/templates/mysql/config/rubber/deploy-mysql.rb +2 -2
- data/templates/mysql/config/rubber/role/db/my.cnf +1 -1
- data/templates/mysql_cluster/config/rubber/deploy-mysql_cluster.rb +3 -3
- data/templates/mysql_cluster/config/rubber/role/mysql_sql/my.cnf +1 -1
- data/templates/passenger/config/rubber/role/passenger/passenger-apache-vhost.conf +12 -0
- data/templates/passenger/config/rubber/rubber-passenger.yml +1 -1
- data/templates/passenger_nginx/config/rubber/role/passenger_nginx/nginx.conf +1 -1
- data/templates/percona/config/rubber/deploy-percona.rb +2 -2
- data/templates/percona/config/rubber/role/db/my.cnf +1 -1
- data/templates/postgresql/config/rubber/deploy-postgresql.rb +4 -8
- data/templates/postgresql/config/rubber/role/postgresql/pg_hba.conf +1 -1
- data/templates/postgresql/config/rubber/role/postgresql/postgresql.conf +1 -1
- data/templates/redis/config/rubber/role/redis/redis.conf +1 -1
- data/templates/torquebox/config/rubber/role/app/torquebox-apache-vhost.conf +12 -0
- metadata +4 -2
@@ -1,5 +1,10 @@
|
|
1
1
|
<%
|
2
|
+
is_old_ubuntu = %w[10.04 12.04].include?(rubber_instance.os_version)
|
3
|
+
|
4
|
+
# Apache 2.2 requires no extension while Apache 2.4 requires the '.conf' extension.
|
2
5
|
@path = "/etc/apache2/sites-available/#{rubber_env.app_name}-tools"
|
6
|
+
@path << '.conf' unless is_old_ubuntu
|
7
|
+
|
3
8
|
@post = <<-EOS
|
4
9
|
a2enmod rewrite
|
5
10
|
a2enmod ssl
|
@@ -17,7 +22,10 @@ Listen <%= rubber_env.web_tools_port %>
|
|
17
22
|
RewriteEngine on
|
18
23
|
RewriteCond %{HTTPS} !=on
|
19
24
|
RewriteRule ^/(.*)$ https://%{SERVER_NAME}:<%= rubber_env.web_tools_ssl_port %>/$1 [L,R]
|
25
|
+
|
26
|
+
<%- if is_old_ubuntu %>
|
20
27
|
RewriteLog "/var/log/apache2/rewrite.log"
|
28
|
+
<% end %>
|
21
29
|
</VirtualHost>
|
22
30
|
|
23
31
|
Listen <%= rubber_env.web_tools_ssl_port %>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
roles:
|
3
3
|
apache:
|
4
|
-
packages: [apache2, libapache2-mod-proxy-html, libcurl4-openssl-dev, libapache2-mod-xsendfile]
|
4
|
+
packages: [apache2, apache2-utils, libapache2-mod-proxy-html, libcurl4-openssl-dev, libapache2-mod-xsendfile]
|
5
5
|
web_tools:
|
6
|
-
packages: [apache2, libapache2-mod-proxy-html, libcurl4-openssl-dev, libapache2-mod-xsendfile]
|
6
|
+
packages: [apache2, apache2-utils, libapache2-mod-proxy-html, libcurl4-openssl-dev, libapache2-mod-xsendfile]
|
@@ -13,7 +13,7 @@ namespace :rubber do
|
|
13
13
|
# Select only one instance for backup. Favor slave database.
|
14
14
|
selected_db_instance = (slaves+master_instances).first
|
15
15
|
|
16
|
-
task_name = "_backup_db_#{selected_db_instance.full_name}".to_sym
|
16
|
+
task_name = "_backup_db_#{selected_db_instance.full_name}".to_sym
|
17
17
|
task task_name, :hosts => selected_db_instance.full_name do
|
18
18
|
rsudo "cd #{current_path} && RUBBER_ENV=#{Rubber.env} ./script/rubber util:backup_db --directory=/mnt/db_backups --dbuser=#{rubber_env.db_user} --dbpass=#{rubber_env.db_pass} --dbname=#{rubber_env.db_name} --dbhost=#{selected_db_instance.full_name}"
|
19
19
|
end
|
@@ -29,7 +29,7 @@ namespace :rubber do
|
|
29
29
|
slaves = rubber_instances.for_role('db', {})
|
30
30
|
|
31
31
|
for instance in master_instances+slaves
|
32
|
-
task_name = "_restore_db_cloud_#{instance.full_name}".to_sym
|
32
|
+
task_name = "_restore_db_cloud_#{instance.full_name}".to_sym
|
33
33
|
task task_name, :hosts => instance.full_name do
|
34
34
|
rsudo "cd #{current_path} && RUBBER_ENV=#{Rubber.env} ./script/rubber util:restore_db --filename=#{filename} --dbuser=#{rubber_env.db_user} --dbpass=#{rubber_env.db_pass} --dbname=#{rubber_env.db_name} --dbhost=#{instance.full_name}"
|
35
35
|
end
|
@@ -48,7 +48,7 @@ namespace :rubber do
|
|
48
48
|
# Select only one instance for backup. Favor slave database.
|
49
49
|
selected_db_instance = (slaves+master_instances).first
|
50
50
|
|
51
|
-
task_name = "_load_local_to_#{selected_db_instance.full_name}".to_sym
|
51
|
+
task_name = "_load_local_to_#{selected_db_instance.full_name}".to_sym
|
52
52
|
task task_name, :hosts => selected_db_instance.full_name do
|
53
53
|
|
54
54
|
# Dump Local to tmp folder
|
@@ -83,11 +83,11 @@ cloud_providers:
|
|
83
83
|
|
84
84
|
# REQUIRED: the ami and instance type for creating instances
|
85
85
|
# The Ubuntu images at http://alestic.com/ work well
|
86
|
-
# Ubuntu
|
86
|
+
# Ubuntu 14.04.1 Trusty instance-store 64-bit: ami-90c574f8
|
87
87
|
#
|
88
88
|
# m1.small or m1.large or m1.xlarge
|
89
89
|
image_type: c1.medium
|
90
|
-
image_id: ami-
|
90
|
+
image_id: ami-90c574f8
|
91
91
|
|
92
92
|
# OPTIONAL: EC2 spot instance request support.
|
93
93
|
#
|
@@ -118,7 +118,7 @@ cloud_providers:
|
|
118
118
|
region: New York 2
|
119
119
|
|
120
120
|
# REQUIRED: The image name and type for creating instances.
|
121
|
-
image_id: Ubuntu
|
121
|
+
image_id: Ubuntu 14.04 x64
|
122
122
|
image_type: 512MB
|
123
123
|
|
124
124
|
# Optionally enable private networking for your instances.
|
@@ -265,6 +265,11 @@ packages: [postfix, build-essential, git-core, libxslt-dev, ntp]
|
|
265
265
|
# it, specify 'mirror://mirrors.ubuntu.com/mirrors.txt' as the value.
|
266
266
|
# package_manager_mirror: 'mirror://mirrors.ubuntu.com/mirrors.txt'
|
267
267
|
|
268
|
+
# OPTIONAL: The command used to identify your particular OS version. This will be used for configurations
|
269
|
+
# in Rubber templates that are parameterized by OS version (e.g., package lists). If not specified, Ubuntu
|
270
|
+
# will be assumed.
|
271
|
+
os_version_cmd: 'lsb_release -sr'
|
272
|
+
|
268
273
|
# OPTIONAL: gem sources to setup for rubygems
|
269
274
|
# gemsources: ["https://rubygems.org"]
|
270
275
|
|
@@ -50,7 +50,7 @@ namespace :rubber do
|
|
50
50
|
task :bootstrap, :roles => :cassandra do
|
51
51
|
instances = rubber_instances.for_role("cassandra") & rubber_instances.filtered
|
52
52
|
instances.each do |ic|
|
53
|
-
task_name = "_bootstrap_cassandra_#{ic.full_name}".to_sym
|
53
|
+
task_name = "_bootstrap_cassandra_#{ic.full_name}".to_sym
|
54
54
|
task task_name, :hosts => ic.full_name do
|
55
55
|
env = rubber_cfg.environment.bind("cassandra", ic.name)
|
56
56
|
exists = capture("echo $(ls #{env.cassandra_data_dirs.first}/ 2> /dev/null)")
|
@@ -86,7 +86,7 @@ namespace :rubber do
|
|
86
86
|
def clustertool(*args)
|
87
87
|
instances = rubber_instances.for_role("cassandra") & rubber_instances.filtered
|
88
88
|
ic = instances.first
|
89
|
-
task_name = "_clustertool_#{ic.full_name}_#{args.join('_')}".to_sym
|
89
|
+
task_name = "_clustertool_#{ic.full_name}_#{args.join('_')}".to_sym
|
90
90
|
task task_name, :hosts => ic.full_name do
|
91
91
|
rsudo "#{rubber_env.cassandra_dir}/bin/clustertool --host $CAPISTRANO:HOST$ --port #{rubber_env.cassandra_jmx_port} #{args.join(' ')}"
|
92
92
|
end
|
@@ -2,10 +2,10 @@
|
|
2
2
|
@path = '/etc/collectd/conf.d/collectd-ping.conf'
|
3
3
|
|
4
4
|
ping_hosts = []
|
5
|
-
if
|
5
|
+
if rubber_instance.role_names.include?('graphite_server')
|
6
6
|
# monitor all servers from graphite_server
|
7
7
|
ping_hosts = rubber_instances.collect {|ic| ic.full_name }.select {|h| h != rubber_env.full_host }
|
8
|
-
elsif
|
8
|
+
elsif rubber_instance.role_names.include?('web_tools')
|
9
9
|
# monitor just graphite_server from tools
|
10
10
|
ping_hosts = Array((rubber_instances.for_role('graphite_server').first.full_name rescue nil))
|
11
11
|
end
|
@@ -18,4 +18,13 @@ LoadPlugin ping
|
|
18
18
|
<% ping_hosts.each do |h| %>
|
19
19
|
Host "<%= h %>"
|
20
20
|
<% end %>
|
21
|
+
|
22
|
+
# Host "host.foo.bar"
|
23
|
+
# Host "host.baz.qux"
|
24
|
+
# Interval 1.0
|
25
|
+
# Timeout 0.9
|
26
|
+
# TTL 255
|
27
|
+
# SourceAddress "1.2.3.4"
|
28
|
+
# Device "eth0"
|
29
|
+
# MaxMissed -1
|
21
30
|
</Plugin>
|
@@ -22,33 +22,35 @@ namespace :rubber do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
task :install_graphite_from_repo, :roles => [:graphite_server, :graphite_web] do
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
25
|
+
if old_ubuntu?
|
26
|
+
rubber.sudo_script 'install_graphite_from_repo', <<-ENDSCRIPT
|
27
|
+
if [[ ! -d "/opt/graphite" ]]; then
|
28
|
+
mkdir -p /tmp/graphite_install
|
29
|
+
cd /tmp/graphite_install
|
30
|
+
bzr branch lp:graphite -r #{rubber_env.graphite_repo_version}
|
31
|
+
|
32
|
+
pushd graphite/whisper
|
33
|
+
python setup.py install
|
34
|
+
popd
|
35
|
+
|
36
|
+
pushd graphite/carbon
|
37
|
+
python setup.py install
|
38
|
+
popd
|
39
|
+
|
40
|
+
pushd graphite
|
41
|
+
python setup.py install
|
42
|
+
popd
|
43
|
+
fi
|
44
|
+
ENDSCRIPT
|
45
|
+
end
|
44
46
|
end
|
45
47
|
|
46
48
|
desc <<-DESC
|
47
|
-
Cleans out old whisper storage files for non-
|
49
|
+
Cleans out old whisper storage files for non-existent instances so they don't show in webui
|
48
50
|
DESC
|
49
51
|
task :clean_storage, :roles => [:graphite_server] do
|
50
52
|
active_instances = rubber_instances.collect {|ic| ic.name }.sort
|
51
|
-
stored_instances = capture("ls /
|
53
|
+
stored_instances = capture("ls #{rubber_env.graphite_storage_dir}/whisper/servers/").split.sort
|
52
54
|
cleaning_instances = stored_instances - active_instances
|
53
55
|
|
54
56
|
if cleaning_instances.size > 0
|
@@ -61,7 +63,7 @@ namespace :rubber do
|
|
61
63
|
end
|
62
64
|
|
63
65
|
if do_clean
|
64
|
-
rsudo "rm -rf /
|
66
|
+
rsudo "rm -rf #{rubber_env.graphite_storage_dir}/whisper/servers/{#{cleaning_instances.join(',')}}"
|
65
67
|
end
|
66
68
|
|
67
69
|
end
|
@@ -83,34 +85,38 @@ namespace :rubber do
|
|
83
85
|
Installs graphite server components
|
84
86
|
DESC
|
85
87
|
task :install, :roles => :graphite_server do
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
88
|
+
if old_ubuntu?
|
89
|
+
rubber.sudo_script 'install_graphite_server', <<-ENDSCRIPT
|
90
|
+
if [[ ! -f "/opt/graphite/bin/carbon-cache.py" ]]; then
|
91
|
+
wget --content-disposition -qNP /tmp #{rubber_env.graphite_whisper_package_url}
|
92
|
+
tar -C /tmp -zxf /tmp/whisper-#{rubber_env.graphite_version}.tar.gz
|
93
|
+
cd /tmp/whisper-#{rubber_env.graphite_version}
|
94
|
+
python setup.py install
|
95
|
+
cd /tmp
|
96
|
+
rm -rf whisper-#{rubber_env.graphite_version}
|
97
|
+
rm whisper-#{rubber_env.graphite_version}.tar.gz
|
98
|
+
|
99
|
+
wget --content-disposition -qNP /tmp #{rubber_env.graphite_carbon_package_url}
|
100
|
+
tar -C /tmp -zxf /tmp/carbon-#{rubber_env.graphite_version}.tar.gz
|
101
|
+
cd /tmp/carbon-#{rubber_env.graphite_version}
|
102
|
+
python setup.py install
|
103
|
+
cd /tmp
|
104
|
+
rm -r carbon-#{rubber_env.graphite_version}
|
105
|
+
rm carbon-#{rubber_env.graphite_version}.tar.gz
|
106
|
+
|
107
|
+
rm -rf #{rubber_env.graphite_storage_dir}
|
108
|
+
mkdir #{rubber_env.graphite_storage_dir}
|
109
|
+
chown www-data:www-data #{rubber_env.graphite_storage_dir}
|
110
|
+
ln -s #{rubber_env.graphite_storage_dir} /opt/graphite/storage
|
111
|
+
fi
|
112
|
+
ENDSCRIPT
|
113
|
+
end
|
95
114
|
|
96
|
-
|
97
|
-
tar -C /tmp -zxf /tmp/carbon-#{rubber_env.graphite_version}.tar.gz
|
98
|
-
cd /tmp/carbon-#{rubber_env.graphite_version}
|
99
|
-
python setup.py install
|
100
|
-
cd /tmp
|
101
|
-
rm -r carbon-#{rubber_env.graphite_version}
|
102
|
-
rm carbon-#{rubber_env.graphite_version}.tar.gz
|
103
|
-
|
104
|
-
rm -rf /opt/graphite/storage
|
105
|
-
mkdir #{rubber_env.graphite_storage_dir}
|
106
|
-
chown www-data:www-data #{rubber_env.graphite_storage_dir}
|
107
|
-
ln -s #{rubber_env.graphite_storage_dir} /opt/graphite/storage
|
108
|
-
fi
|
109
|
-
ENDSCRIPT
|
115
|
+
create_storage_directory
|
110
116
|
end
|
111
117
|
|
112
118
|
task :bootstrap, :roles => :graphite_server do
|
113
|
-
exists = capture("echo $(ls /
|
119
|
+
exists = capture("echo $(ls #{rubber_env.graphite_storage_dir}/whisper/ 2> /dev/null)")
|
114
120
|
if exists.strip.size == 0
|
115
121
|
rubber.update_code_for_bootstrap
|
116
122
|
|
@@ -122,12 +128,20 @@ namespace :rubber do
|
|
122
128
|
|
123
129
|
desc "Start graphite system monitoring"
|
124
130
|
task :start, :roles => :graphite_server do
|
125
|
-
|
131
|
+
if old_ubuntu?
|
132
|
+
rsudo 'service graphite-server start'
|
133
|
+
else
|
134
|
+
rsudo 'service carbon-cache start'
|
135
|
+
end
|
126
136
|
end
|
127
137
|
|
128
138
|
desc "Stop graphite system monitoring"
|
129
139
|
task :stop, :roles => :graphite_server do
|
130
|
-
|
140
|
+
if old_ubuntu?
|
141
|
+
rsudo 'service graphite-server stop || true'
|
142
|
+
else
|
143
|
+
rsudo 'service carbon-cache stop || true'
|
144
|
+
end
|
131
145
|
end
|
132
146
|
|
133
147
|
desc "Restart graphite system monitoring"
|
@@ -161,22 +175,26 @@ namespace :rubber do
|
|
161
175
|
Installs graphite web components
|
162
176
|
DESC
|
163
177
|
task :install, :roles => :graphite_web do
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
178
|
+
if old_ubuntu?
|
179
|
+
rubber.sudo_script 'install_graphite_web', <<-ENDSCRIPT
|
180
|
+
if [[ ! -d "/opt/graphite/webapp" ]]; then
|
181
|
+
wget --content-disposition -qNP /tmp #{rubber_env.graphite_web_package_url}
|
182
|
+
tar -C /tmp -zxf /tmp/graphite-web-#{rubber_env.graphite_version}.tar.gz
|
183
|
+
cd /tmp/graphite-web-#{rubber_env.graphite_version}
|
184
|
+
|
185
|
+
# python check-dependencies.py
|
186
|
+
python setup.py install
|
187
|
+
|
188
|
+
cd /tmp
|
189
|
+
rm -r graphite-web-#{rubber_env.graphite_version}
|
190
|
+
rm graphite-web-#{rubber_env.graphite_version}.tar.gz
|
191
|
+
fi
|
192
|
+
ENDSCRIPT
|
193
|
+
end
|
176
194
|
end
|
177
195
|
|
178
196
|
task :bootstrap, :roles => :graphite_web do
|
179
|
-
exists = capture("echo $(ls /
|
197
|
+
exists = capture("echo $(ls #{rubber_env.graphite_storage_dir}/graphite.db 2> /dev/null)")
|
180
198
|
if exists.strip.size == 0
|
181
199
|
rubber.update_code_for_bootstrap
|
182
200
|
|
@@ -188,19 +206,42 @@ namespace :rubber do
|
|
188
206
|
env = rubber_cfg.environment.bind("graphite_web", web_instance.name)
|
189
207
|
email = env.admin_email
|
190
208
|
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
209
|
+
create_storage_directory
|
210
|
+
|
211
|
+
if old_ubuntu?
|
212
|
+
rubber.sudo_script 'bootstrap_graphite_web', <<-ENDSCRIPT
|
213
|
+
mkdir -p #{rubber_env.graphite_storage_dir}/log/webapp/
|
214
|
+
chown -R www-data:www-data #{rubber_env.graphite_storage_dir}/log/
|
215
|
+
|
216
|
+
cd /opt/graphite/webapp/graphite
|
217
|
+
python manage.py syncdb --noinput
|
218
|
+
python manage.py createsuperuser --username admin --email #{email} --noinput
|
219
|
+
python manage.py shell <<EOF
|
196
220
|
from django.contrib.auth.models import User
|
197
221
|
u = User.objects.get(username__exact='admin')
|
198
222
|
u.set_password('admin1')
|
199
223
|
u.save()
|
200
224
|
EOF
|
201
|
-
|
202
|
-
|
203
|
-
|
225
|
+
ENDSCRIPT
|
226
|
+
else
|
227
|
+
rubber.sudo_script 'bootstrap_graphite_web', <<-ENDSCRIPT
|
228
|
+
# Ubuntu 14.04 ships with a broken graphite-web package. It renames the build-index.sh file to be a binary
|
229
|
+
# on the PATH, but it fails to update any of the code that references the original file location, causing
|
230
|
+
# graphite-web to fail on initial load. We fix that here by setting up a symlink to the renamed binary.
|
231
|
+
|
232
|
+
mkdir -p /usr/share/graphite-web/bin/
|
233
|
+
ln -s /usr/bin/graphite-build-search-index /usr/share/graphite-web/bin/build-index.sh
|
234
|
+
|
235
|
+
graphite-manage syncdb --noinput
|
236
|
+
graphite-manage createsuperuser --username admin --email #{email} --noinput
|
237
|
+
graphite-manage shell <<EOF
|
238
|
+
from django.contrib.auth.models import User
|
239
|
+
u = User.objects.get(username__exact='admin')
|
240
|
+
u.set_password('admin1')
|
241
|
+
u.save()
|
242
|
+
EOF
|
243
|
+
ENDSCRIPT
|
244
|
+
end
|
204
245
|
|
205
246
|
restart
|
206
247
|
end
|
@@ -231,6 +272,21 @@ EOF
|
|
231
272
|
|
232
273
|
end
|
233
274
|
|
275
|
+
def create_storage_directory
|
276
|
+
owner = old_ubuntu? ? 'www-data' : '_graphite'
|
277
|
+
|
278
|
+
rubber.sudo_script 'create_graphite_storage_directory', <<-ENDSCRIPT
|
279
|
+
if [[ ! -e #{rubber_env.graphite_storage_dir} ]]; then
|
280
|
+
mkdir -p #{rubber_env.graphite_storage_dir}
|
281
|
+
chown -R #{owner}:www-data #{rubber_env.graphite_storage_dir}
|
282
|
+
fi
|
283
|
+
ENDSCRIPT
|
284
|
+
end
|
285
|
+
|
286
|
+
def old_ubuntu?
|
287
|
+
%w[10.04 12.04].include?(rubber_instance.os_version)
|
288
|
+
end
|
289
|
+
|
234
290
|
end
|
235
291
|
|
236
292
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
<%
|
2
|
-
|
2
|
+
is_old_ubuntu = %w[10.04 12.04].include?(rubber_instance.os_version)
|
3
|
+
|
4
|
+
@path = is_old_ubuntu ? "#{rubber_env.graphite_dir}/conf/carbon.conf" : '/etc/carbon/carbon.conf'
|
3
5
|
%>
|
4
6
|
[cache]
|
5
7
|
# Configure carbon directories.
|
@@ -17,26 +19,24 @@
|
|
17
19
|
# To change other directory paths, add settings to this file. The following
|
18
20
|
# configuration variables are available with these default values:
|
19
21
|
#
|
20
|
-
|
21
|
-
|
22
|
-
#
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
#
|
29
|
-
|
30
|
-
# CONF_DIR = /etc/carbon/
|
31
|
-
# LOG_DIR = /var/log/carbon/
|
32
|
-
# PID_DIR = /var/run/
|
33
|
-
#
|
34
|
-
LOCAL_DATA_DIR = /opt/graphite/storage/whisper/
|
22
|
+
|
23
|
+
STORAGE_DIR = <%= rubber_env.graphite_storage_dir %>/
|
24
|
+
CONF_DIR = <%= is_old_ubuntu ? "#{rubber_env.graphite_dir}/conf/" : '/etc/carbon/' %>
|
25
|
+
LOG_DIR = /var/log/carbon/
|
26
|
+
PID_DIR = /var/run/
|
27
|
+
|
28
|
+
LOCAL_DATA_DIR = <%= rubber_env.graphite_storage_dir %>/whisper/
|
29
|
+
|
30
|
+
# Enable daily log rotation. If disabled, a kill -HUP can be used after a manual rotate
|
31
|
+
ENABLE_LOGROTATION = False
|
35
32
|
|
36
33
|
# Specify the user to drop privileges to
|
37
34
|
# If this is blank carbon runs as the user that invokes it
|
38
35
|
# This user must have write access to the local data directory
|
39
|
-
USER =
|
36
|
+
USER = <%= is_old_ubuntu ? '' : '_graphite' %>
|
37
|
+
#
|
38
|
+
# NOTE: The above settings must be set under [relay] and [aggregator]
|
39
|
+
# to take effect for those daemons as well
|
40
40
|
|
41
41
|
# Limit the size of the cache to avoid swapping or becoming CPU bound.
|
42
42
|
# Sorts and serving cache queries gets more expensive as the cache grows.
|
@@ -50,6 +50,12 @@ MAX_CACHE_SIZE = inf
|
|
50
50
|
# take effect and increase the overall throughput accordingly.
|
51
51
|
MAX_UPDATES_PER_SECOND = 1000
|
52
52
|
|
53
|
+
# If defined, this changes the MAX_UPDATES_PER_SECOND in Carbon when a
|
54
|
+
# stop/shutdown is initiated. This helps when MAX_UPDATES_PER_SECOND is
|
55
|
+
# relatively low and carbon has cached a lot of updates; it enables the carbon
|
56
|
+
# daemon to shutdown more quickly.
|
57
|
+
# MAX_UPDATES_PER_SECOND_ON_SHUTDOWN = 1000
|
58
|
+
|
53
59
|
# Softly limits the number of whisper files that get created each minute.
|
54
60
|
# Setting this value low (like at 50) is a good way to ensure your graphite
|
55
61
|
# system will not be adversely impacted when a bunch of new metrics are
|
@@ -72,6 +78,9 @@ UDP_RECEIVER_PORT = 2003
|
|
72
78
|
PICKLE_RECEIVER_INTERFACE = 0.0.0.0
|
73
79
|
PICKLE_RECEIVER_PORT = 2004
|
74
80
|
|
81
|
+
# Set to false to disable logging of successful connections
|
82
|
+
LOG_LISTENER_CONNECTIONS = True
|
83
|
+
|
75
84
|
# Per security concerns outlined in Bug #817247 the pickle receiver
|
76
85
|
# will use a more secure and slightly less efficient unpickler.
|
77
86
|
# Set this to True to revert to the old-fashioned insecure unpickler.
|
@@ -86,15 +95,74 @@ CACHE_QUERY_PORT = <%= rubber_env.graphite_carbon_port %>
|
|
86
95
|
# data until the cache size falls below 95% MAX_CACHE_SIZE.
|
87
96
|
USE_FLOW_CONTROL = True
|
88
97
|
|
89
|
-
# By default, carbon-cache will log every whisper update. This can be excessive and
|
98
|
+
# By default, carbon-cache will log every whisper update and cache hit. This can be excessive and
|
90
99
|
# degrade performance if logging on the same volume as the whisper data is stored.
|
91
100
|
LOG_UPDATES = False
|
101
|
+
LOG_CACHE_HITS = False
|
102
|
+
LOG_CACHE_QUEUE_SORTS = True
|
103
|
+
|
104
|
+
# The thread that writes metrics to disk can use on of the following strategies
|
105
|
+
# determining the order in which metrics are removed from cache and flushed to
|
106
|
+
# disk. The default option preserves the same behavior as has been historically
|
107
|
+
# available in version 0.9.10.
|
108
|
+
#
|
109
|
+
# sorted - All metrics in the cache will be counted and an ordered list of
|
110
|
+
# them will be sorted according to the number of datapoints in the cache at the
|
111
|
+
# moment of the list's creation. Metrics will then be flushed from the cache to
|
112
|
+
# disk in that order.
|
113
|
+
#
|
114
|
+
# max - The writer thread will always pop and flush the metric from cache
|
115
|
+
# that has the most datapoints. This will give a strong flush preference to
|
116
|
+
# frequently updated metrics and will also reduce random file-io. Infrequently
|
117
|
+
# updated metrics may only ever be persisted to disk at daemon shutdown if
|
118
|
+
# there are a large number of metrics which receive very frequent updates OR if
|
119
|
+
# disk i/o is very slow.
|
120
|
+
#
|
121
|
+
# naive - Metrics will be flushed from the cache to disk in an unordered
|
122
|
+
# fashion. This strategy may be desirable in situations where the storage for
|
123
|
+
# whisper files is solid state, CPU resources are very limited or deference to
|
124
|
+
# the OS's i/o scheduler is expected to compensate for the random write
|
125
|
+
# pattern.
|
126
|
+
#
|
127
|
+
CACHE_WRITE_STRATEGY = sorted
|
92
128
|
|
93
129
|
# On some systems it is desirable for whisper to write synchronously.
|
94
130
|
# Set this option to True if you'd like to try this. Basically it will
|
95
131
|
# shift the onus of buffering writes from the kernel into carbon's cache.
|
96
132
|
WHISPER_AUTOFLUSH = False
|
97
133
|
|
134
|
+
# By default new Whisper files are created pre-allocated with the data region
|
135
|
+
# filled with zeros to prevent fragmentation and speed up contiguous reads and
|
136
|
+
# writes (which are common). Enabling this option will cause Whisper to create
|
137
|
+
# the file sparsely instead. Enabling this option may allow a large increase of
|
138
|
+
# MAX_CREATES_PER_MINUTE but may have longer term performance implications
|
139
|
+
# depending on the underlying storage configuration.
|
140
|
+
# WHISPER_SPARSE_CREATE = False
|
141
|
+
|
142
|
+
# Only beneficial on linux filesystems that support the fallocate system call.
|
143
|
+
# It maintains the benefits of contiguous reads/writes, but with a potentially
|
144
|
+
# much faster creation speed, by allowing the kernel to handle the block
|
145
|
+
# allocation and zero-ing. Enabling this option may allow a large increase of
|
146
|
+
# MAX_CREATES_PER_MINUTE. If enabled on an OS or filesystem that is unsupported
|
147
|
+
# this option will gracefully fallback to standard POSIX file access methods.
|
148
|
+
WHISPER_FALLOCATE_CREATE = True
|
149
|
+
|
150
|
+
# Enabling this option will cause Whisper to lock each Whisper file it writes
|
151
|
+
# to with an exclusive lock (LOCK_EX, see: man 2 flock). This is useful when
|
152
|
+
# multiple carbon-cache daemons are writing to the same files
|
153
|
+
# WHISPER_LOCK_WRITES = False
|
154
|
+
|
155
|
+
# Set this to True to enable whitelisting and blacklisting of metrics in
|
156
|
+
# CONF_DIR/whitelist and CONF_DIR/blacklist. If the whitelist is missing or
|
157
|
+
# empty, all metrics will pass through
|
158
|
+
# USE_WHITELIST = False
|
159
|
+
|
160
|
+
# By default, carbon itself will log statistics (such as a count,
|
161
|
+
# metricsReceived) with the top level prefix of 'carbon' at an interval of 60
|
162
|
+
# seconds. Set CARBON_METRIC_INTERVAL to 0 to disable instrumentation
|
163
|
+
# CARBON_METRIC_PREFIX = carbon
|
164
|
+
# CARBON_METRIC_INTERVAL = 60
|
165
|
+
|
98
166
|
# Enable AMQP if you want to receve metrics using an amqp broker
|
99
167
|
# ENABLE_AMQP = False
|
100
168
|
|
@@ -132,13 +200,15 @@ WHISPER_AUTOFLUSH = False
|
|
132
200
|
# Example: store everything
|
133
201
|
# BIND_PATTERNS = #
|
134
202
|
|
135
|
-
# To configure special settings for the
|
136
|
-
#[cache:
|
203
|
+
# To configure special settings for the carbon-cache instance 'b', uncomment this:
|
204
|
+
#[cache:b]
|
137
205
|
#LINE_RECEIVER_PORT = 2103
|
138
206
|
#PICKLE_RECEIVER_PORT = 2104
|
139
207
|
#CACHE_QUERY_PORT = 7102
|
140
208
|
# and any other settings you want to customize, defaults are inherited
|
141
209
|
# from [carbon] section.
|
210
|
+
# You can then specify the --instance=b option to manage this instance
|
211
|
+
|
142
212
|
|
143
213
|
|
144
214
|
[relay]
|
@@ -147,14 +217,27 @@ LINE_RECEIVER_PORT = 2013
|
|
147
217
|
PICKLE_RECEIVER_INTERFACE = 0.0.0.0
|
148
218
|
PICKLE_RECEIVER_PORT = 2014
|
149
219
|
|
150
|
-
#
|
151
|
-
|
152
|
-
|
220
|
+
# Set to false to disable logging of successful connections
|
221
|
+
LOG_LISTENER_CONNECTIONS = True
|
222
|
+
|
223
|
+
# Carbon-relay has several options for metric routing controlled by RELAY_METHOD
|
224
|
+
#
|
225
|
+
# Use relay-rules.conf to route metrics to destinations based on pattern rules
|
226
|
+
#RELAY_METHOD = rules
|
227
|
+
#
|
228
|
+
# Use consistent-hashing for even distribution of metrics between destinations
|
229
|
+
#RELAY_METHOD = consistent-hashing
|
230
|
+
#
|
231
|
+
# Use consistent-hashing but take into account an aggregation-rules.conf shared
|
232
|
+
# by downstream carbon-aggregator daemons. This will ensure that all metrics
|
233
|
+
# that map to a given aggregation rule are sent to the same carbon-aggregator
|
234
|
+
# instance.
|
235
|
+
# Enable this for carbon-relays that send to a group of carbon-aggregators
|
236
|
+
#RELAY_METHOD = aggregated-consistent-hashing
|
153
237
|
RELAY_METHOD = rules
|
154
238
|
|
155
|
-
# If you use consistent-hashing you
|
156
|
-
#
|
157
|
-
# one machine.
|
239
|
+
# If you use consistent-hashing you can add redundancy by replicating every
|
240
|
+
# datapoint to more than one machine.
|
158
241
|
REPLICATION_FACTOR = 1
|
159
242
|
|
160
243
|
# This is a list of carbon daemons we will send any relayed or
|
@@ -170,6 +253,9 @@ REPLICATION_FACTOR = 1
|
|
170
253
|
# Note that if the destinations are all carbon-caches then this should
|
171
254
|
# exactly match the webapp's CARBONLINK_HOSTS setting in terms of
|
172
255
|
# instances listed (order matters!).
|
256
|
+
#
|
257
|
+
# If using RELAY_METHOD = rules, all destinations used in relay-rules.conf
|
258
|
+
# must be defined in this list
|
173
259
|
DESTINATIONS = 127.0.0.1:2004
|
174
260
|
|
175
261
|
# This defines the maximum "message size" between carbon daemons.
|
@@ -183,6 +269,17 @@ MAX_QUEUE_SIZE = 10000
|
|
183
269
|
# data until the send queues fall below 80% MAX_QUEUE_SIZE.
|
184
270
|
USE_FLOW_CONTROL = True
|
185
271
|
|
272
|
+
# Set this to True to enable whitelisting and blacklisting of metrics in
|
273
|
+
# CONF_DIR/whitelist and CONF_DIR/blacklist. If the whitelist is missing or
|
274
|
+
# empty, all metrics will pass through
|
275
|
+
# USE_WHITELIST = False
|
276
|
+
|
277
|
+
# By default, carbon itself will log statistics (such as a count,
|
278
|
+
# metricsReceived) with the top level prefix of 'carbon' at an interval of 60
|
279
|
+
# seconds. Set CARBON_METRIC_INTERVAL to 0 to disable instrumentation
|
280
|
+
# CARBON_METRIC_PREFIX = carbon
|
281
|
+
# CARBON_METRIC_INTERVAL = 60
|
282
|
+
|
186
283
|
|
187
284
|
[aggregator]
|
188
285
|
LINE_RECEIVER_INTERFACE = 0.0.0.0
|
@@ -191,6 +288,14 @@ LINE_RECEIVER_PORT = 2023
|
|
191
288
|
PICKLE_RECEIVER_INTERFACE = 0.0.0.0
|
192
289
|
PICKLE_RECEIVER_PORT = 2024
|
193
290
|
|
291
|
+
# Set to false to disable logging of successful connections
|
292
|
+
LOG_LISTENER_CONNECTIONS = True
|
293
|
+
|
294
|
+
# If set true, metric received will be forwarded to DESTINATIONS in addition to
|
295
|
+
# the output of the aggregation rules. If set false the carbon-aggregator will
|
296
|
+
# only ever send the output of aggregation.
|
297
|
+
FORWARD_ALL = True
|
298
|
+
|
194
299
|
# This is a list of carbon daemons we will send any relayed or
|
195
300
|
# generated metrics to. The default provided would send to a single
|
196
301
|
# carbon-cache instance on the default port. However if you
|
@@ -230,3 +335,22 @@ MAX_DATAPOINTS_PER_MESSAGE = 500
|
|
230
335
|
# each metric. Aggregation only happens for datapoints that fall in
|
231
336
|
# the past MAX_AGGREGATION_INTERVALS * intervalSize seconds.
|
232
337
|
MAX_AGGREGATION_INTERVALS = 5
|
338
|
+
|
339
|
+
# By default (WRITE_BACK_FREQUENCY = 0), carbon-aggregator will write back
|
340
|
+
# aggregated data points once every rule.frequency seconds, on a per-rule basis.
|
341
|
+
# Set this (WRITE_BACK_FREQUENCY = N) to write back all aggregated data points
|
342
|
+
# every N seconds, independent of rule frequency. This is useful, for example,
|
343
|
+
# to be able to query partially aggregated metrics from carbon-cache without
|
344
|
+
# having to first wait rule.frequency seconds.
|
345
|
+
# WRITE_BACK_FREQUENCY = 0
|
346
|
+
|
347
|
+
# Set this to True to enable whitelisting and blacklisting of metrics in
|
348
|
+
# CONF_DIR/whitelist and CONF_DIR/blacklist. If the whitelist is missing or
|
349
|
+
# empty, all metrics will pass through
|
350
|
+
# USE_WHITELIST = False
|
351
|
+
|
352
|
+
# By default, carbon itself will log statistics (such as a count,
|
353
|
+
# metricsReceived) with the top level prefix of 'carbon' at an interval of 60
|
354
|
+
# seconds. Set CARBON_METRIC_INTERVAL to 0 to disable instrumentation
|
355
|
+
# CARBON_METRIC_PREFIX = carbon
|
356
|
+
# CARBON_METRIC_INTERVAL = 60
|