nephele 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,10 +1,9 @@
1
1
  Nephele
2
2
  ========
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.
5
-
6
- Planned support:
3
+ Nephele is a thin administration layer around major cloud service API's. Its main goals are simplicity and a unified command line interface for common tasks.
7
4
 
5
+ Planned support
6
+ ----------------
8
7
  * Rackspace
9
8
  * EC2
10
9
 
@@ -16,6 +15,61 @@ Currently, Nephele expects environment variables to set your service keys.
16
15
  RACKSPACE_USER=your_user_name
17
16
  NEPHELE_SERVICE_DEFAULT=rackspace
18
17
 
18
+ Examples
19
+ --------
20
+ Here's an example of someone inspecting available images and flavors on a Rackspace account, deciding to create and save various 'foo' images based on roles and recipes from joeuser's chef git repo:
21
+
22
+ neph images | grep lucid
23
+
24
+ neph flavors | grep 512
25
+
26
+ neph create foo 'Ubuntu 10.04 LTS (lucid)' '512 server'
27
+
28
+ neph create foo 'Ubuntu 10.04 LTS (lucid)' '512 server'
29
+
30
+ neph bootstrap foo 'Ubuntu 10.04 LTS (lucid)' '512 server' -r webserver -c git@github.com:joeuser/cookbooks.git
31
+
32
+ neph save foo lucid-webserver
33
+
34
+ neph restrap foo lucid-webserver '512 server' -r webserver-prod -c git@github.com:joeuser/cookbooks.git
35
+
36
+ neph save foo 'lucid-webserver-prod'
37
+
38
+ neph destroy foo
39
+
40
+ Usage
41
+ -----
42
+ Example usage at time of writing:
43
+
44
+ <pre>
45
+ $ neph --help
46
+ Commands
47
+
48
+ list # Display a list of servers
49
+ images # Display available images
50
+ flavors # List available flavors
51
+ status # Display server status
52
+ create [name] [image] [flavor] # Creates a node with name, image name, flavor
53
+ -C/--count=[NUMERIC] # create foo, foo2, foo3, ...
54
+ save [nodename] [savename] # Save an image of the node
55
+ destroy [name] # Destroy a given node
56
+ password [node] [password] # Change a password on given node
57
+ delete [image] # Delete an image
58
+ bootstrap [name] [image] [flavor] # Create a VM and run a chef bootstrapper, optional recipe, bootstrap, cookbooks args
59
+ restrap [name] [image] [flavor] # Destroy and bootstrap
60
+ archive [name] [image] [flavor] [savename] # Boostrap a VM and save an image of it
61
+
62
+ Global options
63
+
64
+ -c/--cookbooks=[STRING] # optional cookbooks URI
65
+ -p/--personality=[STRING] # comma-separated tuple of contents,targetfile to be placed at startup
66
+ -b/--bootstrap=[STRING] # optional bootstrapper URI, defaults to https://github.com/jodell/cookbooks/raw/master/bin/bootstrap.sh
67
+ -r/--recipe=[STRING] # run this recipe after bootstrapping
68
+ -v/--vpn-credential-file=[STRING] # specify a vpnpass file to seed the target vm
69
+ -P/--prestrap=[STRING] # Executes a command or the contents of a file on a VM prior to bootstrapping
70
+ -?/--help # Print help message
71
+ </pre>
72
+
19
73
  LICENSE
20
74
  -------
21
75
  SEE LICENSE
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.5
1
+ 0.1.6
data/bin/neph CHANGED
@@ -3,7 +3,7 @@
3
3
  require 'rubygems'
4
4
  require 'optitron'
5
5
 
6
- if __FILE__ =~ /bin\/neph/
6
+ if __FILE__ =~ /bin\/neph$/
7
7
  $: << File.expand_path(File.dirname(__FILE__) + '/../lib')
8
8
  require 'nephele'
9
9
  else
@@ -14,11 +14,12 @@ end
14
14
 
15
15
  class Nephele::Runner < Optitron::CLI
16
16
  JODELL_CHEF_BOOTSTRAPPER = 'https://github.com/jodell/cookbooks/raw/master/bin/bootstrap.sh'
17
- class_opt 'cookbooks', "optional cookbooks URI", :type => :string
18
- class_opt 'personality', 'comma-separated tuple of contents,targetfile to be placed at startup', :type => :string
19
- class_opt 'bootstrap', "optional bootstrapper URI, defaults to #{JODELL_CHEF_BOOTSTRAPPER}", :type => :string
20
- class_opt 'recipe', "run this recipe after bootstrapping", :type => :string
17
+ class_opt 'cookbooks', 'optional cookbooks URI', :type => :string
18
+ class_opt 'personality', 'comma-separated tuple of contents,targetfile to be placed at startup', :type => :string
19
+ class_opt 'bootstrap', "optional bootstrapper URI, defaults to #{JODELL_CHEF_BOOTSTRAPPER}", :type => :string
20
+ class_opt 'recipe', 'run this recipe after bootstrapping', :type => :string
21
21
  class_opt 'vpn-credential-file', 'specify a vpnpass file to seed the target vm', :type => :string
22
+ class_opt 'prestrap', 'Executes a command or the contents of a file on a VM prior to bootstrapping', :type => :string
22
23
 
23
24
  desc 'Display a list of servers'
24
25
  def list
@@ -55,6 +56,7 @@ class Nephele::Runner < Optitron::CLI
55
56
  :flavor => flavor,
56
57
  :personality => personality
57
58
  end
59
+ sleep 5
58
60
  end
59
61
 
60
62
  desc 'Save an image of the node'
@@ -80,13 +82,31 @@ class Nephele::Runner < Optitron::CLI
80
82
  service.delete_image image
81
83
  end
82
84
 
85
+ ##
86
+ # neph bootstrap ramsay lucid '512 server' -P "export CHEF_LOG_LEVEL=debug; export CHEF_LOG_LOCATION='chef.log'"
87
+ #
83
88
  desc 'Create a VM and run a chef bootstrapper, optional recipe, bootstrap, cookbooks args'
84
89
  def bootstrap(name, image, flavor)
85
90
  puts "Bootstrapping: #{name}..."
86
91
  create name, image, flavor
87
92
  bootstrap = params['bootstrap'] || JODELL_CHEF_BOOTSTRAPPER
88
- system %-time ssh root@#{@node.addresses[:public]} "curl #{bootstrap} > boot && chmod +x boot && ./boot #{params['cookbooks'] || ''}"-
89
- system %{time ssh root@#{@node.addresses[:public]} "cd -P /var/chef/cookbooks && rake run[#{params['recipe']}]"} if params['recipe']
93
+ node_run "curl #{bootstrap} > boot && chmod +x boot && ./boot #{params['cookbooks'] || ''}"
94
+ # This is inaccurate. Prestrapping is just for changing chef-solo's verbosity.
95
+ #
96
+ recipe_cmd = [
97
+ "#{params['prestrap'] ? prestrap_cmd + ' && ' : ''}",
98
+ "cd -P /var/chef/cookbooks && (bundle check || bundle install) && rake update && rake run[#{params['recipe']}]"
99
+ ].join
100
+ node_run recipe_cmd if params['recipe']
101
+ end
102
+
103
+ def node_run(cmd)
104
+ puts "Running #{cmd}" if ENV['verbose']
105
+ system %-time ssh root@#{@node.addresses[:public]} "#{cmd}"-
106
+ end
107
+
108
+ def prestrap_cmd
109
+ File.exists?(params['prestrap']) ? File.read(params['prestrap']) : params['prestrap']
90
110
  end
91
111
 
92
112
  desc 'Destroy and bootstrap'
data/bin/nephele CHANGED
@@ -3,7 +3,7 @@
3
3
  require 'rubygems'
4
4
  require 'optitron'
5
5
 
6
- if __FILE__ =~ /bin\/neph/
6
+ if __FILE__ =~ /bin\/neph$/
7
7
  $: << File.expand_path(File.dirname(__FILE__) + '/../lib')
8
8
  require 'nephele'
9
9
  else
@@ -14,11 +14,12 @@ end
14
14
 
15
15
  class Nephele::Runner < Optitron::CLI
16
16
  JODELL_CHEF_BOOTSTRAPPER = 'https://github.com/jodell/cookbooks/raw/master/bin/bootstrap.sh'
17
- class_opt 'cookbooks', "optional cookbooks URI", :type => :string
18
- class_opt 'personality', 'comma-separated tuple of contents,targetfile to be placed at startup', :type => :string
19
- class_opt 'bootstrap', "optional bootstrapper URI, defaults to #{JODELL_CHEF_BOOTSTRAPPER}", :type => :string
20
- class_opt 'recipe', "run this recipe after bootstrapping", :type => :string
17
+ class_opt 'cookbooks', 'optional cookbooks URI', :type => :string
18
+ class_opt 'personality', 'comma-separated tuple of contents,targetfile to be placed at startup', :type => :string
19
+ class_opt 'bootstrap', "optional bootstrapper URI, defaults to #{JODELL_CHEF_BOOTSTRAPPER}", :type => :string
20
+ class_opt 'recipe', 'run this recipe after bootstrapping', :type => :string
21
21
  class_opt 'vpn-credential-file', 'specify a vpnpass file to seed the target vm', :type => :string
22
+ class_opt 'prestrap', 'Executes a command or the contents of a file on a VM prior to bootstrapping', :type => :string
22
23
 
23
24
  desc 'Display a list of servers'
24
25
  def list
@@ -55,6 +56,7 @@ class Nephele::Runner < Optitron::CLI
55
56
  :flavor => flavor,
56
57
  :personality => personality
57
58
  end
59
+ sleep 5
58
60
  end
59
61
 
60
62
  desc 'Save an image of the node'
@@ -80,13 +82,31 @@ class Nephele::Runner < Optitron::CLI
80
82
  service.delete_image image
81
83
  end
82
84
 
85
+ ##
86
+ # neph bootstrap ramsay lucid '512 server' -P "export CHEF_LOG_LEVEL=debug; export CHEF_LOG_LOCATION='chef.log'"
87
+ #
83
88
  desc 'Create a VM and run a chef bootstrapper, optional recipe, bootstrap, cookbooks args'
84
89
  def bootstrap(name, image, flavor)
85
90
  puts "Bootstrapping: #{name}..."
86
91
  create name, image, flavor
87
92
  bootstrap = params['bootstrap'] || JODELL_CHEF_BOOTSTRAPPER
88
- system %-time ssh root@#{@node.addresses[:public]} "curl #{bootstrap} > boot && chmod +x boot && ./boot #{params['cookbooks'] || ''}"-
89
- system %{time ssh root@#{@node.addresses[:public]} "cd -P /var/chef/cookbooks && rake run[#{params['recipe']}]"} if params['recipe']
93
+ node_run "curl #{bootstrap} > boot && chmod +x boot && ./boot #{params['cookbooks'] || ''}"
94
+ # This is inaccurate. Prestrapping is just for changing chef-solo's verbosity.
95
+ #
96
+ recipe_cmd = [
97
+ "#{params['prestrap'] ? prestrap_cmd + ' && ' : ''}",
98
+ "cd -P /var/chef/cookbooks && (bundle check || bundle install) && rake update && rake run[#{params['recipe']}]"
99
+ ].join
100
+ node_run recipe_cmd if params['recipe']
101
+ end
102
+
103
+ def node_run(cmd)
104
+ puts "Running #{cmd}" if ENV['verbose']
105
+ system %-time ssh root@#{@node.addresses[:public]} "#{cmd}"-
106
+ end
107
+
108
+ def prestrap_cmd
109
+ File.exists?(params['prestrap']) ? File.read(params['prestrap']) : params['prestrap']
90
110
  end
91
111
 
92
112
  desc 'Destroy and bootstrap'
@@ -43,7 +43,8 @@ class Nephele::Rackspace < Nephele::Base
43
43
  end
44
44
 
45
45
  def delete_image(image)
46
- del = image_objs.find { |i| i.name == image } && del.delete!
46
+ del = image_objs.find { |i| i.name == image }
47
+ del.delete!
47
48
  end
48
49
 
49
50
  def status
data/nephele.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{nephele}
8
- s.version = "0.1.5"
8
+ s.version = "0.1.6"
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-12}
12
+ s.date = %q{2011-04-28}
13
13
  s.description = %q{Light administration utility for popular cloud services}
14
14
  s.email = %q{jeffrey.odell@gmail.com}
15
15
  s.executables = ["neph", "nephele"]
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: 17
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 5
10
- version: 0.1.5
9
+ - 6
10
+ version: 0.1.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jeffrey O'Dell
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-12 00:00:00 -05:00
18
+ date: 2011-04-28 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency