simple_deploy 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +5 -0
- data/lib/simple_deploy/backoff.rb +9 -0
- data/lib/simple_deploy/cli/deploy.rb +10 -1
- data/lib/simple_deploy/cli/instances.rb +3 -1
- data/lib/simple_deploy/stack/deployment.rb +5 -0
- data/lib/simple_deploy/stack.rb +8 -1
- data/lib/simple_deploy/version.rb +1 -1
- data/lib/simple_deploy.rb +1 -0
- data/spec/backoff_spec.rb +25 -0
- data/spec/cli/deploy_spec.rb +9 -3
- data/spec/stack/deployment_spec.rb +1 -1
- data/spec/stack_spec.rb +46 -0
- metadata +5 -2
data/CHANGELOG
CHANGED
@@ -27,6 +27,13 @@ export SIMPLE_DEPLOY_SSH_USER=fred
|
|
27
27
|
export SIMPLE_DEPLOY_SSH_KEY=$HOME/.ssh/id_dsa
|
28
28
|
simple_deploy deploy -n STACK_NAME -n STACK_NAME -e ENVIRONMENT
|
29
29
|
|
30
|
+
Using Internal IP for SSH:
|
31
|
+
|
32
|
+
Simple deploy defaults to using the public IP when ssh'ng to stacks. This option instructs it
|
33
|
+
to use the private IP, which is needed when ssh'ng from one stack to another.
|
34
|
+
|
35
|
+
simple_deploy deploy -n STACK_NAME -n STACK_NAME -e ENVIRONMENT -i
|
36
|
+
|
30
37
|
EOS
|
31
38
|
opt :help, "Display Help"
|
32
39
|
opt :attributes, "= seperated attribute and it's value", :type => :string,
|
@@ -38,6 +45,7 @@ EOS
|
|
38
45
|
opt :name, "Stack name(s) of stack to deploy", :type => :string,
|
39
46
|
:multi => true
|
40
47
|
opt :quiet, "Quiet, do not send notifications"
|
48
|
+
opt :internal, "Use internal IP for ssh commands"
|
41
49
|
end
|
42
50
|
|
43
51
|
CLI::Shared.valid_options? :provided => opts,
|
@@ -54,7 +62,8 @@ EOS
|
|
54
62
|
|
55
63
|
stack = Stack.new :environment => opts[:environment],
|
56
64
|
:name => name,
|
57
|
-
:logger => logger
|
65
|
+
:logger => logger,
|
66
|
+
:internal => opts[:internal]
|
58
67
|
|
59
68
|
stack.update :force => opts[:force], :attributes => new_attributes if new_attributes.any?
|
60
69
|
|
@@ -16,6 +16,7 @@ EOS
|
|
16
16
|
opt :help, "Display Help"
|
17
17
|
opt :environment, "Set the target environment", :type => :string
|
18
18
|
opt :name, "Stack name to manage", :type => :string
|
19
|
+
opt :internal, "Use internal IP for ssh commands"
|
19
20
|
end
|
20
21
|
|
21
22
|
CLI::Shared.valid_options? :provided => opts,
|
@@ -28,7 +29,8 @@ EOS
|
|
28
29
|
stack = Stack.new :environment => opts[:environment],
|
29
30
|
:name => opts[:name],
|
30
31
|
:config => config,
|
31
|
-
:logger => logger
|
32
|
+
:logger => logger,
|
33
|
+
:internal => opts[:internal]
|
32
34
|
|
33
35
|
instances = stack.instances
|
34
36
|
if instances.nil? || instances.empty?
|
data/lib/simple_deploy/stack.rb
CHANGED
@@ -10,6 +10,8 @@ module SimpleDeploy
|
|
10
10
|
@name = args[:name]
|
11
11
|
@config = Config.new :logger => args[:logger]
|
12
12
|
@logger = @config.logger
|
13
|
+
|
14
|
+
@use_internal_ips = !!args[:internal]
|
13
15
|
end
|
14
16
|
|
15
17
|
def create(args)
|
@@ -66,7 +68,12 @@ module SimpleDeploy
|
|
66
68
|
def instances
|
67
69
|
stack.instances.map do |instance|
|
68
70
|
info = instance['instancesSet'].first
|
69
|
-
|
71
|
+
|
72
|
+
if info['vpcId'] || @use_internal_ips
|
73
|
+
info['privateIpAddress']
|
74
|
+
else
|
75
|
+
info['ipAddress']
|
76
|
+
end
|
70
77
|
end
|
71
78
|
end
|
72
79
|
|
data/lib/simple_deploy.rb
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SimpleDeploy::Backoff do
|
4
|
+
describe 'exp_periods' do
|
5
|
+
it 'should yield each period' do
|
6
|
+
expected_periods = [1, 2, 4]
|
7
|
+
|
8
|
+
i = 0
|
9
|
+
SimpleDeploy::Backoff.exp_periods do |p|
|
10
|
+
expected_periods[i].should == p
|
11
|
+
i += 1
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should generate and yield a specified number of periods' do
|
16
|
+
expected_periods = [1, 2]
|
17
|
+
|
18
|
+
i = 0
|
19
|
+
SimpleDeploy::Backoff.exp_periods(2) do |p|
|
20
|
+
expected_periods[i].should == p
|
21
|
+
i += 1
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/spec/cli/deploy_spec.rb
CHANGED
@@ -19,6 +19,7 @@ describe SimpleDeploy::CLI::Deploy do
|
|
19
19
|
:log_level => 'debug',
|
20
20
|
:name => ['my_stack'],
|
21
21
|
:force => true,
|
22
|
+
:internal => false,
|
22
23
|
:attributes => [] }
|
23
24
|
|
24
25
|
SimpleDeploy::CLI::Shared.should_receive(:valid_options?).
|
@@ -35,7 +36,8 @@ describe SimpleDeploy::CLI::Deploy do
|
|
35
36
|
SimpleDeploy::Stack.should_receive(:new).
|
36
37
|
with(:environment => 'my_env',
|
37
38
|
:logger => @logger,
|
38
|
-
:name => 'my_stack'
|
39
|
+
:name => 'my_stack',
|
40
|
+
:internal => false).
|
39
41
|
and_return(@stack)
|
40
42
|
|
41
43
|
@stack.should_receive(:deploy).with(true).and_return(true)
|
@@ -50,6 +52,7 @@ describe SimpleDeploy::CLI::Deploy do
|
|
50
52
|
:log_level => 'debug',
|
51
53
|
:name => ['my_stack'],
|
52
54
|
:force => true,
|
55
|
+
:internal => false,
|
53
56
|
:attributes => [] }
|
54
57
|
|
55
58
|
SimpleDeploy::CLI::Shared.should_receive(:valid_options?).
|
@@ -66,7 +69,8 @@ describe SimpleDeploy::CLI::Deploy do
|
|
66
69
|
SimpleDeploy::Stack.should_receive(:new).
|
67
70
|
with(:environment => 'my_env',
|
68
71
|
:logger => @logger,
|
69
|
-
:name => 'my_stack'
|
72
|
+
:name => 'my_stack',
|
73
|
+
:internal => false).
|
70
74
|
and_return(@stack)
|
71
75
|
|
72
76
|
@stack.should_receive(:deploy).with(true).and_return(false)
|
@@ -83,6 +87,7 @@ describe SimpleDeploy::CLI::Deploy do
|
|
83
87
|
:log_level => 'debug',
|
84
88
|
:name => ['my_stack'],
|
85
89
|
:force => true,
|
90
|
+
:internal => false,
|
86
91
|
:attributes => ['foo=bah'] }
|
87
92
|
|
88
93
|
SimpleDeploy::CLI::Shared.should_receive(:valid_options?).
|
@@ -99,7 +104,8 @@ describe SimpleDeploy::CLI::Deploy do
|
|
99
104
|
SimpleDeploy::Stack.should_receive(:new).
|
100
105
|
with(:environment => 'my_env',
|
101
106
|
:logger => @logger,
|
102
|
-
:name => 'my_stack'
|
107
|
+
:name => 'my_stack',
|
108
|
+
:internal => false).
|
103
109
|
and_return(@stack)
|
104
110
|
|
105
111
|
@stack.should_receive(:update).with(hash_including(:force => true, :attributes => [{'foo' => 'bah'}]))
|
@@ -103,7 +103,7 @@ describe SimpleDeploy do
|
|
103
103
|
status_mock = mock 'status mock'
|
104
104
|
SimpleDeploy::Stack::Deployment::Status.should_receive(:new).
|
105
105
|
and_return status_mock
|
106
|
-
status_mock.should_receive(:clear_for_deployment?).and_return false, true
|
106
|
+
status_mock.should_receive(:clear_for_deployment?).and_return false, true, true
|
107
107
|
status_mock.should_receive(:clear_deployment_lock).with(true)
|
108
108
|
status_mock.should_receive(:set_deployment_in_progress)
|
109
109
|
@deployment_mock.should_receive(:simpledeploy)
|
data/spec/stack_spec.rb
CHANGED
@@ -12,6 +12,7 @@ describe SimpleDeploy do
|
|
12
12
|
@config_stub.stub(:artifact_cloud_formation_url).and_return('CookBooksURL')
|
13
13
|
|
14
14
|
SimpleDeploy::Config.should_receive(:new).
|
15
|
+
at_least(:once).
|
15
16
|
with(:logger => 'my-logger').
|
16
17
|
and_return @config_stub
|
17
18
|
@stack = SimpleDeploy::Stack.new :environment => 'test-env',
|
@@ -157,4 +158,49 @@ describe SimpleDeploy do
|
|
157
158
|
@stack.destroy.should be_true
|
158
159
|
end
|
159
160
|
end
|
161
|
+
|
162
|
+
describe 'instances' do
|
163
|
+
before do
|
164
|
+
@instances = [{ 'instancesSet' => [{ 'ipAddress' => '50.40.30.20', 'privateIpAddress' => '10.1.2.3' }] }]
|
165
|
+
@environment_config_mock.stub(:[])
|
166
|
+
end
|
167
|
+
|
168
|
+
it 'should use the private IP when vpc' do
|
169
|
+
stack = SimpleDeploy::Stack.new :environment => 'test-env',
|
170
|
+
:name => 'test-stack',
|
171
|
+
:logger => 'my-logger',
|
172
|
+
:config => @config_stub,
|
173
|
+
:internal => false
|
174
|
+
stack.stub(:stack) { @stack_mock }
|
175
|
+
|
176
|
+
@instances.first['instancesSet'].first['vpcId'] = 'my-vpc'
|
177
|
+
@stack_mock.stub(:instances).and_return(@instances)
|
178
|
+
|
179
|
+
stack.send(:instances).should == ['10.1.2.3']
|
180
|
+
end
|
181
|
+
|
182
|
+
it 'should use the private IP when internal' do
|
183
|
+
stack = SimpleDeploy::Stack.new :environment => 'test-env',
|
184
|
+
:name => 'test-stack',
|
185
|
+
:logger => 'my-logger',
|
186
|
+
:config => @config_stub,
|
187
|
+
:internal => true
|
188
|
+
stack.stub(:stack) { @stack_mock }
|
189
|
+
@stack_mock.stub(:instances).and_return(@instances)
|
190
|
+
|
191
|
+
stack.send(:instances).should == ['10.1.2.3']
|
192
|
+
end
|
193
|
+
|
194
|
+
it 'should use the public IP when not vpc and not internal' do
|
195
|
+
stack = SimpleDeploy::Stack.new :environment => 'test-env',
|
196
|
+
:name => 'test-stack',
|
197
|
+
:logger => 'my-logger',
|
198
|
+
:config => @config_stub,
|
199
|
+
:internal => false
|
200
|
+
stack.stub(:stack) { @stack_mock }
|
201
|
+
@stack_mock.stub(:instances).and_return(@instances)
|
202
|
+
|
203
|
+
stack.send(:instances).should == ['50.40.30.20']
|
204
|
+
end
|
205
|
+
end
|
160
206
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_deploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -109,6 +109,7 @@ files:
|
|
109
109
|
- bin/simple_deploy
|
110
110
|
- lib/simple_deploy.rb
|
111
111
|
- lib/simple_deploy/artifact.rb
|
112
|
+
- lib/simple_deploy/backoff.rb
|
112
113
|
- lib/simple_deploy/cli.rb
|
113
114
|
- lib/simple_deploy/cli/attributes.rb
|
114
115
|
- lib/simple_deploy/cli/clone.rb
|
@@ -139,6 +140,7 @@ files:
|
|
139
140
|
- script/ci_setup
|
140
141
|
- simple_deploy.gemspec
|
141
142
|
- spec/artifact_spec.rb
|
143
|
+
- spec/backoff_spec.rb
|
142
144
|
- spec/cli/attributes_spec.rb
|
143
145
|
- spec/cli/clone_spec.rb
|
144
146
|
- spec/cli/deploy_spec.rb
|
@@ -181,6 +183,7 @@ specification_version: 3
|
|
181
183
|
summary: I help with deployments
|
182
184
|
test_files:
|
183
185
|
- spec/artifact_spec.rb
|
186
|
+
- spec/backoff_spec.rb
|
184
187
|
- spec/cli/attributes_spec.rb
|
185
188
|
- spec/cli/clone_spec.rb
|
186
189
|
- spec/cli/deploy_spec.rb
|