rubber 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +3 -2
- data/CHANGELOG +48 -6
- data/Gemfile +3 -1
- data/lib/rubber/dns/fog.rb +73 -13
- data/lib/rubber/environment.rb +1 -1
- data/lib/rubber/generator.rb +8 -2
- data/lib/rubber/recipes/rubber/setup.rb +14 -3
- data/lib/rubber/recipes/rubber/volumes.rb +20 -5
- data/lib/rubber/version.rb +1 -1
- data/rubber.gemspec +1 -0
- data/templates/apache/config/rubber/role/web_tools/tools-apache-vhost.conf +5 -1
- data/templates/apache/config/rubber/role/web_tools/tools-index.html +1 -1
- data/templates/base/config/rubber/common/crontab +0 -3
- data/templates/base/config/rubber/common/ntp-sysctl.conf +7 -0
- data/templates/base/config/rubber/common/ntp.conf +57 -0
- data/templates/base/config/rubber/rubber.yml +2 -2
- data/templates/base/templates.rb +1 -1
- data/templates/collectd/script/collectd/collectd-runner.rb +0 -0
- data/templates/elasticsearch/config/rubber/deploy-elasticsearch.rb +3 -0
- data/templates/elasticsearch/config/rubber/rubber-elasticsearch.yml +8 -2
- data/templates/graphite/config/rubber/role/graphite_web/dashboard.html +4 -4
- data/templates/passenger/config/rubber/deploy-passenger.rb +1 -1
- data/templates/redis/config/rubber/rubber-redis.yml +1 -1
- data/templates/resque/config/rubber/role/resque_worker/resque-pool-upstart.conf +2 -2
- data/templates/zookeeper/config/rubber/deploy-zookeeper.rb +1 -1
- data/test/dns/fog_test.rb +135 -111
- data/test/test_helper.rb +6 -3
- metadata +24 -40
data/.travis.yml
CHANGED
data/CHANGELOG
CHANGED
@@ -1,13 +1,55 @@
|
|
1
|
-
2.0.
|
2
|
-
|
1
|
+
2.0.2 (05/08/2012)
|
2
|
+
|
3
|
+
New Features:
|
4
|
+
============
|
5
|
+
|
6
|
+
[graylog] Added an admin UI for ElasticSearch
|
7
|
+
|
8
|
+
Improvements:
|
9
|
+
============
|
10
|
+
|
11
|
+
[base] Use ntpd instead of cron for syncing time
|
12
|
+
[core] Auto-reboot for kernel updates on initial instance bootstrap rather than prompting the user to reboot
|
13
|
+
[redis] Upgraded to redis 2.4.12 from 2.4.11
|
14
|
+
|
15
|
+
Bug Fixes:
|
16
|
+
=========
|
17
|
+
|
18
|
+
[core] Fixed issue with Route 53 DNS not updating records properly
|
19
|
+
[core] Wait for EBS volumes to be fully attached before trying to format them
|
20
|
+
[core] Fixed issue with running `rubber config` locally
|
21
|
+
[collectd] Made the runner executable
|
22
|
+
[graphite] Fixed some broken URLs in the dashboard
|
23
|
+
[passenger] Fixed issue with using a path to config.ru before capistrano completed setting it up.
|
24
|
+
[resque] Replaced a hard-coded reference to the resque-pool PID file with the rubber configured one
|
25
|
+
[resque] Append to the resque-pool.log file rather than overwrite it
|
26
|
+
[zookeeper] Fixed the detection of an existing zookeeper installation
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
2.0.1 (04/29/2012)
|
31
|
+
----------
|
32
|
+
|
33
|
+
New Features:
|
34
|
+
============
|
35
|
+
|
36
|
+
[base] Added the ability to supply additional arguments to RVM (e.g., to install additional patches or modify compile arguments)
|
37
|
+
[graphite] Added a simple graphite dashboard suitable for TV display
|
3
38
|
|
4
39
|
Improvements:
|
5
40
|
============
|
6
41
|
|
7
|
-
Upgraded to redis 2.4.11 from 2.4.6
|
8
|
-
Upgraded to RVM 1.13.0 from 1.10.2
|
9
|
-
Upgraded to Ubuntu 12.04
|
10
|
-
|
42
|
+
[redis] Upgraded to redis 2.4.11 from 2.4.6
|
43
|
+
[base] Upgraded to RVM 1.13.0 from 1.10.2
|
44
|
+
[base] Upgraded to Ubuntu 12.04
|
45
|
+
|
46
|
+
Bug Fixes:
|
47
|
+
=========
|
48
|
+
|
49
|
+
[base] Assorted fixes/workarounds for 12.04
|
50
|
+
[collectd] Fixed an issue with libperl and collectd
|
51
|
+
[redis] Fixed an issue with the redis role not installing the zip packaged, needed for backup
|
52
|
+
|
11
53
|
|
12
54
|
2.0.0 (04/24/2012)
|
13
55
|
----------
|
data/Gemfile
CHANGED
data/lib/rubber/dns/fog.rb
CHANGED
@@ -12,25 +12,60 @@ module Rubber
|
|
12
12
|
super(env)
|
13
13
|
creds = Rubber::Util.symbolize_keys(env.credentials)
|
14
14
|
@client = ::Fog::DNS.new(creds)
|
15
|
+
@name_includes_domain = env.name_includes_domain
|
16
|
+
@name_includes_trailing_period = env.name_includes_trailing_period
|
15
17
|
end
|
18
|
+
|
19
|
+
def normalize_name(name, domain)
|
20
|
+
domain = domain.gsub(/\.$/, "") if @name_includes_trailing_period
|
16
21
|
|
22
|
+
name = name.gsub(/\.$/, "") if @name_includes_trailing_period
|
23
|
+
name = name.gsub(/.?#{domain}$/, "") if @name_includes_domain
|
24
|
+
|
25
|
+
return name, domain
|
26
|
+
end
|
27
|
+
|
28
|
+
def denormalize_name(name, domain)
|
29
|
+
if @name_includes_domain
|
30
|
+
if name && name.strip.empty?
|
31
|
+
name = "#{domain}"
|
32
|
+
else
|
33
|
+
name = "#{name}.#{domain}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
if @name_includes_trailing_period
|
38
|
+
name = "#{name}."
|
39
|
+
domain = "#{domain}."
|
40
|
+
end
|
41
|
+
|
42
|
+
return name, domain
|
43
|
+
end
|
44
|
+
|
17
45
|
def host_to_opts(host)
|
46
|
+
name, domain = normalize_name(host.name || '', host.zone.domain)
|
47
|
+
|
18
48
|
opts = {}
|
19
|
-
opts[:id] = host.id
|
20
|
-
opts[:host] =
|
49
|
+
opts[:id] = host.id if host.respond_to?(:id) && host.id
|
50
|
+
opts[:host] = name
|
51
|
+
opts[:domain] = domain
|
21
52
|
opts[:type] = host.type
|
22
|
-
opts[:data] = host.value if host.value
|
23
|
-
opts[:ttl] = host.ttl if host.ttl
|
24
|
-
opts[:priority] = host.priority if host.priority
|
53
|
+
opts[:data] = Array(host.value).first if host.value
|
54
|
+
opts[:ttl] = host.ttl.to_i if host.ttl
|
55
|
+
opts[:priority] = host.priority if host.respond_to?(:priority) && host.priority
|
56
|
+
|
25
57
|
return opts
|
26
58
|
end
|
27
59
|
|
28
60
|
def opts_to_host(opts, host={})
|
29
|
-
|
61
|
+
name, domain = denormalize_name(opts[:host], opts[:domain])
|
62
|
+
|
63
|
+
host[:name] = name
|
30
64
|
host[:type] = opts[:type]
|
31
65
|
host[:value] = opts[:data] if opts[:data]
|
32
66
|
host[:ttl] = opts[:ttl] if opts[:ttl]
|
33
67
|
host[:priority] = opts[:priority] if opts[:priority]
|
68
|
+
|
34
69
|
return host
|
35
70
|
end
|
36
71
|
|
@@ -60,18 +95,34 @@ module Rubber
|
|
60
95
|
fqdn << "#{opts[:domain]}"
|
61
96
|
end
|
62
97
|
|
63
|
-
|
98
|
+
# TODO: revert this when fog gets fixed
|
99
|
+
# hosts = fqdn ? (zone.records.all(:name => fqdn) rescue []) : zone.records.all
|
100
|
+
hosts = zone.records.all
|
101
|
+
if fqdn
|
102
|
+
hosts = hosts.find_all do |r|
|
103
|
+
attributes = host_to_opts(r)
|
104
|
+
host, domain = attributes[:host], attributes[:domain]
|
105
|
+
|
106
|
+
fog_fqdn = ""
|
107
|
+
fog_fqdn << "#{host}." if host && ! host.strip.empty?
|
108
|
+
fog_fqdn << "#{domain}"
|
109
|
+
|
110
|
+
fqdn == fog_fqdn
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
64
114
|
hosts.each do |h|
|
65
115
|
keep = true
|
116
|
+
attributes = host_to_opts(h)
|
66
117
|
|
67
|
-
if host_type &&
|
118
|
+
if host_type && host_type != '*' && attributes[:type] != host_type
|
68
119
|
keep = false
|
69
120
|
end
|
70
121
|
|
71
|
-
if host_data &&
|
122
|
+
if host_data && attributes[:data] != host_data
|
72
123
|
keep = false
|
73
124
|
end
|
74
|
-
|
125
|
+
|
75
126
|
result << h if keep
|
76
127
|
end
|
77
128
|
|
@@ -103,11 +154,20 @@ module Rubber
|
|
103
154
|
new_opts = setup_opts(new_opts, [:host, :domain, :type, :data])
|
104
155
|
|
105
156
|
find_hosts(old_opts).each do |h|
|
106
|
-
opts_to_host(new_opts)
|
107
|
-
|
157
|
+
changes = opts_to_host(new_opts)
|
158
|
+
result = nil
|
159
|
+
if h.respond_to?(:modify)
|
160
|
+
result = h.modify(changes)
|
161
|
+
elsif h.respond_to?(:update_host)
|
162
|
+
result = h.update_host(changes)
|
163
|
+
else
|
164
|
+
changes.each do |k, v|
|
165
|
+
h.send("#{k}=", v)
|
166
|
+
end
|
167
|
+
result = h.save
|
108
168
|
end
|
109
169
|
|
110
|
-
|
170
|
+
result || raise("Failed to update host #{h.hostname}, #{h.errors.full_messages.join(', ')}")
|
111
171
|
end
|
112
172
|
end
|
113
173
|
|
data/lib/rubber/environment.rb
CHANGED
data/lib/rubber/generator.rb
CHANGED
@@ -144,8 +144,14 @@ module Rubber
|
|
144
144
|
|
145
145
|
# Set file permissions and owner if needed
|
146
146
|
FileUtils.chmod(config.perms, config_path) if config.perms && config_path
|
147
|
-
|
148
|
-
|
147
|
+
if config_path && (config.owner || config.group)
|
148
|
+
if fake_root
|
149
|
+
Rubber.logger.info("Not performing chown (#{config.owner}:#{config.group}) as a fake root was given")
|
150
|
+
else
|
151
|
+
FileUtils.chown(config.owner, config.group, config_path)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
149
155
|
# Run post transform command if needed
|
150
156
|
if config.post
|
151
157
|
if fake_root
|
@@ -472,11 +472,22 @@ namespace :rubber do
|
|
472
472
|
|
473
473
|
def maybe_reboot
|
474
474
|
reboot_needed = multi_capture("echo $(ls /var/run/reboot-required 2> /dev/null)")
|
475
|
-
reboot_hosts = reboot_needed.collect {|k, v| v.strip.size > 0 ? k : nil}.compact
|
476
|
-
|
475
|
+
reboot_hosts = reboot_needed.collect {|k, v| v.strip.size > 0 ? k : nil}.compact.sort
|
476
|
+
|
477
|
+
# Figure out which hosts are bootstrapping for the first time so we can auto reboot
|
478
|
+
# If there is no deployed app directory, then we have never bootstrapped.
|
479
|
+
auto_reboot = multi_capture("echo $(ls #{deploy_to} 2> /dev/null)")
|
480
|
+
auto_reboot_hosts = auto_reboot.collect {|k, v| v.strip.size == 0 ? k : nil}.compact.sort
|
481
|
+
|
477
482
|
if reboot_hosts.size > 0
|
478
483
|
|
479
|
-
|
484
|
+
# automatically reboot if FORCE or if all the hosts that need rebooting
|
485
|
+
# are bootstrapping for the first time
|
486
|
+
if ENV['FORCE'] =~ /^(t|y)/ || reboot_hosts == auto_reboot_hosts
|
487
|
+
ENV['REBOOT'] = 'y'
|
488
|
+
logger.info "Updates require a reboot on hosts #{reboot_hosts.inspect}"
|
489
|
+
end
|
490
|
+
|
480
491
|
reboot = get_env('REBOOT', "Updates require a reboot on hosts #{reboot_hosts.inspect}, reboot [y/N]?", false)
|
481
492
|
reboot = (reboot =~ /^y/)
|
482
493
|
|
@@ -126,11 +126,26 @@ namespace :rubber do
|
|
126
126
|
mv /etc/fstab /etc/fstab.bak
|
127
127
|
cat /etc/fstab.bak | grep -v '#{vol_spec['mount']}' > /etc/fstab
|
128
128
|
if [ `lsb_release -r -s | sed 's/[.].*//'` -gt "10" ]; then
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
129
|
+
device=`echo #{vol_spec['device']} | sed 's/sd/xvd/'`
|
130
|
+
else
|
131
|
+
device='#{vol_spec['device']}'
|
132
|
+
fi
|
133
|
+
|
134
|
+
echo "$device #{vol_spec['mount']} #{vol_spec['filesystem']} #{vol_spec['mount_opts'] ? vol_spec['mount_opts'] : 'noatime'} 0 0 # rubber volume #{vol_id}" >> /etc/fstab
|
135
|
+
|
136
|
+
# Ensure volume is ready before running mkfs on it.
|
137
|
+
echo 'Waiting for device'
|
138
|
+
cnt=0
|
139
|
+
while ! [[ -b #{vol_spec['device']} ]]; do
|
140
|
+
if [[ "$cnt" -eq "15" ]]; then
|
141
|
+
echo 'Timed out waiting for EBS device to be ready.'
|
142
|
+
exit 1
|
143
|
+
fi
|
144
|
+
echo '.'
|
145
|
+
sleep 2
|
146
|
+
let "cnt = $cnt + 1"
|
147
|
+
done
|
148
|
+
echo 'Device ready'
|
134
149
|
|
135
150
|
#{('yes | mkfs -t ' + vol_spec['filesystem'] + ' ' + '$device') if created}
|
136
151
|
#{("mkdir -p '#{vol_spec['mount']}'") if vol_spec['mount']}
|
data/lib/rubber/version.rb
CHANGED
data/rubber.gemspec
CHANGED
@@ -74,7 +74,11 @@ NameVirtualHost *:<%= rubber_env.web_tools_ssl_port %>
|
|
74
74
|
|
75
75
|
host = "#{name}.#{rubber_env.full_host}"
|
76
76
|
host_and_port = "#{host}:#{rubber_env.web_tools_ssl_port}"
|
77
|
-
|
77
|
+
|
78
|
+
# don't use settings.path here - mapping the host/port is sufficient,
|
79
|
+
# and path can be done in tools-index.html. This allows admin sites
|
80
|
+
# that hit other paths on same host/port to still function, e.g. elasticsearch
|
81
|
+
proxy_url = "http://#{proxy_host}:#{settings.port}/"
|
78
82
|
%>
|
79
83
|
<VirtualHost *:<%= rubber_env.web_tools_ssl_port %>>
|
80
84
|
ServerName <%= host %>
|
@@ -30,7 +30,7 @@
|
|
30
30
|
# graphite web app)
|
31
31
|
Array(rubber_env.web_tools_proxies).each do |name, settings|
|
32
32
|
%>
|
33
|
-
<li><a href="https://<%= name %>.<%= tools_host.full_name %>:<%= rubber_env.web_tools_ssl_port
|
33
|
+
<li><a href="https://<%= name %>.<%= tools_host.full_name %>:<%= rubber_env.web_tools_ssl_port %><%= settings.path || '/' %>"><%= name.capitalize %></a></li>
|
34
34
|
<% end %>
|
35
35
|
|
36
36
|
</ul>
|
@@ -16,6 +16,3 @@ RAILS_ENV=<%= Rubber.env %>
|
|
16
16
|
|
17
17
|
# Roll all rails logs at midnight
|
18
18
|
0 0 * * * <%= Rubber.root %>/script/rubber cron --task util:rotate_logs --directory=<%= Rubber.root %>/log
|
19
|
-
|
20
|
-
# Automatically set the clock for all machines
|
21
|
-
<%= rand(60) %> 4 * * * <%= Rubber.root %>/script/rubber cron ntpdate pool.ntp.org
|
@@ -0,0 +1,57 @@
|
|
1
|
+
<%
|
2
|
+
@path = "/etc/ntp.conf"
|
3
|
+
@post = "/usr/sbin/service ntp restart"
|
4
|
+
%>
|
5
|
+
# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help
|
6
|
+
|
7
|
+
driftfile /var/lib/ntp/ntp.drift
|
8
|
+
|
9
|
+
|
10
|
+
# Enable this if you want statistics to be logged.
|
11
|
+
#statsdir /var/log/ntpstats/
|
12
|
+
|
13
|
+
statistics loopstats peerstats clockstats
|
14
|
+
filegen loopstats file loopstats type day enable
|
15
|
+
filegen peerstats file peerstats type day enable
|
16
|
+
filegen clockstats file clockstats type day enable
|
17
|
+
|
18
|
+
|
19
|
+
# You do need to talk to an NTP server or two (or three).
|
20
|
+
server 0.us.pool.ntp.org
|
21
|
+
server 1.us.pool.ntp.org
|
22
|
+
server 2.us.pool.ntp.org
|
23
|
+
server 3.us.pool.ntp.org
|
24
|
+
|
25
|
+
<% rubber_instances.each do |ic| %>
|
26
|
+
peer <%= ic.full_name %>
|
27
|
+
<% end %>
|
28
|
+
|
29
|
+
# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
|
30
|
+
# details. The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions>
|
31
|
+
# might also be helpful.
|
32
|
+
#
|
33
|
+
# Note that "restrict" applies to both servers and clients, so a configuration
|
34
|
+
# that might be intended to block requests from certain clients could also end
|
35
|
+
# up blocking replies from your own upstream servers.
|
36
|
+
|
37
|
+
# By default, exchange time with everybody, but don't allow configuration.
|
38
|
+
restrict -4 default kod notrap nomodify nopeer noquery
|
39
|
+
restrict -6 default kod notrap nomodify nopeer noquery
|
40
|
+
|
41
|
+
# Local users may interrogate the ntp server more closely.
|
42
|
+
restrict 127.0.0.1
|
43
|
+
restrict ::1
|
44
|
+
|
45
|
+
# Clients from this (example!) subnet have unlimited access, but only if
|
46
|
+
# cryptographically authenticated.
|
47
|
+
#restrict 192.168.123.0 mask 255.255.255.0 notrust
|
48
|
+
|
49
|
+
|
50
|
+
# If you want to provide time to your local subnet, change the next line.
|
51
|
+
# (Again, the address is an example only.)
|
52
|
+
#broadcast 192.168.123.255
|
53
|
+
|
54
|
+
# If you want to listen to time broadcasts on your local subnet, de-comment the
|
55
|
+
# next lines. Please do this only if you trust everybody on the network!
|
56
|
+
#disable auth
|
57
|
+
#broadcastclient
|
@@ -9,7 +9,7 @@ app_user: app
|
|
9
9
|
admin_email: "root@#{full_host}"
|
10
10
|
|
11
11
|
# OPTIONAL: If not set, you won't be able to access web_tools
|
12
|
-
# server (
|
12
|
+
# server (graphite, graylog, monit status, haproxy status, etc)
|
13
13
|
# web_tools_user: admin
|
14
14
|
# web_tools_password: sekret
|
15
15
|
|
@@ -169,7 +169,7 @@ prompt_for_security_group_sync: true
|
|
169
169
|
# OPTIONAL: The packages to install on all instances
|
170
170
|
# You can install a specific version of a package by using a sub-array of pkg, version
|
171
171
|
# For example, packages: [[rake, 0.7.1], irb]
|
172
|
-
packages: [postfix, build-essential, git-core, ec2-ami-tools, libxslt-dev]
|
172
|
+
packages: [postfix, build-essential, git-core, ec2-ami-tools, libxslt-dev, ntp]
|
173
173
|
|
174
174
|
# OPTIONAL: gem sources to setup for rubygems
|
175
175
|
# gemsources: ["http://rubygems.org", "http://gems.github.com"]
|
data/templates/base/templates.rb
CHANGED
File without changes
|
@@ -12,6 +12,9 @@ namespace :rubber do
|
|
12
12
|
wget --no-check-certificate -qNP /tmp https://github.com/downloads/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
|
+
|
16
|
+
#{rubber_env.elasticsearch_dir}/bin/plugin -install mobz/elasticsearch-head
|
17
|
+
|
15
18
|
fi
|
16
19
|
ENDSCRIPT
|
17
20
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
elasticsearch_version: 0.
|
1
|
+
elasticsearch_version: 0.19.3
|
2
2
|
elasticsearch_prefix: /usr/local
|
3
3
|
elasticsearch_dir: "#{elasticsearch_prefix}/elasticsearch-#{elasticsearch_version}"
|
4
4
|
elasticsearch_data_dir: "/mnt/elasticsearch/data"
|
@@ -9,4 +9,10 @@ elasticsearch_http_port: 9200
|
|
9
9
|
|
10
10
|
roles:
|
11
11
|
elasticsearch:
|
12
|
-
packages: [openjdk-
|
12
|
+
packages: [openjdk-7-jdk]
|
13
|
+
|
14
|
+
web_tools_proxies:
|
15
|
+
elasticsearch:
|
16
|
+
role: elasticsearch
|
17
|
+
port: "#{elasticsearch_http_port}"
|
18
|
+
path: /_plugin/head/
|
@@ -36,7 +36,7 @@ Simple graphite dashboard cycler for use on a large display - e.g. googletv/chro
|
|
36
36
|
|
37
37
|
<script type="text/javascript">
|
38
38
|
|
39
|
-
// To test this locally, edit ROOT_URL to point to graphite webapp
|
39
|
+
// To test this locally, edit ROOT_URL to point to graphite webapp (without trailing slash)
|
40
40
|
// To allow xhttp to graphite from html loaded from local file, run chrome with:
|
41
41
|
// /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --disable-web-security
|
42
42
|
|
@@ -91,7 +91,7 @@ Simple graphite dashboard cycler for use on a large display - e.g. googletv/chro
|
|
91
91
|
self.dashboardList = function() {
|
92
92
|
console.log("Fetching all dashboards");
|
93
93
|
|
94
|
-
return $.getJSON(ROOT_URL + '/
|
94
|
+
return $.getJSON(ROOT_URL + '/dashboard/find/', {'query': ''});
|
95
95
|
}
|
96
96
|
|
97
97
|
self.detailFromDashboardList = function(data) {
|
@@ -111,7 +111,7 @@ Simple graphite dashboard cycler for use on a large display - e.g. googletv/chro
|
|
111
111
|
var name = dashboard["name"];
|
112
112
|
console.log("Fetching dashboard detail for " + name);
|
113
113
|
|
114
|
-
return $.getJSON(ROOT_URL + '/
|
114
|
+
return $.getJSON(ROOT_URL + '/dashboard/load/' + name, {}, function(data) {
|
115
115
|
|
116
116
|
console.log("Got dashboard detail for " + name);
|
117
117
|
console.log(data);
|
@@ -214,7 +214,7 @@ Simple graphite dashboard cycler for use on a large display - e.g. googletv/chro
|
|
214
214
|
params = $.extend(true, params, defn); // deep copy
|
215
215
|
params["target"] = params["target"][0];
|
216
216
|
|
217
|
-
var url = ROOT_URL + "/
|
217
|
+
var url = ROOT_URL + "/render?" + $.param(params);
|
218
218
|
|
219
219
|
return url;
|
220
220
|
});
|
@@ -26,7 +26,7 @@ namespace :rubber do
|
|
26
26
|
after "deploy:update_code", "rubber:passenger:remove_config_ru" if Rubber::Util.is_rails?
|
27
27
|
|
28
28
|
task :remove_config_ru, :roles => :passenger do
|
29
|
-
rsudo "rm -f
|
29
|
+
rsudo "rm -f #{releases_path}/*/config.ru"
|
30
30
|
end
|
31
31
|
|
32
32
|
# passenger depends on apache for start/stop/restart, just need these defined
|
@@ -12,7 +12,7 @@ stop on runlevel [016]
|
|
12
12
|
|
13
13
|
script
|
14
14
|
cd <%= Rubber.root %>
|
15
|
-
exec sudo -u <%= rubber_env.app_user %> /bin/bash -l -c 'cd <%= Rubber.root %> && exec bundle exec resque-pool
|
15
|
+
exec sudo -u <%= rubber_env.app_user %> /bin/bash -l -c 'cd <%= Rubber.root %> && exec bundle exec resque-pool >> log/resque-pool.log 2>&1'
|
16
16
|
end script
|
17
17
|
|
18
18
|
post-start script
|
@@ -25,7 +25,7 @@ end script
|
|
25
25
|
# so that we dont end up killing running jobs
|
26
26
|
#
|
27
27
|
pre-stop script
|
28
|
-
pid=`cat
|
28
|
+
pid=`cat <%= rubber_env.resque_pool_pid_file %>`
|
29
29
|
kill -INT $pid
|
30
30
|
while ps -p $pid > /dev/null; do sleep 0.1; done
|
31
31
|
rm -f <%= rubber_env.resque_pool_pid_file %>
|
@@ -9,7 +9,7 @@ namespace :rubber do
|
|
9
9
|
|
10
10
|
task :install, :roles => :zookeeper do
|
11
11
|
rubber.sudo_script 'install_zookeeper', <<-ENDSCRIPT
|
12
|
-
if [[ ! -
|
12
|
+
if [[ ! -d "#{rubber_env.zookeeper_install_dir}" ]]; then
|
13
13
|
# Fetch the sources.
|
14
14
|
wget -qNP /tmp #{rubber_env.zookeeper_package_url}
|
15
15
|
tar -C #{File.dirname rubber_env.zookeeper_install_dir} -zxf /tmp/#{File.basename rubber_env.zookeeper_package_url}
|
data/test/dns/fog_test.rb
CHANGED
@@ -1,147 +1,171 @@
|
|
1
1
|
require File.expand_path(File.join(__FILE__, '../..', 'test_helper'))
|
2
2
|
require 'rubber/dns/fog'
|
3
|
-
#require 'rexml/document'
|
4
3
|
|
5
4
|
class FogTest < Test::Unit::TestCase
|
6
5
|
|
7
6
|
@envs = []
|
8
|
-
|
7
|
+
|
9
8
|
env = {'credentials' =>
|
10
|
-
|
9
|
+
{'provider' => 'zerigo', 'zerigo_email' => 'xxx', 'zerigo_token' => 'yyy'}}
|
11
10
|
@envs << Rubber::Configuration::Environment::BoundEnv.new(env, nil, nil)
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
unless ENV['CI']
|
13
|
+
secret = YAML.load_file(File.expand_path("~/rubber-secret.yml")) rescue {}
|
14
|
+
access_key = secret['cloud_providers']['aws']['access_key']
|
15
|
+
access_secret = secret['cloud_providers']['aws']['secret_access_key']
|
16
|
+
env = {'credentials' =>
|
17
|
+
{'provider' => 'aws', 'aws_access_key_id' => access_key, 'aws_secret_access_key' => access_secret},
|
18
|
+
'name_includes_domain' => true,
|
19
|
+
'name_includes_trailing_period' => true}
|
20
|
+
# no mocks for aws dns yet
|
21
|
+
@envs << Rubber::Configuration::Environment::BoundEnv.new(env, nil, nil)
|
22
|
+
end
|
23
|
+
|
24
|
+
def all_test_zones(dns=@dns)
|
25
|
+
dns.client.zones.all.find_all {|z| z.domain =~ /rubbertest/ }
|
26
|
+
end
|
17
27
|
|
28
|
+
def destroy_test_domains
|
29
|
+
all_test_zones(Rubber::Dns::Fog.new(@env)).each do |zone|
|
30
|
+
zone.records.all.each do |record|
|
31
|
+
record.destroy
|
32
|
+
end
|
33
|
+
zone.destroy
|
34
|
+
end
|
35
|
+
end
|
18
36
|
|
37
|
+
env = @envs.first
|
19
38
|
@envs.each do |env|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
assert_equal 0, @dns.client.zones.all.size
|
33
|
-
|
34
|
-
zone0 = @dns.find_or_create_zone("example1.com")
|
39
|
+
|
40
|
+
context "fog #{env.credentials.provider} dns" do
|
41
|
+
|
42
|
+
setup do
|
43
|
+
@env = env
|
44
|
+
|
45
|
+
# no mocks for aws dns yet
|
46
|
+
if env.credentials.provider == 'aws'
|
47
|
+
Fog.unmock!
|
48
|
+
destroy_test_domains
|
49
|
+
end
|
35
50
|
|
36
|
-
assert_equal 1, @dns.client.zones.all.size
|
37
|
-
zone1 = @dns.client.zones.all.find {|z| z.domain =~ /^example1.com/ }
|
38
|
-
assert zone1
|
39
|
-
assert_equal zone0.id, zone1.id
|
40
|
-
assert_equal zone0.domain, zone1.domain
|
41
|
-
end
|
42
|
-
|
43
|
-
should "match the same domain that was passed" do
|
44
51
|
@dns = Rubber::Dns::Fog.new(@env)
|
45
|
-
|
46
|
-
assert_equal 0, @dns.client.zones.all.size
|
47
|
-
|
48
|
-
zone0 = @dns.find_or_create_zone("abcfoo.com")
|
49
|
-
zone1 = @dns.find_or_create_zone("foo.com")
|
50
|
-
|
51
|
-
assert_equal 2, @dns.client.zones.all.size
|
52
|
-
|
53
|
-
zone2 = @dns.client.zones.all.find {|z| z.domain =~ /^foo.com/ }
|
54
|
-
assert zone2
|
55
|
-
assert_equal zone1.id, zone2.id
|
56
|
-
assert_equal zone1.domain, zone2.domain
|
57
52
|
end
|
58
53
|
|
59
|
-
|
60
|
-
@dns = Rubber::Dns::Fog.new(@env)
|
61
|
-
|
62
|
-
@dns.client.zones.create(:domain => 'example1.com')
|
63
|
-
assert_equal 1, @dns.client.zones.all.size
|
64
|
-
|
65
|
-
zone0 = @dns.find_or_create_zone("example1.com")
|
66
|
-
|
67
|
-
assert_equal 1, @dns.client.zones.all.size
|
68
|
-
zone1 = @dns.client.zones.all.find {|z| z.domain =~ /^example1.com/ }
|
69
|
-
assert_equal zone0.id, zone1.id
|
70
|
-
assert_equal zone0.domain, zone1.domain
|
71
|
-
end
|
54
|
+
context "find_or_create" do
|
72
55
|
|
73
|
-
|
74
|
-
|
75
|
-
context "records" do
|
76
|
-
|
77
|
-
setup do
|
78
|
-
@dns = Rubber::Dns::Fog.new(@env)
|
56
|
+
should "create domain if it doesn't exist" do
|
57
|
+
assert_equal 0, all_test_zones.size
|
79
58
|
|
80
|
-
|
81
|
-
@zone = @dns.find_or_create_zone(@domain)
|
82
|
-
end
|
83
|
-
|
84
|
-
should "find_records" do
|
85
|
-
# Set up some sample records.
|
86
|
-
first = @zone.records.create(:value => '172.16.16.1', :name => 'host1', :domain => @domain, :type => 'A')
|
87
|
-
@zone.records.create(:value => '172.16.16.2', :domain => @domain, :type => 'A')
|
59
|
+
zone0 = @dns.find_or_create_zone("rubbertest.com")
|
88
60
|
|
89
|
-
|
61
|
+
assert_equal 1, all_test_zones.size
|
62
|
+
zone1 = all_test_zones.find {|z| z.domain =~ /^rubbertest.com/ }
|
63
|
+
assert zone1
|
64
|
+
assert_equal zone0.id, zone1.id
|
65
|
+
assert_equal zone0.domain, zone1.domain
|
66
|
+
end
|
90
67
|
|
91
|
-
|
92
|
-
|
93
|
-
assert_equal 2, records.size
|
94
|
-
assert_equal({:type => "A", :host => "host1", :domain => @domain, :id => first.id, :data=>"172.16.16.1", :ttl => 3600, :priority => 0}, records.first)
|
68
|
+
should "match the same domain that was passed" do
|
69
|
+
assert_equal 0, all_test_zones.size
|
95
70
|
|
96
|
-
|
97
|
-
|
98
|
-
assert_equal 1, records.size
|
99
|
-
assert_equal '', records.first[:host]
|
71
|
+
zone0 = @dns.find_or_create_zone("abcrubbertest.com")
|
72
|
+
zone1 = @dns.find_or_create_zone("rubbertest.com")
|
100
73
|
|
101
|
-
|
102
|
-
records = @dns.find_host_records(:host => 'host1', :domain => @domain)
|
103
|
-
assert_equal 1, records.size
|
104
|
-
assert_equal 'host1', records.first[:host]
|
105
|
-
end
|
74
|
+
assert_equal 2, all_test_zones.size
|
106
75
|
|
107
|
-
|
108
|
-
|
76
|
+
zone2 = all_test_zones.find {|z| z.domain =~ /^rubbertest.com/ }
|
77
|
+
assert zone2
|
78
|
+
assert_equal zone1.id, zone2.id
|
79
|
+
assert_equal zone1.domain, zone2.domain
|
80
|
+
end
|
109
81
|
|
110
|
-
|
111
|
-
|
82
|
+
should "do nothing if domain already exists" do
|
83
|
+
@dns.client.zones.create(:domain => 'rubbertest.com')
|
84
|
+
assert_equal 1, all_test_zones.size
|
112
85
|
|
113
|
-
|
114
|
-
assert_equal "newhost.#{@domain}", record.domain
|
115
|
-
assert_equal '1.1.1.1', record.value
|
116
|
-
assert_equal 'A', record.type
|
117
|
-
assert_equal 333, record.ttl
|
118
|
-
end
|
86
|
+
zone0 = @dns.find_or_create_zone("rubbertest.com")
|
119
87
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
88
|
+
assert_equal 1, all_test_zones.size
|
89
|
+
zone1 = all_test_zones.find {|z| z.domain =~ /^rubbertest.com/ }
|
90
|
+
assert_equal zone0.id, zone1.id
|
91
|
+
assert_equal zone0.domain, zone1.domain
|
92
|
+
end
|
124
93
|
|
125
|
-
@dns.destroy_host_record({:host => 'host1', :domain => @domain})
|
126
|
-
|
127
|
-
assert_equal 0, @zone.records.all.size
|
128
94
|
end
|
95
|
+
|
96
|
+
context "records" do
|
129
97
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
@zone.records.create(:type => 'A', :value => '1.1.1.1', :name => 'host1', :domain => @domain)
|
98
|
+
setup do
|
99
|
+
@domain = "rubbertest.com"
|
100
|
+
@zone = @dns.find_or_create_zone(@domain)
|
101
|
+
end
|
135
102
|
|
136
|
-
|
103
|
+
should "create_record" do
|
104
|
+
@dns.create_host_record({:host => 'newhost', :domain => @domain, :data => '1.1.1.1', :type => 'A', :ttl => '333'})
|
105
|
+
|
106
|
+
assert_equal @zone.records.all.size, 1
|
107
|
+
record = @zone.records.first
|
108
|
+
attributes = @dns.host_to_opts(record)
|
109
|
+
|
110
|
+
assert_equal 'newhost', attributes[:host]
|
111
|
+
assert_equal @domain, attributes[:domain]
|
112
|
+
assert_equal '1.1.1.1', attributes[:data]
|
113
|
+
assert_equal 'A', attributes[:type]
|
114
|
+
assert_equal 333, attributes[:ttl]
|
115
|
+
end
|
116
|
+
|
117
|
+
should "destroy_record" do
|
118
|
+
# Create the record we want to test destroying.
|
119
|
+
@dns.create_host_record({:host => 'newhost', :domain => @domain, :data => '1.1.1.1', :type => 'A'})
|
120
|
+
assert_equal 1, @zone.records.all.size
|
121
|
+
|
122
|
+
@dns.destroy_host_record({:host => 'newhost', :domain => @domain})
|
123
|
+
|
124
|
+
assert_equal 0, @zone.records.all.size
|
125
|
+
end
|
126
|
+
|
127
|
+
should "update_record" do
|
128
|
+
params = {:host => 'host1', :domain => @domain, :data => "1.1.1.1"}
|
129
|
+
new = {:host => 'host1', :domain => @domain, :data => "1.1.1.2"}
|
130
|
+
|
131
|
+
@dns.create_host_record({:host => 'host1', :domain => @domain, :data => '1.1.1.1', :type => 'A'})
|
132
|
+
assert_equal 1, @zone.records.all.size
|
133
|
+
|
134
|
+
@dns.update_host_record(params, new)
|
135
|
+
assert_equal 1, @zone.records.all.size
|
136
|
+
|
137
|
+
record = @zone.records.all.first
|
138
|
+
attributes = @dns.host_to_opts(record)
|
139
|
+
assert_equal '1.1.1.2', attributes[:data]
|
140
|
+
end
|
141
|
+
|
142
|
+
should "find_records" do
|
143
|
+
# Set up some sample records.
|
144
|
+
created = []
|
145
|
+
created << {:host => 'host1', :domain => @domain, :data => '1.1.1.1', :type => 'A'}
|
146
|
+
created << {:host => '', :domain => @domain, :data => '1.1.1.1', :type => 'A'}
|
147
|
+
created.each {|r| @dns.create_host_record(r) }
|
148
|
+
|
149
|
+
# Search for records through the rubber DNS interface and make sure whe get what we expected.
|
150
|
+
|
151
|
+
# Wildcard search.
|
152
|
+
records = @dns.find_host_records(:host => '*', :domain => @domain)
|
153
|
+
assert_equal 2, records.size
|
154
|
+
|
155
|
+
# Blank hostname search.
|
156
|
+
records = @dns.find_host_records(:host => '', :domain => @domain)
|
157
|
+
assert_equal 1, records.size
|
158
|
+
assert_equal '', records.first[:host]
|
159
|
+
|
160
|
+
# Specific hostname search.
|
161
|
+
records = @dns.find_host_records(:host => 'host1', :domain => @domain)
|
162
|
+
assert_equal 1, records.size
|
163
|
+
assert_equal 'host1', records.first[:host]
|
164
|
+
end
|
137
165
|
|
138
|
-
record = @zone.records.all.first
|
139
|
-
assert_equal '1.1.1.2', record.value
|
140
166
|
end
|
141
167
|
|
142
168
|
end
|
143
|
-
|
144
|
-
end
|
145
|
-
|
169
|
+
|
146
170
|
end
|
147
171
|
end
|
data/test/test_helper.rb
CHANGED
@@ -7,13 +7,16 @@ require 'test/unit'
|
|
7
7
|
require 'mocha'
|
8
8
|
require 'shoulda-context'
|
9
9
|
require 'pp'
|
10
|
+
require 'ap'
|
10
11
|
require 'tempfile'
|
11
|
-
|
12
12
|
require 'fog'
|
13
|
-
Fog.mock!
|
14
13
|
|
15
14
|
class Test::Unit::TestCase
|
16
|
-
|
15
|
+
setup do
|
16
|
+
Fog.mock!
|
17
|
+
end
|
18
|
+
|
19
|
+
teardown do
|
17
20
|
Fog::Mock.reset
|
18
21
|
end
|
19
22
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-05-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: capistrano
|
@@ -172,6 +172,22 @@ dependencies:
|
|
172
172
|
- - ! '>='
|
173
173
|
- !ruby/object:Gem::Version
|
174
174
|
version: '0'
|
175
|
+
- !ruby/object:Gem::Dependency
|
176
|
+
name: awesome_print
|
177
|
+
requirement: !ruby/object:Gem::Requirement
|
178
|
+
none: false
|
179
|
+
requirements:
|
180
|
+
- - ! '>='
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: '0'
|
183
|
+
type: :development
|
184
|
+
prerelease: false
|
185
|
+
version_requirements: !ruby/object:Gem::Requirement
|
186
|
+
none: false
|
187
|
+
requirements:
|
188
|
+
- - ! '>='
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
version: '0'
|
175
191
|
description: ! " The rubber plugin enables relatively complex multi-instance deployments
|
176
192
|
of RubyOnRails applications to\n Amazon's Elastic Compute Cloud (EC2). Like
|
177
193
|
capistrano, rubber is role based, so you can define a set\n of configuration
|
@@ -254,6 +270,8 @@ files:
|
|
254
270
|
- templates/base/Capfile
|
255
271
|
- templates/base/config/deploy.rb
|
256
272
|
- templates/base/config/rubber/common/crontab
|
273
|
+
- templates/base/config/rubber/common/ntp-sysctl.conf
|
274
|
+
- templates/base/config/rubber/common/ntp.conf
|
257
275
|
- templates/base/config/rubber/common/rsyslog.conf
|
258
276
|
- templates/base/config/rubber/common/rubber.profile
|
259
277
|
- templates/base/config/rubber/deploy-setup.rb
|
@@ -591,7 +609,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
591
609
|
version: '0'
|
592
610
|
segments:
|
593
611
|
- 0
|
594
|
-
hash: -
|
612
|
+
hash: -340677959787113833
|
595
613
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
596
614
|
none: false
|
597
615
|
requirements:
|
@@ -600,46 +618,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
600
618
|
version: '0'
|
601
619
|
segments:
|
602
620
|
- 0
|
603
|
-
hash: -
|
621
|
+
hash: -340677959787113833
|
604
622
|
requirements: []
|
605
623
|
rubyforge_project: rubber
|
606
|
-
rubygems_version: 1.8.
|
624
|
+
rubygems_version: 1.8.23
|
607
625
|
signing_key:
|
608
626
|
specification_version: 3
|
609
627
|
summary: A capistrano plugin for managing multi-instance deployments to the cloud
|
610
628
|
(ec2)
|
611
|
-
test_files:
|
612
|
-
- test/cloud/aws_table_store_test.rb
|
613
|
-
- test/cloud/aws_test.rb
|
614
|
-
- test/cloud/fog_storage_test.rb
|
615
|
-
- test/cloud/fog_test.rb
|
616
|
-
- test/command_test.rb
|
617
|
-
- test/dns/fog_test.rb
|
618
|
-
- test/environment_test.rb
|
619
|
-
- test/fixtures/basic/common/bar.conf
|
620
|
-
- test/fixtures/basic/common/foo.conf
|
621
|
-
- test/fixtures/basic/host/host1/foo.conf
|
622
|
-
- test/fixtures/basic/host/host2/foo.conf
|
623
|
-
- test/fixtures/basic/role/role1/foo.conf
|
624
|
-
- test/fixtures/basic/role/role2/foo.conf
|
625
|
-
- test/fixtures/basic/rubber-extra.yml
|
626
|
-
- test/fixtures/basic/rubber.yml
|
627
|
-
- test/fixtures/expansion/rubber.yml
|
628
|
-
- test/fixtures/generator_order/common/a_first.conf
|
629
|
-
- test/fixtures/generator_order/common/z_last.conf
|
630
|
-
- test/fixtures/generator_order/host/host1/a_first.conf
|
631
|
-
- test/fixtures/generator_order/host/host1/z_last.conf
|
632
|
-
- test/fixtures/generator_order/role/role1/a_first.conf
|
633
|
-
- test/fixtures/generator_order/role/role1/z_last.conf
|
634
|
-
- test/fixtures/generator_order/role/role2/a_first.conf
|
635
|
-
- test/fixtures/generator_order/role/role2/z_last.conf
|
636
|
-
- test/fixtures/instance_expansion/instance-test.yml
|
637
|
-
- test/fixtures/instance_expansion/rubber.yml
|
638
|
-
- test/fixtures/nested/rubber.yml
|
639
|
-
- test/fixtures/secret/rubber.yml
|
640
|
-
- test/fixtures/secret/secret.yml
|
641
|
-
- test/generator_test.rb
|
642
|
-
- test/instance_test.rb
|
643
|
-
- test/test-rails-template.rb
|
644
|
-
- test/test_helper.rb
|
645
|
-
- test/util_test.rb
|
629
|
+
test_files: []
|