rubber 2.0.0.pre1 → 2.0.0.pre2

Sign up to get free protection for your applications and to get access to all the features.
@@ -238,26 +238,23 @@ module Rubber
238
238
  server = @compute_provider.servers.get(instance_id)
239
239
  volume.device = device
240
240
  volume.server = server
241
- return volume.status
242
241
  end
243
242
 
244
243
  def detach_volume(volume_id, force=true)
245
244
  volume = @compute_provider.volumes.get(volume_id)
246
245
  force ? volume.force_detach : (volume.server = nil)
247
- return volume.status
248
246
  end
249
247
 
250
248
  def describe_volumes(volume_id=nil)
251
249
  volumes = []
252
250
  opts = {}
253
- opts[:volume-id] = volume_id if volume_id
251
+ opts[:'volume-id'] = volume_id if volume_id
254
252
  response = @compute_provider.volumes.all(opts)
255
253
  response.each do |item|
256
254
  volume = {}
257
255
  volume[:id] = item.id
258
256
  volume[:status] = item.state
259
257
  if item.server_id
260
- attach = item.attachmentSet.item[0]
261
258
  volume[:attachment_instance_id] = item.server_id
262
259
  volume[:attachment_status] = item.attached_at ? "attached" : "waiting"
263
260
  end
@@ -56,7 +56,7 @@ module Rubber
56
56
  def multipart_store(key, data, opts={})
57
57
  raise "a key is required" unless key && key.size > 0
58
58
 
59
- opts = {:chunk_size => (5 * 10**6)}.merge(opts)
59
+ opts = {:chunk_size => (5 * 2**20)}.merge(opts)
60
60
 
61
61
  chunk = data.read(opts[:chunk_size])
62
62
 
@@ -60,7 +60,7 @@ module Rubber
60
60
  fqdn << "#{opts[:domain]}"
61
61
  end
62
62
 
63
- hosts = fqdn ? zone.records.find(fqdn) : zone.records.all
63
+ hosts = fqdn ? (zone.records.find(fqdn) rescue []) : zone.records.all
64
64
  hosts.each do |h|
65
65
  keep = true
66
66
 
@@ -1,5 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'fog'
3
+ require 'rubber/dns/fog'
3
4
 
4
5
  module Rubber
5
6
  module Dns
@@ -7,14 +8,10 @@ module Rubber
7
8
  class Zerigo < Fog
8
9
 
9
10
  def initialize(env)
10
- super(env)
11
-
12
- @client = Fog::DNS.new({
13
- :provider => 'zerigo',
14
- :zerigo_email => provider_env.email,
15
- :zerigo_token => provider_env.token
16
- })
11
+ super(env.merge({"credentials" => { "provider" => 'zerigo', "zerigo_email" => env.email, "zerigo_token" => env.token }}))
17
12
  end
18
-
13
+
14
+ end
15
+
19
16
  end
20
17
  end
@@ -65,7 +65,7 @@ namespace :rubber do
65
65
  opts = ""
66
66
  opts += " --no_post" if options[:no_post]
67
67
  opts += " --force" if options[:force]
68
- opts += " --file=#{options[:file]}" if options[:file]
68
+ opts += " --file=\"#{options[:file]}\"" if options[:file]
69
69
 
70
70
  # Need to do this so we can work with staging instances without having to
71
71
  # checkin instance file between create and bootstrap, as well as during a deploy
@@ -109,7 +109,11 @@ namespace :rubber do
109
109
  print "."
110
110
  sleep 2
111
111
  volume = cloud.describe_volumes(vol_id).first
112
- break if volume[:attachment_status] == "attached"
112
+ if volume[:attachment_status] == "attached"
113
+ print "."
114
+ sleep 2
115
+ break
116
+ end
113
117
  end
114
118
  print "\n"
115
119
 
@@ -382,7 +386,7 @@ namespace :rubber do
382
386
  detach_volume(volume_id)
383
387
 
384
388
  logger.info "Deleting volume #{volume_id}"
385
- cloud.destroy_volume(volume_id)
389
+ cloud.destroy_volume(volume_id) rescue logger.info("Volume did not exist in cloud")
386
390
 
387
391
  logger.info "Removing volume #{volume_id} from rubber instances file"
388
392
  artifacts = rubber_instances.artifacts
@@ -1,4 +1,4 @@
1
1
  module Rubber
2
- VERSION = "2.0.0.pre1"
2
+ VERSION = "2.0.0.pre2"
3
3
  end
4
4
 
@@ -15,7 +15,7 @@ namespace :rubber do
15
15
 
16
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
- 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=#{rubber_env.db_host}"
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
20
20
  send task_name
21
21
  end
@@ -31,7 +31,7 @@ namespace :rubber do
31
31
  for instance in master_instances+slaves
32
32
  task_name = "_restore_db_cloud_#{instance.full_name}".to_sym()
33
33
  task task_name, :hosts => instance.full_name do
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=#{rubber_env.db_host}"
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
36
36
  send task_name
37
37
  end
@@ -17,4 +17,4 @@ web_tools_proxies:
17
17
 
18
18
  roles:
19
19
  graphite_web:
20
- packages: [python-django python-django-tagging apache2 libapache2-mod-wsgi python-cairo python-memcache memcached sqlite3 bzr]
20
+ packages: [python-django python-django-tagging apache2 libapache2-mod-wsgi python-cairo python-memcache memcached sqlite3 bzr zip]
@@ -5,7 +5,7 @@
5
5
  # munin-node clears out enviroment variables, so we need to add these in
6
6
  # to make sure we are running the correct ruby (rvm env vars, plus paths)
7
7
  [*]
8
- <%- ENV.select {|k, v| k =~ /rvm|ruby|bundler|gem|path/i }.each do |k, v| -%>
8
+ <%- ENV.select {|k, v| k =~ /rvm|ruby|bundler|gem|path/i; v != "" }.each do |k, v| -%>
9
9
  env.<%= k %> <%= v %>
10
10
  <%- end -%>
11
11
  env.RUBYOPT rubygems
@@ -2,9 +2,22 @@
2
2
  namespace :rubber do
3
3
 
4
4
  namespace :nginx do
5
-
5
+
6
6
  rubber.allow_optional_tasks(self)
7
7
 
8
+ before "rubber:install_packages", "rubber:nginx:install"
9
+
10
+ task :install, :roles => :nginx do
11
+ # Setup apt sources for current nginx
12
+ sources = <<-SOURCES
13
+ deb http://nginx.org/packages/ubuntu/ lucid nginx
14
+ deb-src http://nginx.org/packages/ubuntu/ lucid nginx
15
+ SOURCES
16
+ sources.gsub!(/^ */, '')
17
+ put(sources, "/etc/apt/sources.list.d/nginx.list")
18
+ rsudo "wget -qO- http://nginx.org/keys/nginx_signing.key | apt-key add -"
19
+ end
20
+
8
21
  # serial_task can only be called after roles defined - not normally a problem, but
9
22
  # rubber auto-roles don't get defined till after all tasks are defined
10
23
  on :load do
@@ -1,6 +1,6 @@
1
1
  <%
2
2
  @path = "/etc/apache2/sites-available/#{rubber_env.app_name}-passenger"
3
- @post = "a2enmod rewrite && a2enmod ssl && a2ensite #{rubber_env.app_name}-passenger"
3
+ @post = "a2enmod rewrite && a2enmod ssl && a2enmod expires && a2enmod xsendfile && a2ensite #{rubber_env.app_name}-passenger"
4
4
  %>
5
5
 
6
6
  <% [rubber_env.passenger_listen_port, rubber_env.passenger_listen_ssl_port].each do |port| %>
@@ -20,6 +20,8 @@ Listen <%= port %>
20
20
 
21
21
  RailsEnv <%= Rubber.env %>
22
22
 
23
+ XSendFile on
24
+
23
25
  RewriteEngine On
24
26
  RewriteCond %{HTTP_HOST} ^<%= rubber_env.domain %>$
25
27
  RewriteRule ^(.*)$ http://www.<%= rubber_env.domain %>$1 [R,L]
@@ -29,6 +31,40 @@ Listen <%= port %>
29
31
  RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
30
32
  RewriteCond %{SCRIPT_FILENAME} !maintenance.html
31
33
  RewriteRule ^.*$ /system/maintenance.html [L]
34
+
35
+ <% if Rubber::Util.has_asset_pipeline? %>
36
+ <LocationMatch "^/assets/.*$">
37
+ Header unset ETag
38
+ FileETag None
39
+
40
+ # RFC says only cache for 1 year.
41
+ ExpiresActive On
42
+ ExpiresDefault "access plus 1 year"
43
+
44
+ # Cache the resource even if SSL is in use.
45
+ Header merge Cache-Control public
46
+
47
+ SetEnv no-gzip
48
+ </LocationMatch>
49
+
50
+ # Serve the gzip'd assets directly from disk if they were generated by Sprockets.
51
+ # This avoids gzipping the asset on the fly by Apache and Sprockets will usually use a higher level
52
+ # of compression than mod_deflate will, yielding savings all around.
53
+
54
+ RewriteCond %{HTTP:Accept-Encoding} \b(x-)?gzip\b
55
+ RewriteCond <%= Rubber.root + "/public" %>%{REQUEST_FILENAME}.gz -s
56
+ RewriteRule ^(.+) $1.gz [L]
57
+
58
+ <FilesMatch \.css\.gz$>
59
+ ForceType text/css
60
+ Header set Content-Encoding gzip
61
+ </FilesMatch>
62
+
63
+ <FilesMatch \.js\.gz$>
64
+ ForceType text/javascript
65
+ Header set Content-Encoding gzip
66
+ </FilesMatch>
67
+ <% end %>
32
68
 
33
69
  <% if port == rubber_env.passenger_listen_ssl_port %>
34
70
  SSLEngine on
@@ -11,6 +11,6 @@ role_dependencies:
11
11
 
12
12
  roles:
13
13
  passenger:
14
- packages: [apache2-mpm-prefork, apache2-prefork-dev, libcurl4-openssl-dev]
14
+ packages: [apache2-mpm-prefork, apache2-prefork-dev, libcurl4-openssl-dev, libapache2-mod-xsendfile]
15
15
  gems: [fastthread, rack, [passenger, "#{passenger_version}"]]
16
16
 
@@ -55,7 +55,7 @@ after_fork do |server, worker|
55
55
  # drop the workers to www-data:www-data
56
56
  begin
57
57
  uid, gid = Process.euid, Process.egid
58
- user, group = '#{rubber_env.app_user}', '#{rubber_env.app_user}'
58
+ user, group = '<%=rubber_env.app_user %>', '<%=rubber_env.app_user %>'
59
59
  target_uid = Etc.getpwnam(user).uid
60
60
  target_gid = Etc.getgrnam(group).gid
61
61
  worker.tmp.chown(target_uid, target_gid)
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.0.pre1
4
+ version: 2.0.0.pre2
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-02-03 00:00:00.000000000Z
13
+ date: 2012-02-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: capistrano
17
- requirement: &2192938620 !ruby/object:Gem::Requirement
17
+ requirement: &11447820 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 2.8.0
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2192938620
25
+ version_requirements: *11447820
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: thor
28
- requirement: &2192937860 !ruby/object:Gem::Requirement
28
+ requirement: &11451580 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *2192937860
36
+ version_requirements: *11451580
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: clamp
39
- requirement: &2192937100 !ruby/object:Gem::Requirement
39
+ requirement: &11450820 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *2192937100
47
+ version_requirements: *11450820
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: open4
50
- requirement: &2192936520 !ruby/object:Gem::Requirement
50
+ requirement: &11449680 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: '0'
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *2192936520
58
+ version_requirements: *11449680
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: fog
61
- requirement: &2192935880 !ruby/object:Gem::Requirement
61
+ requirement: &11447780 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: 1.0.0
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *2192935880
69
+ version_requirements: *11447780
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rake
72
- requirement: &2192935340 !ruby/object:Gem::Requirement
72
+ requirement: &11446860 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ! '>='
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: '0'
78
78
  type: :development
79
79
  prerelease: false
80
- version_requirements: *2192935340
80
+ version_requirements: *11446860
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: test-unit
83
- requirement: &2192934620 !ruby/object:Gem::Requirement
83
+ requirement: &11446300 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ! '>='
@@ -88,10 +88,10 @@ dependencies:
88
88
  version: '0'
89
89
  type: :development
90
90
  prerelease: false
91
- version_requirements: *2192934620
91
+ version_requirements: *11446300
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: shoulda-context
94
- requirement: &2192934040 !ruby/object:Gem::Requirement
94
+ requirement: &11444960 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ! '>='
@@ -99,10 +99,10 @@ dependencies:
99
99
  version: '0'
100
100
  type: :development
101
101
  prerelease: false
102
- version_requirements: *2192934040
102
+ version_requirements: *11444960
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: mocha
105
- requirement: &2192933520 !ruby/object:Gem::Requirement
105
+ requirement: &15335180 !ruby/object:Gem::Requirement
106
106
  none: false
107
107
  requirements:
108
108
  - - ! '>='
@@ -110,10 +110,10 @@ dependencies:
110
110
  version: '0'
111
111
  type: :development
112
112
  prerelease: false
113
- version_requirements: *2192933520
113
+ version_requirements: *15335180
114
114
  - !ruby/object:Gem::Dependency
115
115
  name: ruby-debug19
116
- requirement: &2192932900 !ruby/object:Gem::Requirement
116
+ requirement: &15334760 !ruby/object:Gem::Requirement
117
117
  none: false
118
118
  requirements:
119
119
  - - ! '>='
@@ -121,7 +121,7 @@ dependencies:
121
121
  version: '0'
122
122
  type: :development
123
123
  prerelease: false
124
- version_requirements: *2192932900
124
+ version_requirements: *15334760
125
125
  description: ! " The rubber plugin enables relatively complex multi-instance deployments
126
126
  of RubyOnRails applications to\n Amazon's Elastic Compute Cloud (EC2). Like
127
127
  capistrano, rubber is role based, so you can define a set\n of configuration
@@ -284,8 +284,8 @@ files:
284
284
  - templates/graphite/config/rubber/rubber-graphite.yml
285
285
  - templates/graphite/templates.yml
286
286
  - templates/graylog/config/initializers/graylog.rb
287
+ - templates/graylog/config/rubber/common/graylog-rsyslog.conf
287
288
  - templates/graylog/config/rubber/deploy-graylog.rb
288
- - templates/graylog/config/rubber/role/common/graylog-rsyslog.conf
289
289
  - templates/graylog/config/rubber/role/graylog_server/graylog2.conf
290
290
  - templates/graylog/config/rubber/role/graylog_server/graylog_server-upstart.conf
291
291
  - templates/graylog/config/rubber/role/graylog_web/crontab
@@ -506,7 +506,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
506
506
  version: '0'
507
507
  segments:
508
508
  - 0
509
- hash: 3429804464715076274
509
+ hash: -3761224985838668413
510
510
  required_rubygems_version: !ruby/object:Gem::Requirement
511
511
  none: false
512
512
  requirements:
@@ -515,43 +515,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
515
515
  version: 1.3.1
516
516
  requirements: []
517
517
  rubyforge_project: rubber
518
- rubygems_version: 1.8.10
518
+ rubygems_version: 1.8.15
519
519
  signing_key:
520
520
  specification_version: 3
521
521
  summary: A capistrano plugin for managing multi-instance deployments to the cloud
522
522
  (ec2)
523
- test_files:
524
- - test/cloud/aws_table_store_test.rb
525
- - test/cloud/aws_test.rb
526
- - test/cloud/fog_storage_test.rb
527
- - test/cloud/fog_test.rb
528
- - test/command_test.rb
529
- - test/dns/fog_test.rb
530
- - test/environment_test.rb
531
- - test/fixtures/basic/common/bar.conf
532
- - test/fixtures/basic/common/foo.conf
533
- - test/fixtures/basic/host/host1/foo.conf
534
- - test/fixtures/basic/host/host2/foo.conf
535
- - test/fixtures/basic/role/role1/foo.conf
536
- - test/fixtures/basic/role/role2/foo.conf
537
- - test/fixtures/basic/rubber-extra.yml
538
- - test/fixtures/basic/rubber.yml
539
- - test/fixtures/expansion/rubber.yml
540
- - test/fixtures/generator_order/common/a_first.conf
541
- - test/fixtures/generator_order/common/z_last.conf
542
- - test/fixtures/generator_order/host/host1/a_first.conf
543
- - test/fixtures/generator_order/host/host1/z_last.conf
544
- - test/fixtures/generator_order/role/role1/a_first.conf
545
- - test/fixtures/generator_order/role/role1/z_last.conf
546
- - test/fixtures/generator_order/role/role2/a_first.conf
547
- - test/fixtures/generator_order/role/role2/z_last.conf
548
- - test/fixtures/instance_expansion/instance-test.yml
549
- - test/fixtures/instance_expansion/rubber.yml
550
- - test/fixtures/nested/rubber.yml
551
- - test/fixtures/secret/rubber.yml
552
- - test/fixtures/secret/secret.yml
553
- - test/generator_test.rb
554
- - test/instance_test.rb
555
- - test/test-rails-template.rb
556
- - test/test_helper.rb
557
- - test/util_test.rb
523
+ test_files: []