rubber 2.7.5 → 2.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 12a21d909c8eaa9564ee987b045ab189387d5c46
4
- data.tar.gz: 24830a98a3204ebab53f6fd88ec070dd6c487e3f
3
+ metadata.gz: b790684866800f608ac2a7e8c46be7b69eaff208
4
+ data.tar.gz: 5eeebc027c8b19071df95dd125bdeda47ee2a124
5
5
  SHA512:
6
- metadata.gz: f6c6fde0e0c084d19292a0656780ec0f731ac8fb0386e218d52c18e9b66b6204650dee4be70b9e50c3118c2163bbc9cf045da0446b73df35ed78c086fc0f85ec
7
- data.tar.gz: 61bbc6df7047f11afeef55b3f6d7c27d379db6712f5e7c3e04a0c749a974caf42d299e3ddb08b2fcb0e5ac5c3aa91f56d8cae57c46fe2b5a3542eeb3ca358a3a
6
+ metadata.gz: 1a460123e60720d4e04cc9c1d1868e594c9a231cfc0f5ba51b6e1f4793586d283626f3b57685df992505a346d6dd54e9c756897bdbd6a8d41f00d2c96de8872c
7
+ data.tar.gz: 6ad1acc813073a33f9547dd8aa25927046645f9e1f8b74e6d13c5f439fbe9b2672b8c35758699cb185fe8fa661fd07fb31115d4287c70ac74fdedf06bc9f074f
data/CHANGELOG CHANGED
@@ -1,3 +1,27 @@
1
+ 2.8.0 (03/30/2014)
2
+
3
+ New Features:
4
+ ============
5
+
6
+ [base, core] Added the ability to specify a package manager mirror for faster package installation. <a127846>
7
+
8
+ Improvements:
9
+ ============
10
+
11
+ [base] Use binstubs if available in the rubber script since it can be much faster, particularly on JRuby. <eefa30e>
12
+ [core] Suppress dpkg output to cut down on noise in setting up iptables firewall rules. <59997aa>
13
+ [core] Only upload the rubber config once, rather than everytime run_config is called. <1b14e73>
14
+ [core] There's no need to specially upload rubber config files when using a non-SCM deploy strategy. <3227440>
15
+ [core] Prevent tasks from running multiple times if mounting a volume to a location that would blow away the deploy directory. <c222684>
16
+ [core] Sped up config file transformation a bit by cutting down on file system operations. <5623fac>
17
+ [core] Defer loading of rubber encryption code until it's actually needed.
18
+
19
+ Bug Fixes:
20
+ =========
21
+
22
+ [core] Fixed a bad env var reference in setting up iptables firewall rules. <1dc844a>
23
+
24
+
1
25
  2.7.5 (03/28/2014)
2
26
 
3
27
  Improvements:
@@ -115,7 +115,7 @@ module Rubber
115
115
 
116
116
  script = <<-ENDSCRIPT
117
117
  # Install iptables if it's not already installed.
118
- if ! dpkg -l $SOFTWARE; then
118
+ if ! dpkg -l iptables &> /dev/null; then
119
119
  export DEBIAN_FRONTEND=noninteractive; apt-get -q -o Dpkg::Options::=--force-confold -y --force-yes install iptables
120
120
  fi
121
121
 
@@ -338,6 +338,8 @@ module Rubber
338
338
  "Generate a key for rubber_secret_key"
339
339
 
340
340
  def execute
341
+ require 'rubber/encryption'
342
+
341
343
  if generate?
342
344
  puts "Obfuscation key: " + Rubber::Encryption.generate_encrypt_key.inspect
343
345
  exit
@@ -2,7 +2,6 @@ require 'yaml'
2
2
  require 'socket'
3
3
  require 'delegate'
4
4
  require 'monitor'
5
- require 'rubber/encryption'
6
5
 
7
6
 
8
7
  module Rubber
@@ -55,6 +54,8 @@ module Rubber
55
54
  if @config_secret
56
55
  obfuscation_key = bound.rubber_secret_key
57
56
  if obfuscation_key
57
+ require 'rubber/encryption'
58
+
58
59
  read_config(@config_secret) do |data|
59
60
  Rubber::Encryption.decrypt(data, obfuscation_key)
60
61
  end
@@ -35,7 +35,7 @@ module Rubber
35
35
  config_dirs.each do |dir|
36
36
  Dir[dir].sort.each do |f|
37
37
  next if f =~ /\/(CVS|\.svn)\//
38
- if File.file?(f) && (! pat || pat.match(f))
38
+ if (! pat || pat.match(f)) && File.file?(f)
39
39
  Rubber.logger.info{"Transforming #{f}"}
40
40
  begin
41
41
  transform(IO.read(f), @options)
@@ -70,28 +70,37 @@ namespace :rubber do
70
70
  opts += " --force" if options[:force]
71
71
  opts += " --file=\"#{options[:file]}\"" if options[:file]
72
72
 
73
- # Need to do this so we can work with staging instances without having to
74
- # checkin instance file between create and bootstrap, as well as during a deploy
75
- if fetch(:push_instance_config, false)
76
- push_files = rubber_cfg.environment.config_files
73
+ unless fetch(:rubber_config_files_pushed, false)
74
+ # Need to do this so we can work with staging instances without having to
75
+ # checkin instance file between create and bootstrap, as well as during a deploy
76
+ #
77
+ # If we're not using an SCM to deploy, then the code must've been uploaded via
78
+ # some strategy that would copy all the files from the local machine, so there's
79
+ # no need to do a special file upload operation. That's only necessary when using an SCM
80
+ # and not wanting to commit files in-progress.
81
+ if fetch(:push_instance_config, false) && (fetch(:scm, nil) != :none)
82
+ push_files = rubber_cfg.environment.config_files
77
83
 
78
- # If we're using a local instance file, push that up. This isn't necessary when storing in S3 or SimpleDB.
79
- if rubber_instances.instance_storage =~ /^file:(.*)/
80
- location = $1
81
- push_files << location
84
+ # If we're using a local instance file, push that up. This isn't necessary when storing in S3 or SimpleDB.
85
+ if rubber_instances.instance_storage =~ /^file:(.*)/
86
+ location = $1
87
+ push_files << location
88
+ end
89
+
90
+ push_files.each do |file|
91
+ dest_file = file.sub(/^#{Rubber.root}\/?/, '')
92
+ put(File.read(file), File.join(path, dest_file), :mode => "+r")
93
+ end
82
94
  end
83
95
 
84
- push_files.each do |file|
85
- dest_file = file.sub(/^#{Rubber.root}\/?/, '')
86
- put(File.read(file), File.join(path, dest_file), :mode => "+r")
96
+ # if the user has defined a secret config file, then push it into Rubber.root/config/rubber
97
+ secret = rubber_cfg.environment.config_secret
98
+ if secret && File.exist?(secret)
99
+ base = rubber_cfg.environment.config_root.sub(/^#{Rubber.root}\/?/, '')
100
+ put(File.read(secret), File.join(path, base, File.basename(secret)), :mode => "+r")
87
101
  end
88
- end
89
102
 
90
- # if the user has defined a secret config file, then push it into Rubber.root/config/rubber
91
- secret = rubber_cfg.environment.config_secret
92
- if secret && File.exist?(secret)
93
- base = rubber_cfg.environment.config_root.sub(/^#{Rubber.root}\/?/, '')
94
- put(File.read(secret), File.join(path, base, File.basename(secret)), :mode => "+r")
103
+ set :rubber_config_files_pushed, true
95
104
  end
96
105
 
97
106
  rsudo "cd #{path} && RUBBER_ENV=#{Rubber.env} RAILS_ENV=#{Rubber.env} ./script/rubber config #{opts}"
@@ -6,9 +6,28 @@ namespace :rubber do
6
6
  Bootstraps instances by setting timezone, installing packages and gems
7
7
  DESC
8
8
  task :bootstrap do
9
+ # This special piece of Hell is designed to work around callback lifecyle issues and problems associated with
10
+ # remounting the :deploy_to directory. The problem is that depending on the filesystem type and whether LLVM is
11
+ # used, we may need to install packages before we can setup volumes. However, most end user custom installation
12
+ # tasks will be configured as "after 'rubber:install_packages'", meaning they'll trigger before the volumes are set
13
+ # up. While this is safe, it can be very costly. If :deploy_to is set to '/mnt/myapp-production', for instance,
14
+ # and we mount a new volume to /mnt, then everything in /mnt will go away and need to be reconstituted. Rubber
15
+ # ensures that the correct thing will happen, so there's no correctness issue. But, if any of those callbacks ran
16
+ # something like :update_code_for_bootstrap, then several costly operations will be run twice, such as uploading
17
+ # the code to be deployed and bundle installing gems. The first time will be in that callback, the second time
18
+ # will be as part of the normal deploy, after /mnt has been remounted and thus, cleared.
19
+ #
20
+ # In order to avoid effectively deploying the app twice in many circumstances, we rebind all
21
+ # "after 'rubber:install_packages'" callbacks to be "after 'rubber:setup_volumes'". This allows end-user
22
+ # configuration to still hook after package installation for normal case operation, while allowing rubber to run
23
+ # semi-performantly when bootstrapping.
24
+
25
+ rebind_after_install_packages_callbacks('rubber:setup_volumes')
26
+
9
27
  link_bash
10
28
  set_timezone
11
29
  enable_multiverse
30
+ configure_package_manager_mirror
12
31
  install_core_packages
13
32
  upgrade_packages
14
33
  install_packages
@@ -18,6 +37,15 @@ namespace :rubber do
18
37
  deploy.setup
19
38
  end
20
39
 
40
+ def rebind_after_install_packages_callbacks(new_after_task)
41
+ install_package_task = find_task(:install_packages)
42
+
43
+ after_install_packages_callbacks = []
44
+ callbacks[:after].delete_if { |c| after_install_packages_callbacks << c if c.applies_to?(install_package_task) }
45
+
46
+ after_install_packages_callbacks.each { |c| after(new_after_task, c.source) }
47
+ end
48
+
21
49
  # Sets up instance to allow root access (e.g. recent canonical AMIs)
22
50
  def enable_root_ssh(ip, initial_ssh_user)
23
51
  # Capistrano uses the :password variable for sudo commands. Since this setting is generally used for the deploy user,
@@ -322,6 +350,16 @@ namespace :rubber do
322
350
  end
323
351
  end
324
352
 
353
+ desc <<-DESC
354
+ Updates the mirror used for the primary packages installed by the package manager.
355
+ DESC
356
+ task :configure_package_manager_mirror do
357
+ if rubber_env.package_manager_mirror
358
+ # This will swap out deb lines that point at a URL while skipping over sources like "deb cdrom".
359
+ rsudo "sed -i.bak -r \"s/(deb|deb-src) [^ :]+:\\/\\/[^ ]+ (.*)/\\1 #{rubber_env.package_manager_mirror.gsub('/', '\\/')} \\2/g\" /etc/apt/sources.list"
360
+ end
361
+ end
362
+
325
363
  desc <<-DESC
326
364
  Update to the newest versions of all packages/gems.
327
365
  DESC
@@ -48,6 +48,7 @@ namespace :rubber do
48
48
 
49
49
  if deployed.strip.size == 0
50
50
  set :rubber_code_was_updated, false
51
+ set :rubber_config_files_pushed, false
51
52
  end
52
53
  end
53
54
  end
@@ -1,3 +1,3 @@
1
1
  module Rubber
2
- VERSION = "2.7.5"
2
+ VERSION = '2.8.0'.freeze
3
3
  end
@@ -245,6 +245,14 @@ private_networks: [10.0.0.0/8]
245
245
  # For example, packages: [[rake, 0.7.1], irb]
246
246
  packages: [postfix, build-essential, git-core, libxslt-dev, ntp]
247
247
 
248
+ # OPTIONAL: The package manager mirror to use for installation of primary packages (i.e., those not explicitly
249
+ # sourced from a different repository). If not specified, whatever mirror configured by your server image
250
+ # will be used.
251
+ #
252
+ # Note that Ubuntu has a special URL that can be used to auto-select the mirror based upon geoip. To use
253
+ # it, specify 'mirror://mirrors.ubuntu.com/mirrors.txt' as the value.
254
+ # package_manager_mirror: 'mirror://mirrors.ubuntu.com/mirrors.txt'
255
+
248
256
  # OPTIONAL: gem sources to setup for rubygems
249
257
  # gemsources: ["https://rubygems.org"]
250
258
 
@@ -8,5 +8,10 @@ if type rvm &> /dev/null; then
8
8
  # version is set during bootstrap
9
9
  rvm default do bundle exec rubber "$@"
10
10
  else
11
- bundle exec rubber "$@"
11
+ # Use binstubs if they exist since they're faster.
12
+ if [[ -f bin/rubber ]]; then
13
+ ./bin/rubber "$@"
14
+ else
15
+ bundle exec rubber "$@"
16
+ fi
12
17
  fi
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.7.5
4
+ version: 2.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Conway
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-28 00:00:00.000000000 Z
12
+ date: 2014-03-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano