jnewland-capsize 0.5.1 → 0.5.2
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.
- data/History.txt +13 -1
- data/Manifest.txt +1 -1
- data/README.textile +2 -2
- data/config/hoe.rb +3 -3
- data/examples/capsize.yml.template +3 -2
- data/lib/capsize/capsize.rb +1 -1
- data/lib/capsize/configuration.rb +2 -1
- data/lib/capsize/ec2_plugin.rb +13 -9
- data/lib/capsize/meta_tasks.rb +8 -7
- data/lib/capsize/version.rb +1 -1
- metadata +1 -1
data/History.txt
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
== 2008/08/24 (0.5.2)
|
2
|
+
|
3
|
+
* Fix bug in create_keypair so that setup task works again (Ches Martin)
|
4
|
+
* Support availability zone specification in run_instance (Ches Martin)
|
5
|
+
|
6
|
+
== 2008/07/13 (0.5.1)
|
7
|
+
|
8
|
+
* Support for Elastic IP addresses (Brendan Schwartz)
|
9
|
+
* Project home now on GitHub: http://github.com/jnewland/capsize
|
10
|
+
|
11
|
+
== In the year that followed, dragons ate Hitler. History books were rewritten.
|
12
|
+
|
1
13
|
== 2007/06/13
|
2
14
|
|
3
15
|
* Re-branded Capsize 'Capsize' with 'Capazon' no more...
|
@@ -15,4 +27,4 @@
|
|
15
27
|
== 2007/03/27
|
16
28
|
|
17
29
|
* Initial Release
|
18
|
-
* Provides Capistrano tasks wrapping the Amazon EC2 API
|
30
|
+
* Provides Capistrano tasks wrapping the Amazon EC2 API
|
data/Manifest.txt
CHANGED
data/README.textile
CHANGED
data/config/hoe.rb
CHANGED
@@ -35,7 +35,7 @@ VERS = Capsize::VERSION::STRING + (REV ? ".#{REV}" : "")
|
|
35
35
|
RDOC_OPTS = ['--quiet', '--title', 'capsize documentation',
|
36
36
|
"--opname", "index.html",
|
37
37
|
"--line-numbers",
|
38
|
-
"--main", "README.
|
38
|
+
"--main", "README.textile",
|
39
39
|
"--inline-source"]
|
40
40
|
|
41
41
|
class Hoe
|
@@ -60,11 +60,11 @@ hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
|
60
60
|
# == Optional
|
61
61
|
p.changes = p.paragraphs_of("History.txt", 0..1).join("\\n\\n")
|
62
62
|
#p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
|
63
|
-
p.extra_deps = [['capistrano', '>= 2.1.0'], ['amazon-ec2', '>= 0.2.
|
63
|
+
p.extra_deps = [['capistrano', '>= 2.1.0'], ['amazon-ec2', '>= 0.2.14'], ['rcov', '>= 0.8.1.2.0'], ['SQS', '>= 0.1.5'], ['builder', '>= 2.1.2'], ['RedCloth', '>= 3.0.4']]
|
64
64
|
|
65
65
|
#p.spec_extras = {} # A hash of extra values to set in the gemspec.
|
66
66
|
p.spec_extras = {
|
67
|
-
:extra_rdoc_files => ["README.
|
67
|
+
:extra_rdoc_files => ["README.textile", "History.txt"],
|
68
68
|
:rdoc_options => RDOC_OPTS,
|
69
69
|
:autorequire => "capsize"
|
70
70
|
}
|
@@ -30,8 +30,9 @@ common: &common
|
|
30
30
|
# SECURITY GROUP CONFIG
|
31
31
|
##########################################################
|
32
32
|
# Set the default security group to apply firewall ingress rules to.
|
33
|
-
# Defaults
|
34
|
-
#
|
33
|
+
# Defaults to a group named from the 'application' Cap variable, and
|
34
|
+
# such a group is created by 'cap ec2:setup' by default as well.
|
35
|
+
#group_name: 'my_app'
|
35
36
|
|
36
37
|
# Set the default security group ip protocol to apply firewall ingress rules to.
|
37
38
|
# Defaults, appropriately, to 'tcp'.
|
data/lib/capsize/capsize.rb
CHANGED
@@ -55,7 +55,7 @@ module Capsize
|
|
55
55
|
when :group_description
|
56
56
|
# the :group_description should fall back to the application name if not provided.
|
57
57
|
if fetch(:group_description, nil).nil?
|
58
|
-
set symbol, fetch(:application)
|
58
|
+
set symbol, "Security group for the #{fetch(:application)} application."
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
@@ -22,7 +22,7 @@ Capistrano::Configuration.instance.load do
|
|
22
22
|
|
23
23
|
# defaults for new security groups
|
24
24
|
set :group_name, nil
|
25
|
-
set :group_description,
|
25
|
+
set :group_description, nil
|
26
26
|
|
27
27
|
set :ip_protocol, 'tcp'
|
28
28
|
set :from_port, nil
|
@@ -40,5 +40,6 @@ Capistrano::Configuration.instance.load do
|
|
40
40
|
# set :queue_name, "#{application}"
|
41
41
|
set :user_data, nil
|
42
42
|
set :addressing_type, 'public'
|
43
|
+
set :availability_zone, nil
|
43
44
|
|
44
45
|
end
|
data/lib/capsize/ec2_plugin.rb
CHANGED
@@ -103,12 +103,7 @@ module Capsize
|
|
103
103
|
|
104
104
|
key_file = get_key_file(:key_name => options[:key_name], :key_dir => options[:key_dir])
|
105
105
|
|
106
|
-
# Verify
|
107
|
-
unless amazon.describe_keypairs(:key_name => options[:key_name]).keySet.nil?
|
108
|
-
raise Exception, "Sorry, a keypair with the name \"#{options[:key_name]}\" already exists on EC2."
|
109
|
-
end
|
110
|
-
|
111
|
-
# and doesn't exist locally either...
|
106
|
+
# Verify local private key file doesn't already exist...
|
112
107
|
file_exists_message = <<-MESSAGE
|
113
108
|
\n
|
114
109
|
Warning! A keypair with the name \"#{key_file}\"
|
@@ -118,8 +113,16 @@ module Capsize
|
|
118
113
|
MESSAGE
|
119
114
|
raise Exception, file_exists_message if File.exists?(key_file)
|
120
115
|
|
121
|
-
#
|
122
|
-
|
116
|
+
# Try to create the new keypair
|
117
|
+
begin
|
118
|
+
private_key = amazon.create_keypair(:key_name => options[:key_name])
|
119
|
+
rescue EC2::InvalidKeyPairDuplicate
|
120
|
+
# keypair already exists with this :key_name
|
121
|
+
# Re-raising will provide a useful message, so we don't need to
|
122
|
+
raise
|
123
|
+
rescue EC2::InvalidKeyPairNotFound
|
124
|
+
# this is a new keypair, continue
|
125
|
+
end
|
123
126
|
|
124
127
|
# write private key to file
|
125
128
|
File.open(key_file, 'w') do |file|
|
@@ -208,7 +211,8 @@ module Capsize
|
|
208
211
|
:group_name => nil,
|
209
212
|
:user_data => get(:user_data),
|
210
213
|
:addressing_type => get(:addressing_type),
|
211
|
-
:instance_type => get(:instance_type)
|
214
|
+
:instance_type => get(:instance_type),
|
215
|
+
:availability_zone => get(:availability_zone)
|
212
216
|
}.merge(options)
|
213
217
|
|
214
218
|
# What security group should we run as?
|
data/lib/capsize/meta_tasks.rb
CHANGED
@@ -12,9 +12,10 @@ Capistrano::Configuration.instance.load do
|
|
12
12
|
- Create :capsize_secure_config_dir
|
13
13
|
- Copy capsize.yml.template to :capsize_config_dir/capsize.yml unless it already exists
|
14
14
|
- Automatically generate :capsize_secure_config_dir/secure.yml unless it already exists
|
15
|
-
-
|
16
|
-
-
|
17
|
-
-
|
15
|
+
- Automatically test authentication configuration with "cap ec2:setup:check"
|
16
|
+
- Automatically create a new keypair named by :key_name, or default to :application
|
17
|
+
- Automatically create a new security group named by :group_name, or default to :application
|
18
|
+
- Add ingress rules for this security group permitting global access on ports 22, 80 and 443
|
18
19
|
DESC
|
19
20
|
task :default do
|
20
21
|
|
@@ -28,7 +29,7 @@ Capistrano::Configuration.instance.load do
|
|
28
29
|
FileUtils.mkdir fetch(:capsize_secure_config_dir)
|
29
30
|
end
|
30
31
|
|
31
|
-
# copy the standard config file template, unless the dest file
|
32
|
+
# copy the standard config file template, unless the dest file already exists
|
32
33
|
unless File.exists?("#{fetch(:capsize_secure_config_dir)}/#{fetch(:capsize_secure_config_file_name)}")
|
33
34
|
puts "Please enter your EC2 account information."
|
34
35
|
puts "We'll then write it to a config file at #{fetch(:capsize_secure_config_dir)}/#{fetch(:capsize_secure_config_file_name)}"
|
@@ -117,7 +118,7 @@ EOF
|
|
117
118
|
are likely most important).
|
118
119
|
|
119
120
|
Now lets connect to it with SSH (this may take a few tries, sometimes it takes a
|
120
|
-
|
121
|
+
few minutes for the new instance to respond to SSH):
|
121
122
|
|
122
123
|
cap ec2:instances:ssh INSTANCE_ID='i-xxxxxx'
|
123
124
|
|
@@ -149,8 +150,8 @@ EOF
|
|
149
150
|
|
150
151
|
end
|
151
152
|
|
152
|
-
end
|
153
|
+
end # end namespace :setup
|
153
154
|
|
154
|
-
end
|
155
|
+
end # end namespace :ec2
|
155
156
|
|
156
157
|
end
|
data/lib/capsize/version.rb
CHANGED