solutious-rudy 0.4.0
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.
- data/CHANGES.txt +75 -0
- data/LICENSE.txt +19 -0
- data/README.rdoc +36 -0
- data/Rakefile +68 -0
- data/bin/rudy +175 -0
- data/bin/rudy-ec2 +108 -0
- data/lib/aws_sdb.rb +3 -0
- data/lib/aws_sdb/error.rb +42 -0
- data/lib/aws_sdb/service.rb +215 -0
- data/lib/console.rb +385 -0
- data/lib/rudy.rb +210 -0
- data/lib/rudy/aws.rb +68 -0
- data/lib/rudy/aws/ec2.rb +304 -0
- data/lib/rudy/aws/s3.rb +3 -0
- data/lib/rudy/aws/simpledb.rb +53 -0
- data/lib/rudy/command/addresses.rb +46 -0
- data/lib/rudy/command/backups.rb +175 -0
- data/lib/rudy/command/base.rb +839 -0
- data/lib/rudy/command/config.rb +77 -0
- data/lib/rudy/command/deploy.rb +12 -0
- data/lib/rudy/command/disks.rb +213 -0
- data/lib/rudy/command/environment.rb +74 -0
- data/lib/rudy/command/groups.rb +61 -0
- data/lib/rudy/command/images.rb +99 -0
- data/lib/rudy/command/instances.rb +85 -0
- data/lib/rudy/command/machines.rb +170 -0
- data/lib/rudy/command/metadata.rb +41 -0
- data/lib/rudy/command/release.rb +174 -0
- data/lib/rudy/command/volumes.rb +66 -0
- data/lib/rudy/config.rb +93 -0
- data/lib/rudy/metadata.rb +26 -0
- data/lib/rudy/metadata/backup.rb +160 -0
- data/lib/rudy/metadata/disk.rb +138 -0
- data/lib/rudy/scm/svn.rb +68 -0
- data/lib/rudy/utils.rb +64 -0
- data/lib/storable.rb +280 -0
- data/lib/tryouts.rb +40 -0
- data/rudy.gemspec +76 -0
- data/support/mailtest +40 -0
- data/support/rudy-ec2-startup +200 -0
- data/tryouts/console_tryout.rb +91 -0
- metadata +188 -0
data/CHANGES.txt
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
RUDY, CHANGES
|
2
|
+
|
3
|
+
TODO: Look into RubyGems error
|
4
|
+
/Library/Ruby/Gems/1.8/gems/rake-0.8.3/lib/rake/gempackagetask.rb:13:Warning: Gem::manage_gems is deprecated and will be removed on or after March 2009.
|
5
|
+
rake aborted!
|
6
|
+
RubyGem version error: rdoc(2.4.0 not ~> 2.3.0)
|
7
|
+
|
8
|
+
TODO: Remove aws_swb
|
9
|
+
|
10
|
+
|
11
|
+
#### 0.4.1 (2009-03-??) ###############################
|
12
|
+
|
13
|
+
* CHANGE: Recommend keypair config to be in ~/.rudy/config
|
14
|
+
* FIX: Rudy now checks for user keys specified by env-role, env, and global
|
15
|
+
* FIX: gemspec dependency net-ssh-multi
|
16
|
+
* NEW: rerelease command
|
17
|
+
|
18
|
+
#### 0.4 (2009-03-12) ###############################
|
19
|
+
|
20
|
+
NOTE: This is a significant re-write from 0.3
|
21
|
+
|
22
|
+
* CHANGE: Mostly re-written bin/ruby, moving validation to Command classes
|
23
|
+
* CHANGE: upgrade to Drydock 0.5
|
24
|
+
* CHANGE: Moved generic EC2 commands to bin/rudy-ec2
|
25
|
+
* CHANGE: Removed ambiguity of pluralized command names.
|
26
|
+
* OLD: backups, disks, configs
|
27
|
+
* NEW: backup, disk, config
|
28
|
+
* NEW: ssh and scp commands for connecting to and copying files to/from machines
|
29
|
+
* NEW: New dependencies (trying out net-ssh)
|
30
|
+
* NEW: Domain specific language for configuration
|
31
|
+
* NEW: "Routines" for handling common actions. Starting, stopping, releasing, deploying.
|
32
|
+
* NEW: "rudy release" will create a release from the current working copy, start an instance,
|
33
|
+
checkout the release, run routines. It needs some work still, but this already functions as
|
34
|
+
a single command release process.
|
35
|
+
* NEW: "rudy start|destroy|restart|update|status". Routines allow us to have generic commands
|
36
|
+
that can be used for any machine group. These commands relate to starting new instances.
|
37
|
+
* NEW: Extra caution when running destructive commands
|
38
|
+
* NEW: Default ~/.rudy/config created if it doesn't exist.
|
39
|
+
|
40
|
+
|
41
|
+
#### 0.3 (2009-02-26) ###############################
|
42
|
+
|
43
|
+
NOTE: This is a significant re-write from 0.2
|
44
|
+
|
45
|
+
* CHANGE: Re-written support/rudy-ec2-startup
|
46
|
+
* CHANGE: upgrade to Drydock 0.4
|
47
|
+
* NEW: More functionality for disks and backups
|
48
|
+
* NEW: config commands
|
49
|
+
* NEW: Per machine configuration (via ~/.rudy)
|
50
|
+
|
51
|
+
|
52
|
+
#### 0.2 (2009-02-23) ###############################
|
53
|
+
|
54
|
+
NOTE: This is a complete re-write from 0.1
|
55
|
+
|
56
|
+
* CHANGE: Added Environment variables
|
57
|
+
* CHANGE: upgrade to drydock 0.3.3
|
58
|
+
* NEW: All time references are converted to UTC
|
59
|
+
* NEW: Safer "Are you sure?". Number of characters to enter is
|
60
|
+
commiserate with amount of danger.
|
61
|
+
* NEW: Commands: myaddress, addresses, images, instances,
|
62
|
+
disks, connect, copy, stage, backups, volumes
|
63
|
+
* NEW: Metadata storage to SimpleDB for disks, backups
|
64
|
+
* NEW: Creates EBS volumes based on startup from metadata
|
65
|
+
* NEW: Automated release process
|
66
|
+
* NEW: Automated creation of machine images
|
67
|
+
* NEW: Partial support for regions and zones
|
68
|
+
* NEW: Manage system based on security groups.
|
69
|
+
* NEW: "rudy groups" overhaul. Display, creates, destroys groups.
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
#### 0.1 (2009-02-06) ###############################
|
74
|
+
|
75
|
+
* Initial public release
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2009 Solutious Inc.
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
= Rudy - v0.4 ALPHA!
|
2
|
+
|
3
|
+
Rudy is a handy staging and deployment tool for EC2.
|
4
|
+
|
5
|
+
NOTE: Rudy will be ready for general consumption in Q2 2009.
|
6
|
+
|
7
|
+
== Installation
|
8
|
+
|
9
|
+
* Soon!
|
10
|
+
* ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION' (See net/ssh docs)
|
11
|
+
|
12
|
+
== More Info
|
13
|
+
|
14
|
+
* GitHub[http://github.com/solutious/rudy]
|
15
|
+
* RubyForge[http://rubyforge.org/projects/rudy]
|
16
|
+
* Inspiration[http://www.youtube.com/watch?v=CgaiIW5Rzes]
|
17
|
+
|
18
|
+
|
19
|
+
== Credits
|
20
|
+
|
21
|
+
* Delano Mandelbaum (delano@solutious.com)
|
22
|
+
* Keshia Knight Pulliam (rudy@solutious.com)
|
23
|
+
|
24
|
+
|
25
|
+
== Thanks
|
26
|
+
|
27
|
+
* The Rilli.com team -- for the initial use case, the ongoing feedback and support, and the good times!
|
28
|
+
* Adam Bognar
|
29
|
+
* Andrew Simpson
|
30
|
+
* Caleb Buxton
|
31
|
+
* Colin Brumelle
|
32
|
+
|
33
|
+
|
34
|
+
== License
|
35
|
+
|
36
|
+
See: LICENSE.txt
|
data/Rakefile
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake/clean'
|
3
|
+
require 'rake/gempackagetask'
|
4
|
+
require 'hanna/rdoctask'
|
5
|
+
require 'fileutils'
|
6
|
+
include FileUtils
|
7
|
+
|
8
|
+
task :default => :package
|
9
|
+
|
10
|
+
# SPECS ===============================================================
|
11
|
+
|
12
|
+
# None-yet!
|
13
|
+
|
14
|
+
# PACKAGE =============================================================
|
15
|
+
|
16
|
+
name = "rudy"
|
17
|
+
load "#{name}.gemspec"
|
18
|
+
|
19
|
+
version = @spec.version
|
20
|
+
|
21
|
+
Rake::GemPackageTask.new(@spec) do |p|
|
22
|
+
p.need_tar = true if RUBY_PLATFORM !~ /mswin/
|
23
|
+
end
|
24
|
+
|
25
|
+
task :release => [ :rdoc, :package ]
|
26
|
+
|
27
|
+
task :install => [ :rdoc, :package ] do
|
28
|
+
sh %{sudo gem install pkg/#{name}-#{version}.gem}
|
29
|
+
end
|
30
|
+
|
31
|
+
task :uninstall => [ :clean ] do
|
32
|
+
sh %{sudo gem uninstall #{name}}
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
# Rubyforge Release / Publish Tasks ==================================
|
37
|
+
|
38
|
+
desc 'Publish website to rubyforge'
|
39
|
+
task 'publish:rdoc' => 'doc/index.html' do
|
40
|
+
sh "scp -rp doc/* rubyforge.org:/var/www/gforge-projects/#{name}/"
|
41
|
+
end
|
42
|
+
|
43
|
+
desc 'Public release to rubyforge'
|
44
|
+
task 'publish:gem' => [:package] do |t|
|
45
|
+
sh <<-end
|
46
|
+
rubyforge add_release -o Any -a CHANGES.txt -f -n README.rdoc #{name} #{name} #{@spec.version} pkg/#{name}-#{@spec.version}.gem &&
|
47
|
+
rubyforge add_file -o Any -a CHANGES.txt -f -n README.rdoc #{name} #{name} #{@spec.version} pkg/#{name}-#{@spec.version}.tgz
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
Rake::RDocTask.new do |t|
|
53
|
+
t.rdoc_dir = 'doc'
|
54
|
+
t.title = @spec.summary
|
55
|
+
t.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object'
|
56
|
+
t.options << '--charset' << 'utf-8'
|
57
|
+
t.rdoc_files.include('LICENSE.txt')
|
58
|
+
t.rdoc_files.include('README.rdoc')
|
59
|
+
t.rdoc_files.include('CHANGES.txt')
|
60
|
+
t.rdoc_files.include('bin/*')
|
61
|
+
t.rdoc_files.include('lib/*.rb')
|
62
|
+
t.rdoc_files.include('lib/**/*.rb')
|
63
|
+
end
|
64
|
+
|
65
|
+
CLEAN.include [ 'pkg', '*.gem', '.config', 'doc' ]
|
66
|
+
|
67
|
+
|
68
|
+
|
data/bin/rudy
ADDED
@@ -0,0 +1,175 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
# Rudy -- Your friend in staging and deploying to EC2
|
4
|
+
#
|
5
|
+
# See rudy -h for usage
|
6
|
+
#
|
7
|
+
|
8
|
+
RUDY_HOME = File.join(File.dirname(__FILE__), '..')
|
9
|
+
RUDY_LIB = File.join(RUDY_HOME, 'lib')
|
10
|
+
$:.unshift RUDY_LIB # Put our local lib in first place
|
11
|
+
|
12
|
+
require 'rubygems' if RUBY_VERSION < "1.9"
|
13
|
+
require 'date'
|
14
|
+
require 'drydock'
|
15
|
+
extend Drydock
|
16
|
+
|
17
|
+
project "Rudy" # This also runs require 'ruby'
|
18
|
+
|
19
|
+
global :A, :accesskey, String, "AWS Access Key"
|
20
|
+
global :S, :secretkey, String, "AWS Secret Access Key"
|
21
|
+
#global :R, :region, String, "Connect to a specific EC2 region (ie: #{Rudy::DEFAULT_REGION})"
|
22
|
+
global :f, :config, String, "Specify another configuration file to read (ie: #{Rudy::RUDY_CONFIG_FILE})"
|
23
|
+
global :z, :zone, String, "Connect to a specific EC2 zone (ie: #{Rudy::DEFAULT_ZONE})"
|
24
|
+
global :e, :environment, String, "Connect to the specified environment (ie: #{Rudy::DEFAULT_ENVIRONMENT})"
|
25
|
+
global :r, :role, String, "Connect to a machine with the specified role (ie: #{Rudy::DEFAULT_ROLE})"
|
26
|
+
global :p, :position, String, "Position in the machine in its group (ie: #{Rudy::DEFAULT_POSITION})"
|
27
|
+
global :u, :user, String, "Provide a username (ie: #{Rudy::DEFAULT_USER})"
|
28
|
+
global :q, :quiet, "Run with less output"
|
29
|
+
global :v, :verbose, "Increase verbosity of output (i.e. -v or -vv or -vvv)" do
|
30
|
+
@verbose ||= 0
|
31
|
+
@verbose += 1
|
32
|
+
end
|
33
|
+
global :V, :version, "Display version number" do
|
34
|
+
puts "Rudy version: #{Rudy::VERSION}"
|
35
|
+
exit 0
|
36
|
+
end
|
37
|
+
|
38
|
+
#desc "Run this the first time you use Rudy (it's immutable so running it again does no harm)."
|
39
|
+
#command :setup => Rudy::Command::Metadata
|
40
|
+
|
41
|
+
|
42
|
+
# ------------------------------------ RUDY INFO COMMANDS --------
|
43
|
+
# ------------------------------------------------------------------
|
44
|
+
|
45
|
+
#usage "rudy info"
|
46
|
+
#desc "Displays info about the current Rudy configuration"
|
47
|
+
#command :info => Rudy::Command::Metadata
|
48
|
+
|
49
|
+
usage "rudy [-f config-file] config [param-name]"
|
50
|
+
desc "Check Rudy configuration."
|
51
|
+
option :l, :all, "Display config settings for all machines"
|
52
|
+
option :d, :defaults, "Display the default value for the supplied parameter"
|
53
|
+
argv :name
|
54
|
+
command :config => Rudy::Command::Config
|
55
|
+
|
56
|
+
usage "rudy myaddress [-i] [-e]"
|
57
|
+
desc "Displays you current internal and external IP addresses"
|
58
|
+
option :e, :external, "Display only external IP address"
|
59
|
+
option :i, :internal, "Display only internal IP address"
|
60
|
+
command :myaddress do |obj|
|
61
|
+
ea = Rudy::Utils::external_ip_address || ''
|
62
|
+
ia = Rudy::Utils::internal_ip_address || ''
|
63
|
+
if obj.global.quiet
|
64
|
+
puts ia unless obj.option.external && !obj.option.internal
|
65
|
+
puts ea unless obj.option.internal && !obj.option.external
|
66
|
+
else
|
67
|
+
puts "%10s: %s" % ['Internal', ia] unless obj.option.external && !obj.option.internal
|
68
|
+
puts "%10s: %s" % ['External', ea] unless obj.option.internal && !obj.option.external
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
# ----------------------------- RUDY MAINTENANCE COMMANDS --------
|
75
|
+
# ------------------------------------------------------------------
|
76
|
+
|
77
|
+
usage "#{$/} [global options] disks [-C -p path -d device -s size] [-A] [-D] [disk name]"
|
78
|
+
desc "Manage Disks"
|
79
|
+
option :l, :all, "Display all disk definitions"
|
80
|
+
option :p, :path, String, "The filesystem path to use as the mount point"
|
81
|
+
option :d, :device, String, "The device id (default: /dev/sdh)"
|
82
|
+
option :s, :size, Integer, "The size of disk (in GB)"
|
83
|
+
action :C, :create, "Create a disk definition"
|
84
|
+
action :D, :destroy, "Destroy a disk definition"
|
85
|
+
action :A, :attach, "Attach a disk"
|
86
|
+
action :N, :unattach, "Unattach a disk"
|
87
|
+
argv :diskname
|
88
|
+
command :disk => Rudy::Command::Disks
|
89
|
+
|
90
|
+
|
91
|
+
usage "rudy [global options] backups [-C] [disk name]"
|
92
|
+
desc "Manage Backups"
|
93
|
+
option :s, :snapshot, String, "Create a backup entry from an existing snapshot"
|
94
|
+
action :Z, :sync, "Check for and delete backup metadata with no snapshot. DOES NOT delete snapshots."
|
95
|
+
#action :T, :tidy, "Tidy existing backups"
|
96
|
+
action :D, :destroy, "Destroy a backup and DELETE its snapshots."
|
97
|
+
action :C, :create, "Create a backup"
|
98
|
+
argv :disk
|
99
|
+
command :'backup' => Rudy::Command::Backups
|
100
|
+
command_alias :backup, :bu
|
101
|
+
|
102
|
+
|
103
|
+
usage "rudy [global options] metadata instance-ID"
|
104
|
+
desc "Display Rudy metadata."
|
105
|
+
command :metadata => Rudy::Command::Metadata
|
106
|
+
command_alias :metadata, :md
|
107
|
+
|
108
|
+
|
109
|
+
desc "Machine Group Status"
|
110
|
+
command :status => Rudy::Command::Machines
|
111
|
+
|
112
|
+
|
113
|
+
desc "Update a Machine Group with the current version of Rudy"
|
114
|
+
command :update => Rudy::Command::Machines
|
115
|
+
|
116
|
+
|
117
|
+
usage "rudy [-e env] [-u user] connect [-p] [cmd]"
|
118
|
+
desc "Open an SSH connection"
|
119
|
+
option :p, :print, "Only print the SSH command, don't connect"
|
120
|
+
argv :cmd
|
121
|
+
command :connect => Rudy::Command::Environment
|
122
|
+
command_alias :connect, :ssh
|
123
|
+
|
124
|
+
usage "rudy [-e env] [-u user] copy [-p] -r [from path] [to path]"
|
125
|
+
desc "Copy files to or from machines. NOTE: You must use quotes when using a tilda for your remote dir ('~/')."
|
126
|
+
option :r, :remote, "Copy FROM the remote machine to the local machine"
|
127
|
+
option :p, :print, "Only print the SSH command, don't connect"
|
128
|
+
argv :from, :to
|
129
|
+
command :copy => Rudy::Command::Environment
|
130
|
+
command_alias :copy, :scp
|
131
|
+
command_alias :copy, :upload
|
132
|
+
command_alias :copy, :download
|
133
|
+
|
134
|
+
|
135
|
+
# -------------------------------- RUDY ROUTINES COMMANDS --------
|
136
|
+
# ------------------------------------------------------------------
|
137
|
+
|
138
|
+
desc "Shutdown a Machine Group"
|
139
|
+
command :shutdown => Rudy::Command::Machines
|
140
|
+
|
141
|
+
desc "Start a Machine Group"
|
142
|
+
option :i, :image, String, "EC2 image ID (AMI)"
|
143
|
+
command :startup => Rudy::Command::Machines
|
144
|
+
command_alias :startup, :start
|
145
|
+
|
146
|
+
desc "Restart a Machine Group"
|
147
|
+
command :restart => Rudy::Command::Machines
|
148
|
+
|
149
|
+
desc "Release to a machine group"
|
150
|
+
option :s, :switch, "Switch to the release branch/tag"
|
151
|
+
option :m, :msg, String, "A short release note"
|
152
|
+
command :release => Rudy::Command::Release
|
153
|
+
|
154
|
+
desc "Update the release currently running in a machine group"
|
155
|
+
command :rerelease => Rudy::Command::Release
|
156
|
+
command_alias :rerelease, :rere
|
157
|
+
|
158
|
+
#desc "Deploy disk snapshots from one machine to another"
|
159
|
+
#command :deploy => Rudy::Command::Deploy
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
# ------------------------------------------- UGLY STUFFS --------
|
165
|
+
# ------------------------------------------------------------------
|
166
|
+
debug :on
|
167
|
+
capture :stderr
|
168
|
+
before do
|
169
|
+
@start = Time.now
|
170
|
+
end
|
171
|
+
after do
|
172
|
+
@elapsed = Time.now - @start
|
173
|
+
puts $/, "Elapsed: %.2f seconds" % @elapsed.to_f if @elapsed > 0.1
|
174
|
+
end
|
175
|
+
|
data/bin/rudy-ec2
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
# Rudy -- Your friend in staging and deploying to EC2
|
4
|
+
#
|
5
|
+
# See rudy -h for usage
|
6
|
+
#
|
7
|
+
|
8
|
+
#
|
9
|
+
# No Ruby 1.9.1 support. Only 1.8.x for now :[
|
10
|
+
unless RUBY_VERSION < "1.9"
|
11
|
+
puts "Sorry! We're using the right_aws gem and it doesn't support Ruby 1.9 (md5 error)."
|
12
|
+
exit 1
|
13
|
+
else
|
14
|
+
require 'rubygems'
|
15
|
+
end
|
16
|
+
|
17
|
+
RUDY_HOME = File.join(File.dirname(__FILE__), '..')
|
18
|
+
RUDY_LIB = File.join(RUDY_HOME, 'lib')
|
19
|
+
$:.unshift RUDY_LIB # Put our local lib in first place
|
20
|
+
|
21
|
+
require 'drydock'
|
22
|
+
extend Drydock
|
23
|
+
|
24
|
+
project "Rudy" # This also runs require 'ruby'
|
25
|
+
|
26
|
+
debug :on
|
27
|
+
|
28
|
+
capture :stderr
|
29
|
+
|
30
|
+
global :A, :accesskey, String, "AWS Access Key"
|
31
|
+
global :S, :secretkey, String, "AWS Secret Access Key"
|
32
|
+
global :R, :region, String, "Connect to a specific EC2 region (default: #{Rudy::DEFAULT_REGION})"
|
33
|
+
global :z, :zone, String, "Connect to a specific EC2 zone (default: #{Rudy::DEFAULT_ZONE})"
|
34
|
+
global :q, :quiet, "Run with less output"
|
35
|
+
global :v, :verbose, "Increase verbosity of output (i.e. -v or -vv or -vvv)" do
|
36
|
+
@verbose ||= 0
|
37
|
+
@verbose += 1
|
38
|
+
end
|
39
|
+
global :V, :version, "Display version number" do
|
40
|
+
puts "Rudy version: #{Rudy::VERSION}"
|
41
|
+
exit 0
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
# ----------------------------------- AMAZON EC2 COMMANDS --------
|
49
|
+
# ------------------------------------------------------------------
|
50
|
+
|
51
|
+
usage "rudy [global options] addresses [-A address instance ID]"
|
52
|
+
desc "Manage Amazon Elastic IP addresses"
|
53
|
+
argv :address, :instanceid
|
54
|
+
action :A, :associate, "Associate an address to a running instance"
|
55
|
+
command :addresses => Rudy::Command::Addresses
|
56
|
+
command_alias :addresses, :address
|
57
|
+
|
58
|
+
|
59
|
+
usage "rudy images [-C -i name [-b bucket -a account]] [-D AMI-ID]"
|
60
|
+
desc "Manage EC2 Machine Images (AMIs)"
|
61
|
+
option :a, :account, String, "Your Amazon Account Number"
|
62
|
+
option :i, :image_name, String, "The name of the image"
|
63
|
+
option :p, :print, "Print-only (don't execute commands)"
|
64
|
+
option :b, :bucket_name, String, "The name of the bucket that will store the image"
|
65
|
+
action :C, :create, "Create an image"
|
66
|
+
#action :P, :prepare, "Prepare a running instance to be used as an image"
|
67
|
+
action :D, :destroy, "Deregister an image (currently _does not_ remove images files from S3)"
|
68
|
+
argv :ami
|
69
|
+
command :images => Rudy::Command::Images
|
70
|
+
command_alias :images, :image
|
71
|
+
|
72
|
+
|
73
|
+
desc "Manage EC2 Volumes"
|
74
|
+
action :D, :destroy, "Destroy a volume"
|
75
|
+
argv :vol
|
76
|
+
command :volumes => Rudy::Command::Volumes
|
77
|
+
command_alias :volumes, :volume
|
78
|
+
|
79
|
+
|
80
|
+
usage "rudy [global options] instances [-D] [-S -i image ID] [instance ID OR group name]"
|
81
|
+
desc "Manage EC2 Instances"
|
82
|
+
option :all, "Display all instances"
|
83
|
+
option :a, :address, String, "Amazon elastic IP"
|
84
|
+
option :i, :image, String, "Amazon machine image ID (ami)"
|
85
|
+
#option :v, :volume, String, "Amazon volume ID"
|
86
|
+
action :D, :destroy, "Destroy the given instance IDs. All data will be lost!"
|
87
|
+
#action :S, :start, "Start an instance"
|
88
|
+
#action :R, :restart, "Restart an instance"
|
89
|
+
argv :filter
|
90
|
+
command :instances => Rudy::Command::Instances
|
91
|
+
command_alias :instances, :instance
|
92
|
+
|
93
|
+
|
94
|
+
usage "rudy [global options] groups [-C] [-a IP addresses] [-p ports] [group name]"
|
95
|
+
desc "Manage EC2 Security Groups"
|
96
|
+
option :all, "Display all security groups"
|
97
|
+
option :r, :protocols, Array, "Comma-separated list of protocols. One of: tcp (default), udp, icmp"
|
98
|
+
option :p, :ports, Array, "List of comma-separated ports to authorize (default: 22,80,443)"
|
99
|
+
option :a, :addresses, Array, "List of comma-separated IP addresses to authorize (default: your external IP)"
|
100
|
+
action :C, :create, "Create a security group"
|
101
|
+
action :D, :destroy, "Destroy a security group"
|
102
|
+
action :M, :modify, "Modify a security group"
|
103
|
+
argv :group
|
104
|
+
command :groups => Rudy::Command::Groups
|
105
|
+
command_alias :groups, :group
|
106
|
+
|
107
|
+
|
108
|
+
|