simple_deploy 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +7 -0
- data/README.md +1 -11
- data/lib/simple_deploy/cli.rb +2 -2
- data/lib/simple_deploy/cli/deploy.rb +15 -0
- data/lib/simple_deploy/cli/protect.rb +3 -5
- data/lib/simple_deploy/stack/deployment.rb +7 -3
- data/lib/simple_deploy/stack/stack_attribute_formater.rb +4 -4
- data/lib/simple_deploy/version.rb +1 -1
- data/spec/cli/protect_spec.rb +2 -2
- data/spec/stack/deployment_spec.rb +7 -3
- data/spec/stack/stack_attribute_formater_spec.rb +11 -26
- metadata +12 -12
data/CHANGELOG
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## v0.5.1:
|
2
|
+
|
3
|
+
* Corrected the use of the domain attribute in URLs during deployments
|
4
|
+
* Corrected the use of the force option during deployments
|
5
|
+
* Added help text on SSH usage to the deploy command
|
6
|
+
* Corrected the acceptable options for the protect command
|
7
|
+
|
1
8
|
## v0.5.0:
|
2
9
|
|
3
10
|
* Updated the update command so it accepts a force option
|
data/README.md
CHANGED
@@ -12,16 +12,6 @@ gem install simple_deploy
|
|
12
12
|
Create a file **~/.simple_deploy.yml** and include within it:
|
13
13
|
|
14
14
|
```
|
15
|
-
artifacts:
|
16
|
-
chef_repo:
|
17
|
-
bucket_prefix: bucket1
|
18
|
-
domain: app1-chef_repo
|
19
|
-
app:
|
20
|
-
bucket_prefix: bucket2
|
21
|
-
domain: app1
|
22
|
-
cookbooks:
|
23
|
-
bucket_prefix: bucket2
|
24
|
-
|
25
15
|
environments:
|
26
16
|
preprod_shared_us_west_1:
|
27
17
|
access_key: XXX
|
@@ -41,7 +31,7 @@ Currently Simple Deploy only supports Campfire for notifications. To enable the
|
|
41
31
|
Advaned Configurations
|
42
32
|
----------------------
|
43
33
|
|
44
|
-
The configuration file supports additional optional deployment parameters.
|
34
|
+
The configuration file supports additional optional deployment parameters.
|
45
35
|
|
46
36
|
Deploy can have a ssh **user** and **key** set. These will be used to connect to both the gateway and tunnel through to instances.
|
47
37
|
|
data/lib/simple_deploy/cli.rb
CHANGED
@@ -57,13 +57,13 @@ module SimpleDeploy
|
|
57
57
|
when 'update'
|
58
58
|
CLI::Update.new.update
|
59
59
|
when '-h'
|
60
|
-
puts "simple_deploy [attributes|create|destroy|environments|events|instances|list|template|outputs|parameters|resources|ssh|status|update] [options]"
|
60
|
+
puts "simple_deploy [attributes|create|destroy|environments|events|instances|list|template|outputs|parameters|protect|resources|ssh|status|update] [options]"
|
61
61
|
puts "Append -h for help on specific subcommand."
|
62
62
|
when '-v'
|
63
63
|
puts SimpleDeploy::VERSION
|
64
64
|
else
|
65
65
|
puts "Unknown command: '#{cmd}'."
|
66
|
-
puts "simple_deploy [attributes|create|destroy|environments|events|instances|list|template|outputs|parameters|resources|ssh|status|update] [options]"
|
66
|
+
puts "simple_deploy [attributes|create|destroy|environments|events|instances|list|template|outputs|parameters|protect|resources|ssh|status|update] [options]"
|
67
67
|
puts "Append -h for help on specific subcommand."
|
68
68
|
exit 1
|
69
69
|
end
|
@@ -12,6 +12,21 @@ Execute deployment on given stack(s).
|
|
12
12
|
|
13
13
|
simple_deploy deploy -n STACK_NAME -n STACK_NAME -e ENVIRONMENT
|
14
14
|
|
15
|
+
Using SSH:
|
16
|
+
|
17
|
+
Simple deploy defaults your user and key for SSH to your username and your id_rsa key.
|
18
|
+
|
19
|
+
If you need to override these because you want to use a different username or you have a different key file,
|
20
|
+
you can set simple deploy specific environment variables to do the override.
|
21
|
+
|
22
|
+
Example 1: Overriding when the command is run.
|
23
|
+
SIMPLE_DEPLOY_SSH_USER=fred SIMPLE_DEPLOY_SSH_KEY=$HOME/.ssh/id_dsa simple_deploy deploy -n STACK_NAME -n STACK_NAME -e ENVIRONMENT
|
24
|
+
|
25
|
+
Example 2: Overriding them in your shell environment (bash shell used in the example).
|
26
|
+
export SIMPLE_DEPLOY_SSH_USER=fred
|
27
|
+
export SIMPLE_DEPLOY_SSH_KEY=$HOME/.ssh/id_dsa
|
28
|
+
simple_deploy deploy -n STACK_NAME -n STACK_NAME -e ENVIRONMENT
|
29
|
+
|
15
30
|
EOS
|
16
31
|
opt :help, "Display Help"
|
17
32
|
opt :attributes, "= seperated attribute and it's value", :type => :string,
|
@@ -11,11 +11,12 @@ module SimpleDeploy
|
|
11
11
|
|
12
12
|
Protect a stack.
|
13
13
|
|
14
|
-
simple_deploy protect -n STACK_NAME -e ENVIRONMENT -
|
14
|
+
simple_deploy protect -n STACK_NAME -e ENVIRONMENT -p on_off
|
15
15
|
|
16
16
|
EOS
|
17
17
|
opt :help, "Display Help"
|
18
18
|
opt :environment, "Set the target environment", :type => :string
|
19
|
+
opt :protection, "Enable/Disable protection using on/off", :type => :string
|
19
20
|
opt :log_level, "Log level: debug, info, warn, error", :type => :string,
|
20
21
|
:default => 'info'
|
21
22
|
opt :name, "Stack name of stack to protect", :type => :string
|
@@ -28,14 +29,11 @@ EOS
|
|
28
29
|
|
29
30
|
logger = SimpleDeployLogger.new :log_level => opts[:log_level]
|
30
31
|
|
31
|
-
attributes = CLI::Shared.parse_attributes :attributes => opts[:attributes],
|
32
|
-
:logger => logger
|
33
|
-
|
34
32
|
stack = Stack.new :environment => opts[:environment],
|
35
33
|
:name => opts[:name],
|
36
34
|
:config => config,
|
37
35
|
:logger => logger
|
38
|
-
stack.update :attributes =>
|
36
|
+
stack.update :attributes => [{ 'protection' => opts[:protection] }]
|
39
37
|
end
|
40
38
|
end
|
41
39
|
end
|
@@ -35,7 +35,11 @@ module SimpleDeploy
|
|
35
35
|
set_deploy_command
|
36
36
|
end
|
37
37
|
|
38
|
-
def execute(force=false)
|
38
|
+
def execute(force = false)
|
39
|
+
if !clear_for_deployment? && force
|
40
|
+
clear_deployment_lock true
|
41
|
+
end
|
42
|
+
|
39
43
|
if clear_for_deployment?
|
40
44
|
status.set_deployment_in_progress
|
41
45
|
@logger.info 'Starting deployment.'
|
@@ -53,8 +57,8 @@ module SimpleDeploy
|
|
53
57
|
status.clear_for_deployment?
|
54
58
|
end
|
55
59
|
|
56
|
-
def clear_deployment_lock(force=false)
|
57
|
-
status.clear_deployment_lock
|
60
|
+
def clear_deployment_lock(force = false)
|
61
|
+
status.clear_deployment_lock force
|
58
62
|
end
|
59
63
|
|
60
64
|
def ssh
|
@@ -27,20 +27,20 @@ module SimpleDeploy
|
|
27
27
|
@config.artifacts
|
28
28
|
end
|
29
29
|
|
30
|
-
def cloud_formation_url
|
30
|
+
def cloud_formation_url(attribute)
|
31
31
|
name = attribute.keys.first
|
32
32
|
id = attribute[name]
|
33
|
-
a = @config.artifacts.select { |a| a['name'] == name }.first
|
34
33
|
|
35
34
|
bucket_prefix = @main_attributes["#{name}_bucket_prefix"]
|
36
|
-
|
37
|
-
|
35
|
+
domain = @main_attributes["#{name}_domain"]
|
38
36
|
artifact = Artifact.new :name => name,
|
39
37
|
:id => id,
|
40
38
|
:region => @region,
|
41
39
|
:config => @config,
|
40
|
+
:domain => domain,
|
42
41
|
:bucket_prefix => bucket_prefix
|
43
42
|
|
43
|
+
url_parameter = @config.artifact_cloud_formation_url name
|
44
44
|
{ url_parameter => artifact.endpoints['s3'] }
|
45
45
|
end
|
46
46
|
|
data/spec/cli/protect_spec.rb
CHANGED
@@ -20,7 +20,7 @@ describe SimpleDeploy::CLI::Protect do
|
|
20
20
|
options = { :environment => 'my_env',
|
21
21
|
:log_level => 'debug',
|
22
22
|
:name => 'my_stack',
|
23
|
-
:
|
23
|
+
:protection => 'on' }
|
24
24
|
|
25
25
|
SimpleDeploy::CLI::Shared.should_receive(:valid_options?).
|
26
26
|
with(:provided => options,
|
@@ -44,7 +44,7 @@ describe SimpleDeploy::CLI::Protect do
|
|
44
44
|
options = { :environment => 'my_env',
|
45
45
|
:log_level => 'debug',
|
46
46
|
:name => 'my_stack',
|
47
|
-
:
|
47
|
+
:protection => 'off' }
|
48
48
|
|
49
49
|
SimpleDeploy::CLI::Shared.should_receive(:valid_options?).
|
50
50
|
with(:provided => options,
|
@@ -91,10 +91,11 @@ describe SimpleDeploy do
|
|
91
91
|
status_mock = mock 'status mock'
|
92
92
|
SimpleDeploy::Stack::Deployment::Status.should_receive(:new).
|
93
93
|
and_return status_mock
|
94
|
-
status_mock.
|
94
|
+
status_mock.stub(:clear_for_deployment?).and_return true
|
95
95
|
status_mock.should_receive(:set_deployment_in_progress)
|
96
96
|
@deployment_mock.should_receive(:simpledeploy)
|
97
97
|
status_mock.should_receive(:unset_deployment_in_progress)
|
98
|
+
|
98
99
|
@stack.execute.should == true
|
99
100
|
end
|
100
101
|
|
@@ -102,10 +103,12 @@ describe SimpleDeploy do
|
|
102
103
|
status_mock = mock 'status mock'
|
103
104
|
SimpleDeploy::Stack::Deployment::Status.should_receive(:new).
|
104
105
|
and_return status_mock
|
105
|
-
status_mock.should_receive(:clear_for_deployment?).and_return true
|
106
|
+
status_mock.should_receive(:clear_for_deployment?).and_return false, true
|
107
|
+
status_mock.should_receive(:clear_deployment_lock).with(true)
|
106
108
|
status_mock.should_receive(:set_deployment_in_progress)
|
107
109
|
@deployment_mock.should_receive(:simpledeploy)
|
108
110
|
status_mock.should_receive(:unset_deployment_in_progress)
|
111
|
+
|
109
112
|
@stack.execute(true).should == true
|
110
113
|
end
|
111
114
|
|
@@ -113,8 +116,9 @@ describe SimpleDeploy do
|
|
113
116
|
status_mock = mock 'status mock'
|
114
117
|
SimpleDeploy::Stack::Deployment::Status.should_receive(:new).
|
115
118
|
and_return status_mock
|
116
|
-
status_mock.
|
119
|
+
status_mock.stub(:clear_for_deployment?).and_return false
|
117
120
|
@logger_stub.should_receive(:error)
|
121
|
+
|
118
122
|
@stack.execute.should == false
|
119
123
|
end
|
120
124
|
end
|
@@ -2,37 +2,22 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe SimpleDeploy do
|
4
4
|
before do
|
5
|
-
@
|
6
|
-
@
|
7
|
-
@config_mock.
|
8
|
-
|
9
|
-
@config_mock.should_receive(:logger).and_return @logger_mock
|
5
|
+
@logger_mock = mock 'logger mock', :info => 'true'
|
6
|
+
@config_mock = mock 'config mock', :logger => @logger_mock, :region => 'us-west-1'
|
7
|
+
@config_mock.stub(:artifact_cloud_formation_url).and_return('CookBooksURL')
|
8
|
+
@config_mock.stub(:artifacts).and_return(['chef_repo', 'cookbooks', 'app'])
|
10
9
|
|
11
10
|
options = { :config => @config_mock,
|
12
11
|
:environment => 'preprod',
|
13
|
-
:main_attributes => {
|
12
|
+
:main_attributes => {
|
13
|
+
'chef_repo_bucket_prefix' => 'test-prefix',
|
14
|
+
'chef_repo_domain' => 'test-domain' }
|
15
|
+
}
|
14
16
|
@formater = SimpleDeploy::StackAttributeFormater.new options
|
15
17
|
end
|
16
18
|
|
17
|
-
it
|
18
|
-
|
19
|
-
|
20
|
-
with(:name => 'chef_repo',
|
21
|
-
:id => 'test123',
|
22
|
-
:region => 'us-west-1',
|
23
|
-
:config => @config_mock,
|
24
|
-
:bucket_prefix => 'test-prefix').
|
25
|
-
and_return artifact_mock
|
26
|
-
@config_mock.should_receive(:artifact_cloud_formation_url).with('chef_repo').
|
27
|
-
exactly(2).times.
|
28
|
-
and_return('CookBooksURL')
|
29
|
-
@config_mock.should_receive(:artifacts).exactly(3).times.
|
30
|
-
and_return ['chef_repo', 'cookbooks', 'app']
|
31
|
-
@logger_mock.should_receive(:info)
|
32
|
-
artifact_mock.should_receive(:endpoints).exactly(2).times.
|
33
|
-
and_return 's3' => 's3_url'
|
34
|
-
@formater.updated_attributes([ { 'chef_repo' => 'test123' } ]).
|
35
|
-
should == [ { "chef_repo" => "test123" },
|
36
|
-
{ "CookBooksURL" =>"s3_url" } ]
|
19
|
+
it 'should return updated attributes including the cloud formation url' do
|
20
|
+
updates = @formater.updated_attributes([ { 'chef_repo' => 'test123' } ])
|
21
|
+
updates.should == [{ 'chef_repo' => 'test123' }, { 'CookBooksURL' => 's3://test-prefix-us-west-1/test-domain/test123.tar.gz' }]
|
37
22
|
end
|
38
23
|
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.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &2155888560 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2155888560
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: capistrano
|
27
|
-
requirement: &
|
27
|
+
requirement: &2155887980 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2155887980
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: stackster
|
38
|
-
requirement: &
|
38
|
+
requirement: &2155887300 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - =
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 0.2.9
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2155887300
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: tinder
|
49
|
-
requirement: &
|
49
|
+
requirement: &2155886560 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2155886560
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: trollop
|
60
|
-
requirement: &
|
60
|
+
requirement: &2156048720 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2156048720
|
69
69
|
description: I am designed to deploy artifacts uploaded by Heirloom
|
70
70
|
email:
|
71
71
|
- brett@weav.net
|