nephele 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +14 -4
- data/Rakefile +0 -68
- data/TODO +2 -0
- data/VERSION +1 -1
- data/bin/neph +91 -0
- data/bin/nephele +2 -1
- data/nephele.gemspec +7 -5
- metadata +9 -5
data/README.md
CHANGED
@@ -1,15 +1,25 @@
|
|
1
1
|
Nephele
|
2
2
|
========
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
Its main goals are simplicity and the unification of common tasks for the sake of working with a set of services.
|
3
|
+
Nephele is a thin administration layer around major cloud service API's.
|
4
|
+
Its main goals are simplicity and a unified command line interface for common tasks.
|
7
5
|
|
8
6
|
Planned support:
|
9
7
|
|
10
8
|
* Rackspace
|
11
9
|
* EC2
|
12
10
|
|
11
|
+
Setting Your Credentials
|
12
|
+
------------------------
|
13
|
+
Currently, Nephele expects environment variables to set your service keys.
|
14
|
+
|
15
|
+
RACKSPACE_KEY=your_api_key
|
16
|
+
RACKSPACE_USER=your_user_name
|
17
|
+
NEPHELE_SERVICE_DEFAULT=rackspace
|
18
|
+
|
19
|
+
LICENSE
|
20
|
+
-------
|
21
|
+
SEE LICENSE
|
22
|
+
|
13
23
|
Other Interesting Projects
|
14
24
|
--------------------------
|
15
25
|
* Fog - https://github.com/geemus/fog
|
data/Rakefile
CHANGED
@@ -24,7 +24,6 @@ Jeweler::Tasks.new do |gem|
|
|
24
24
|
gem.description = %-Light administration utility for popular cloud services-
|
25
25
|
gem.email = 'jeffrey.odell@gmail.com'
|
26
26
|
gem.authors = ["Jeffrey O'Dell"]
|
27
|
-
gem.executables = ['nephele']
|
28
27
|
gem.homepage = 'https://github.com/jodell/nephele'
|
29
28
|
end
|
30
29
|
|
@@ -40,32 +39,6 @@ Rake::TestTask.new('test:unit') do |t|
|
|
40
39
|
t.verbose = true
|
41
40
|
end
|
42
41
|
|
43
|
-
def default
|
44
|
-
@@default ||= Nephele.new :service => :default
|
45
|
-
end
|
46
|
-
|
47
|
-
desc 'List available servers'
|
48
|
-
task :servers do
|
49
|
-
ap default.servers.map { |i| i[:name] }
|
50
|
-
end
|
51
|
-
|
52
|
-
task :list => :servers
|
53
|
-
|
54
|
-
desc 'List available images'
|
55
|
-
task :images do
|
56
|
-
ap default.images.map { |i| i[:name] }
|
57
|
-
end
|
58
|
-
|
59
|
-
desc 'List available flavors'
|
60
|
-
task :flavors do
|
61
|
-
ap default.flavors.map { |i| i[:name] }
|
62
|
-
end
|
63
|
-
|
64
|
-
desc 'Show node statuses'
|
65
|
-
task :status do
|
66
|
-
puts default.status
|
67
|
-
end
|
68
|
-
|
69
42
|
desc 'Key a host'
|
70
43
|
task :key, [:host] do |t, args|
|
71
44
|
host = args[:host] =~ /(.*)@(.*)/ ? args[:host] : "root@#{args[:host]}"
|
@@ -79,47 +52,6 @@ EoC
|
|
79
52
|
sh cmd
|
80
53
|
end
|
81
54
|
|
82
|
-
desc 'Reset the node password (performs a reoot)'
|
83
|
-
task :password, [:node, :pass] do |t, args|
|
84
|
-
default.server_objs.find { |s| s.name == args[:node] }.update(:adminPass => args[:pass])
|
85
|
-
end
|
86
|
-
|
87
|
-
desc 'Save an image of the node'
|
88
|
-
task :save, [:node, :name] do |t, args|
|
89
|
-
default.server_objs.find { |s| s.name == args[:node] }.create_image args[:name]
|
90
|
-
end
|
91
|
-
|
92
|
-
desc "Creates a node with name, image name, flavor, optional count: `rake create[mybox,oberon,'512 server'] count=4`"
|
93
|
-
task :create, [:name, :image, :flavor] do |t, args|
|
94
|
-
(ENV['count'] || 1).to_i.times do |i|
|
95
|
-
@node = default.create \
|
96
|
-
:name => args[:name] + "#{ENV['count'] ? i + 1 : ''}",
|
97
|
-
:image => Nephele::Rackspace.image_lookup(args[:image]),
|
98
|
-
:flavor => args[:flavor],
|
99
|
-
:personality => Nephele::Rackspace::Util.personality(ENV['personality'] || :default)
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
JODELL_CHEF_BOOTSTRAPPER = 'https://github.com/jodell/cookbooks/raw/master/bin/bootstrap.sh'
|
104
|
-
|
105
|
-
desc 'Create a VM and run a chef bootstrapper, optional recipe, bootstrap, cookbooks args'
|
106
|
-
task :bootstrap, [:name, :image, :flavor] => :create do |t, args|
|
107
|
-
puts "Bootstrapping: #{args[:name]}..."
|
108
|
-
bootstrapper = ENV['bootstrap'] || JODELL_CHEF_BOOTSTRAPPER
|
109
|
-
alt = ENV['cookbooks']
|
110
|
-
sh %-time ssh root@#{@node.addresses[:public]} "curl #{bootstrapper} > boot && chmod +x boot && ./boot #{alt}"-
|
111
|
-
sh %{time ssh root@#{@node.addresses[:public]} "cd -P /var/chef/cookbooks && rake run[#{ENV['recipe']}]"} if ENV['recipe']
|
112
|
-
end
|
113
|
-
|
114
|
-
desc 'Destroy, bootstrap'
|
115
|
-
task :restrap, [:name, :image, :flavor] => [:destroy, :bootstrap]
|
116
|
-
|
117
|
-
desc 'Destroy a node with name `rake destroy[foo]`'
|
118
|
-
task :destroy, [:name] do |t, args|
|
119
|
-
puts "Destroying: #{args[:name]}"
|
120
|
-
default.server_objs.find { |s| s.name == args[:name] }.delete!
|
121
|
-
end
|
122
|
-
|
123
55
|
desc 'Start IRB with the relevant env'
|
124
56
|
task :console do
|
125
57
|
ARGV.clear and IRB.start
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/bin/neph
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'optitron'
|
5
|
+
begin
|
6
|
+
require 'nephele'
|
7
|
+
rescue LoadError
|
8
|
+
$: << File.expand_path(File.dirname(__FILE__) + '/../lib')
|
9
|
+
require 'nephele'
|
10
|
+
end
|
11
|
+
# awesome_print doesn't seem to play nice with optitron?
|
12
|
+
#require 'ap'
|
13
|
+
|
14
|
+
class Nephele::Runner < Optitron::CLI
|
15
|
+
JODELL_CHEF_BOOTSTRAPPER = 'https://github.com/jodell/cookbooks/raw/master/bin/bootstrap.sh'
|
16
|
+
class_opt 'cookbooks', "optional cookbooks URI", :type => :string
|
17
|
+
class_opt 'personality', 'comma-separated tuple of contents,targetfile to be placed at startup', :type => :string
|
18
|
+
class_opt 'bootstrap', "optional bootstrapper URI, defaults to #{JODELL_CHEF_BOOTSTRAPPER}", :type => :string
|
19
|
+
class_opt 'recipe', "run this recipe after bootstrapping", :type => :string
|
20
|
+
|
21
|
+
desc 'Display a list of servers'
|
22
|
+
def list
|
23
|
+
puts service.servers.map { |i| i[:name] }
|
24
|
+
end
|
25
|
+
|
26
|
+
desc 'Display available images'
|
27
|
+
def images
|
28
|
+
puts service.images.map { |i| i[:name] }
|
29
|
+
end
|
30
|
+
|
31
|
+
desc 'List available flavors'
|
32
|
+
def flavors
|
33
|
+
puts service.flavors.map { |i| i[:name] }
|
34
|
+
end
|
35
|
+
|
36
|
+
desc 'Display server status'
|
37
|
+
def status
|
38
|
+
puts service.status
|
39
|
+
end
|
40
|
+
|
41
|
+
desc 'Change a password on given node'
|
42
|
+
def password(node_string, password_string)
|
43
|
+
service.server_objs.find { |s| s.name == node_string }.update(:adminPass => password_string)
|
44
|
+
end
|
45
|
+
|
46
|
+
desc 'Save an image of the node'
|
47
|
+
def save(node_string, savename_string)
|
48
|
+
service.server_objs.find { |s| s.name == node_string }.create_image name_string
|
49
|
+
end
|
50
|
+
|
51
|
+
desc "Creates a node with name, image name, flavor"
|
52
|
+
opt 'count', 'create foo, foo2, foo3, ...', :type => :numeric
|
53
|
+
def create(name, image, flavor)
|
54
|
+
(params['count'] || 1).to_i.times do |i|
|
55
|
+
@node = service.create \
|
56
|
+
:name => name + "#{params['count'] ? i + 1 : ''}",
|
57
|
+
:image => Nephele::Rackspace.image_lookup(image),
|
58
|
+
:flavor => flavor,
|
59
|
+
:personality => Nephele::Rackspace::Util.personality(params['personality'] || :default)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
desc 'Create a VM and run a chef bootstrapper, optional recipe, bootstrap, cookbooks args'
|
64
|
+
def bootstrap(name, image, flavor)
|
65
|
+
puts "Bootstrapping: #{name}..."
|
66
|
+
create name, image, flavor
|
67
|
+
bootstrap = params['bootstrap'] || JODELL_CHEF_BOOTSTRAPPER
|
68
|
+
system %-time ssh root@#{@node.addresses[:public]} "curl #{bootstrap} > boot && chmod +x boot && ./boot #{params['cookbooks'] || ''}"-
|
69
|
+
system %{time ssh root@#{@node.addresses[:public]} "cd -P /var/chef/cookbooks && rake run[#{params['recipe']}]"} if params['recipe']
|
70
|
+
end
|
71
|
+
|
72
|
+
desc 'Destroy and bootstrap'
|
73
|
+
def restrap(name, image, flavor)
|
74
|
+
destroy name
|
75
|
+
bootstrap name, image, flavor
|
76
|
+
end
|
77
|
+
|
78
|
+
desc 'Destroy a given node'
|
79
|
+
def destroy(name_string)
|
80
|
+
if node = service.server_objs.find { |s| s.name == name_string }
|
81
|
+
puts "Destroying: #{name_string}"
|
82
|
+
node.delete!
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def service
|
87
|
+
@@service ||= Nephele.new(:service => :default)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
Nephele::Runner.dispatch
|
data/bin/nephele
CHANGED
@@ -8,6 +8,7 @@ rescue LoadError
|
|
8
8
|
$: << File.expand_path(File.dirname(__FILE__) + '/../lib')
|
9
9
|
require 'nephele'
|
10
10
|
end
|
11
|
+
# awesome_print doesn't seem to play nice with optitron?
|
11
12
|
#require 'ap'
|
12
13
|
|
13
14
|
class Nephele::Runner < Optitron::CLI
|
@@ -24,7 +25,7 @@ class Nephele::Runner < Optitron::CLI
|
|
24
25
|
|
25
26
|
desc 'Display available images'
|
26
27
|
def images
|
27
|
-
puts
|
28
|
+
puts service.images.map { |i| i[:name] }
|
28
29
|
end
|
29
30
|
|
30
31
|
desc 'List available flavors'
|
data/nephele.gemspec
CHANGED
@@ -5,18 +5,18 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{nephele}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jeffrey O'Dell"]
|
12
|
-
s.date = %q{2011-04-
|
13
|
-
s.default_executable = %q{nephele}
|
12
|
+
s.date = %q{2011-04-11}
|
14
13
|
s.description = %q{Light administration utility for popular cloud services}
|
15
14
|
s.email = %q{jeffrey.odell@gmail.com}
|
16
|
-
s.executables = ["nephele"]
|
15
|
+
s.executables = ["neph", "nephele"]
|
17
16
|
s.extra_rdoc_files = [
|
18
17
|
"LICENSE",
|
19
|
-
"README.md"
|
18
|
+
"README.md",
|
19
|
+
"TODO"
|
20
20
|
]
|
21
21
|
s.files = [
|
22
22
|
".autotest",
|
@@ -24,7 +24,9 @@ Gem::Specification.new do |s|
|
|
24
24
|
"LICENSE",
|
25
25
|
"README.md",
|
26
26
|
"Rakefile",
|
27
|
+
"TODO",
|
27
28
|
"VERSION",
|
29
|
+
"bin/neph",
|
28
30
|
"bin/nephele",
|
29
31
|
"lib/nephele.rb",
|
30
32
|
"lib/nephele/base.rb",
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nephele
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jeffrey O'Dell
|
@@ -15,8 +15,8 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-04-
|
19
|
-
default_executable:
|
18
|
+
date: 2011-04-11 00:00:00 -05:00
|
19
|
+
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: rake
|
@@ -191,19 +191,23 @@ dependencies:
|
|
191
191
|
description: Light administration utility for popular cloud services
|
192
192
|
email: jeffrey.odell@gmail.com
|
193
193
|
executables:
|
194
|
+
- neph
|
194
195
|
- nephele
|
195
196
|
extensions: []
|
196
197
|
|
197
198
|
extra_rdoc_files:
|
198
199
|
- LICENSE
|
199
200
|
- README.md
|
201
|
+
- TODO
|
200
202
|
files:
|
201
203
|
- .autotest
|
202
204
|
- Gemfile
|
203
205
|
- LICENSE
|
204
206
|
- README.md
|
205
207
|
- Rakefile
|
208
|
+
- TODO
|
206
209
|
- VERSION
|
210
|
+
- bin/neph
|
207
211
|
- bin/nephele
|
208
212
|
- lib/nephele.rb
|
209
213
|
- lib/nephele/base.rb
|