kraken 0.0.7 → 0.0.9
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.
- checksums.yaml +15 -0
- data/.gitignore +17 -0
- data/Gemfile +7 -0
- data/LICENSE +22 -0
- data/README.md +31 -0
- data/Rakefile +2 -0
- data/kraken.gemspec +25 -0
- data/lib/chef/knife/deploy.rb +65 -0
- data/lib/kraken/version.rb +1 -1
- data/spec/lib/kraken_spec.rb +5 -0
- data/spec/spec_helper.rb +6 -0
- metadata +17 -27
- data/lib/kraken.rb +0 -8
- data/lib/kraken/bestower.rb +0 -71
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NmI4M2IxMDQzOGVkYjZhYjg3YmRiNjQyZDE5MjhkNTNhNGE0MGU5MA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
Y2JmNzU4ZDFmNmViNjA2N2Y0YmVhZjgwYTJlYmE0NmI4ZDcwMGE0NA==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YzY1MGJkOGNkNmFiZmNiYzc3ZGNkMTZkZDdiZTRmZmZlMTRhZDgxNmQyMjBj
|
10
|
+
NWMxZTdmYTNlMDhhMDZjYjFjYmYxODdhMTk5MDEwYTFjNmNmZDNjYjVkMDJm
|
11
|
+
MzhlODQ2MDBkMGVkYTlkZGFhN2ZiMWNkYjYxMmJhNmJmNmMwZTI=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MGZhODY3YTZhOGZiNDFkYWM3NWRiZTJkMTg5OTJlNzlhMjliM2IzZGQzOTMz
|
14
|
+
NjQ0NGQ0MjZjNmYzNWEwZWM0OTM4ZmQ1OTlmZWQwMTk4NDQyMWZmMGNjZjdh
|
15
|
+
Mzk5NDQ2ZDVlMzk5ODExODJhMGZkYWY4NDM0MjRlZGM0ZTI1NGE=
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Umang Chouhan
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Kraken
|
2
|
+
|
3
|
+
Test driven configuration and deploys across multiple environments and servers.
|
4
|
+
|
5
|
+

|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'kraken'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install kraken
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Inherit from Kraken and you shall receive all the power you need.
|
24
|
+
|
25
|
+
## Contributing
|
26
|
+
|
27
|
+
1. Fork it
|
28
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
30
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
31
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/kraken.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/kraken/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = [ 'Umang Chouhan' ]
|
6
|
+
gem.email = [ 'uchouhan@optimiscorp.com' ]
|
7
|
+
gem.description = 'Test driven configuration and deploys across multiple environments and servers.'
|
8
|
+
gem.summary = 'Use chefs knife to automate complicated deploys.'
|
9
|
+
gem.homepage = 'http://github.com/optimis/kraken'
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split("\n")
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map { |file| File.basename(file) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
|
15
|
+
gem.name = 'kraken'
|
16
|
+
gem.require_paths = [ 'lib' ]
|
17
|
+
gem.version = Kraken::VERSION
|
18
|
+
|
19
|
+
gem.add_dependency 'net-ssh'
|
20
|
+
gem.add_dependency 'chef'
|
21
|
+
|
22
|
+
gem.add_development_dependency 'rake'
|
23
|
+
gem.add_development_dependency 'rspec'
|
24
|
+
gem.add_development_dependency 'webmock'
|
25
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'chef/knife'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class Deploy < Knife
|
6
|
+
deps do
|
7
|
+
require 'chef/search/query'
|
8
|
+
end
|
9
|
+
|
10
|
+
banner 'knife deploy APPLICATION ENVIRONMENT (options)'
|
11
|
+
|
12
|
+
option :application, short: '-a APPLICATION', long: '--application', description: 'The application to deploy.'
|
13
|
+
option :environment, short: '-e ENVIRONMENT', long: '--environment', description: 'The environment to deploy.', default: 'rc'
|
14
|
+
|
15
|
+
def run
|
16
|
+
nodes.each do |node|
|
17
|
+
Chef::Log.debug "Enabling deploy for #{application} on #{environment}."
|
18
|
+
chef node
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
def application
|
24
|
+
config[:application]
|
25
|
+
end
|
26
|
+
|
27
|
+
def environment
|
28
|
+
config[:environment]
|
29
|
+
end
|
30
|
+
|
31
|
+
def nodes
|
32
|
+
q = Chef::Search::Query.new
|
33
|
+
params = "chef_environment:#{environment} AND tags:#{application}"
|
34
|
+
query = URI.escape(params, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
|
35
|
+
|
36
|
+
nodes = []
|
37
|
+
q.search 'node', query do |node|
|
38
|
+
Chef::Log.debug "Adding node #{node.inspect}."
|
39
|
+
nodes << node
|
40
|
+
end
|
41
|
+
nodes
|
42
|
+
end
|
43
|
+
|
44
|
+
def command
|
45
|
+
'sudo chef-client'
|
46
|
+
end
|
47
|
+
|
48
|
+
def user
|
49
|
+
'config'
|
50
|
+
end
|
51
|
+
|
52
|
+
def chef(node)
|
53
|
+
ssh = Chef::Knife::Ssh.new
|
54
|
+
ssh.config[:node_name] = node.name
|
55
|
+
ssh.config[:ssh_user] = user
|
56
|
+
ssh.config[:attribute] = 'ipaddress'
|
57
|
+
ssh.config[:manual] = false
|
58
|
+
ssh.name_args = [ "name:#{node.name}", command ]
|
59
|
+
ssh.run
|
60
|
+
|
61
|
+
Chef::Log.debug "Kraken deployed to #{node.name}!"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
data/lib/kraken/version.rb
CHANGED
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kraken
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.9
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Umang Chouhan
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-02-17 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: net-ssh
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ! '>='
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ! '>='
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: chef
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ! '>='
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ! '>='
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -46,7 +41,6 @@ dependencies:
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rake
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ! '>='
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ! '>='
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -62,7 +55,6 @@ dependencies:
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: rspec
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
59
|
- - ! '>='
|
68
60
|
- !ruby/object:Gem::Version
|
@@ -70,7 +62,6 @@ dependencies:
|
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
66
|
- - ! '>='
|
76
67
|
- !ruby/object:Gem::Version
|
@@ -78,7 +69,6 @@ dependencies:
|
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: webmock
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
73
|
- - ! '>='
|
84
74
|
- !ruby/object:Gem::Version
|
@@ -86,7 +76,6 @@ dependencies:
|
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
80
|
- - ! '>='
|
92
81
|
- !ruby/object:Gem::Version
|
@@ -99,38 +88,39 @@ executables: []
|
|
99
88
|
extensions: []
|
100
89
|
extra_rdoc_files: []
|
101
90
|
files:
|
102
|
-
-
|
91
|
+
- .gitignore
|
92
|
+
- Gemfile
|
93
|
+
- LICENSE
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- kraken.gemspec
|
97
|
+
- lib/chef/knife/deploy.rb
|
103
98
|
- lib/kraken/version.rb
|
104
|
-
- lib/
|
99
|
+
- spec/lib/kraken_spec.rb
|
100
|
+
- spec/spec_helper.rb
|
105
101
|
homepage: http://github.com/optimis/kraken
|
106
102
|
licenses: []
|
103
|
+
metadata: {}
|
107
104
|
post_install_message:
|
108
105
|
rdoc_options: []
|
109
106
|
require_paths:
|
110
107
|
- lib
|
111
|
-
- lib/kraken
|
112
108
|
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
109
|
requirements:
|
115
110
|
- - ! '>='
|
116
111
|
- !ruby/object:Gem::Version
|
117
112
|
version: '0'
|
118
|
-
segments:
|
119
|
-
- 0
|
120
|
-
hash: 2295443579256165516
|
121
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
|
-
none: false
|
123
114
|
requirements:
|
124
115
|
- - ! '>='
|
125
116
|
- !ruby/object:Gem::Version
|
126
117
|
version: '0'
|
127
|
-
segments:
|
128
|
-
- 0
|
129
|
-
hash: 2295443579256165516
|
130
118
|
requirements: []
|
131
119
|
rubyforge_project:
|
132
|
-
rubygems_version:
|
120
|
+
rubygems_version: 2.2.1
|
133
121
|
signing_key:
|
134
|
-
specification_version:
|
122
|
+
specification_version: 4
|
135
123
|
summary: Use chefs knife to automate complicated deploys.
|
136
|
-
test_files:
|
124
|
+
test_files:
|
125
|
+
- spec/lib/kraken_spec.rb
|
126
|
+
- spec/spec_helper.rb
|
data/lib/kraken.rb
DELETED
data/lib/kraken/bestower.rb
DELETED
@@ -1,71 +0,0 @@
|
|
1
|
-
module Kraken
|
2
|
-
class Bestower < Chef::Knife
|
3
|
-
deps do
|
4
|
-
require 'chef/search/query'
|
5
|
-
|
6
|
-
Chef::Knife::Ssh.load_deps
|
7
|
-
end
|
8
|
-
|
9
|
-
private
|
10
|
-
def environment
|
11
|
-
config[:environment] || 'RC'
|
12
|
-
end
|
13
|
-
|
14
|
-
def nodes(tag)
|
15
|
-
query = Chef::Search::Query.new
|
16
|
-
|
17
|
-
nodes = []
|
18
|
-
query.search 'node', "chef_environment:#{environment} AND tags:#{tag}" do |node|
|
19
|
-
nodes << node
|
20
|
-
end
|
21
|
-
nodes
|
22
|
-
end
|
23
|
-
|
24
|
-
def rc?
|
25
|
-
environment == 'RC'
|
26
|
-
end
|
27
|
-
|
28
|
-
def user
|
29
|
-
rc? ? 'ec2-user' : 'config'
|
30
|
-
end
|
31
|
-
|
32
|
-
def command
|
33
|
-
'sudo chef-client'
|
34
|
-
end
|
35
|
-
|
36
|
-
def chef(node, recipe)
|
37
|
-
ssh = Chef::Knife::Ssh.new
|
38
|
-
ssh.config[:node_name] = node.name
|
39
|
-
ssh.config[:ssh_user] = user
|
40
|
-
|
41
|
-
if rc?
|
42
|
-
ssh.config[:attribute] = 'ec2.public_hostname'
|
43
|
-
ssh.config[:identity_file] = '~/.ssh/aws'
|
44
|
-
else
|
45
|
-
ssh.config[:attribute] = 'ipaddress'
|
46
|
-
end
|
47
|
-
|
48
|
-
ssh.name_args = [ "name:#{node.name}", command ]
|
49
|
-
ssh.run
|
50
|
-
|
51
|
-
node.run_list.remove "recipe[#{recipe}]"
|
52
|
-
node.save
|
53
|
-
|
54
|
-
Chef::Log.debug "Kraken deployed #{recipe} on #{node.name}!"
|
55
|
-
end
|
56
|
-
|
57
|
-
def perform(application, recipe)
|
58
|
-
nodes(application).each do |node|
|
59
|
-
Chef::Log.debug "Adding #{recipe} to #{node.name}'s run list."
|
60
|
-
|
61
|
-
run_list = node.run_list
|
62
|
-
|
63
|
-
node.run_list << recipe
|
64
|
-
node.save
|
65
|
-
|
66
|
-
Chef::Log.debug "Running chef client on #{node.name}."
|
67
|
-
chef node, recipe
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|