sabat-rudy 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. data/CHANGES.txt +188 -0
  2. data/LICENSE.txt +19 -0
  3. data/README.rdoc +118 -0
  4. data/Rakefile +165 -0
  5. data/Rudyfile +184 -0
  6. data/bin/ird +153 -0
  7. data/bin/rudy +232 -0
  8. data/bin/rudy-ec2 +241 -0
  9. data/bin/rudy-s3 +79 -0
  10. data/bin/rudy-sdb +69 -0
  11. data/examples/README.md +10 -0
  12. data/examples/debian-sinatra-passenger/commands.rb +19 -0
  13. data/examples/debian-sinatra-passenger/machines.rb +32 -0
  14. data/examples/debian-sinatra-passenger/routines.rb +30 -0
  15. data/examples/debian-sinatra-thin/commands.rb +17 -0
  16. data/examples/debian-sinatra-thin/machines.rb +35 -0
  17. data/examples/debian-sinatra-thin/routines.rb +72 -0
  18. data/lib/rudy.rb +170 -0
  19. data/lib/rudy/aws.rb +75 -0
  20. data/lib/rudy/aws/ec2.rb +59 -0
  21. data/lib/rudy/aws/ec2/address.rb +157 -0
  22. data/lib/rudy/aws/ec2/group.rb +301 -0
  23. data/lib/rudy/aws/ec2/image.rb +168 -0
  24. data/lib/rudy/aws/ec2/instance.rb +438 -0
  25. data/lib/rudy/aws/ec2/keypair.rb +104 -0
  26. data/lib/rudy/aws/ec2/snapshot.rb +109 -0
  27. data/lib/rudy/aws/ec2/volume.rb +230 -0
  28. data/lib/rudy/aws/ec2/zone.rb +77 -0
  29. data/lib/rudy/aws/s3.rb +60 -0
  30. data/lib/rudy/aws/sdb.rb +312 -0
  31. data/lib/rudy/aws/sdb/error.rb +47 -0
  32. data/lib/rudy/cli.rb +186 -0
  33. data/lib/rudy/cli/aws/ec2/addresses.rb +105 -0
  34. data/lib/rudy/cli/aws/ec2/candy.rb +191 -0
  35. data/lib/rudy/cli/aws/ec2/groups.rb +118 -0
  36. data/lib/rudy/cli/aws/ec2/images.rb +185 -0
  37. data/lib/rudy/cli/aws/ec2/instances.rb +222 -0
  38. data/lib/rudy/cli/aws/ec2/keypairs.rb +53 -0
  39. data/lib/rudy/cli/aws/ec2/snapshots.rb +49 -0
  40. data/lib/rudy/cli/aws/ec2/volumes.rb +104 -0
  41. data/lib/rudy/cli/aws/ec2/zones.rb +22 -0
  42. data/lib/rudy/cli/aws/s3/buckets.rb +49 -0
  43. data/lib/rudy/cli/aws/s3/store.rb +22 -0
  44. data/lib/rudy/cli/aws/sdb/domains.rb +41 -0
  45. data/lib/rudy/cli/candy.rb +19 -0
  46. data/lib/rudy/cli/config.rb +81 -0
  47. data/lib/rudy/cli/disks.rb +58 -0
  48. data/lib/rudy/cli/machines.rb +114 -0
  49. data/lib/rudy/cli/routines.rb +108 -0
  50. data/lib/rudy/config.rb +116 -0
  51. data/lib/rudy/config/objects.rb +148 -0
  52. data/lib/rudy/global.rb +130 -0
  53. data/lib/rudy/guidelines.rb +18 -0
  54. data/lib/rudy/huxtable.rb +373 -0
  55. data/lib/rudy/machines.rb +281 -0
  56. data/lib/rudy/metadata.rb +51 -0
  57. data/lib/rudy/metadata/backup.rb +113 -0
  58. data/lib/rudy/metadata/backups.rb +65 -0
  59. data/lib/rudy/metadata/disk.rb +177 -0
  60. data/lib/rudy/metadata/disks.rb +67 -0
  61. data/lib/rudy/metadata/objectbase.rb +104 -0
  62. data/lib/rudy/mixins.rb +2 -0
  63. data/lib/rudy/mixins/hash.rb +25 -0
  64. data/lib/rudy/routines.rb +318 -0
  65. data/lib/rudy/routines/helper.rb +55 -0
  66. data/lib/rudy/routines/helpers/dependshelper.rb +34 -0
  67. data/lib/rudy/routines/helpers/diskhelper.rb +331 -0
  68. data/lib/rudy/routines/helpers/scmhelper.rb +39 -0
  69. data/lib/rudy/routines/helpers/scripthelper.rb +198 -0
  70. data/lib/rudy/routines/helpers/userhelper.rb +37 -0
  71. data/lib/rudy/routines/passthrough.rb +38 -0
  72. data/lib/rudy/routines/reboot.rb +75 -0
  73. data/lib/rudy/routines/release.rb +50 -0
  74. data/lib/rudy/routines/shutdown.rb +33 -0
  75. data/lib/rudy/routines/startup.rb +36 -0
  76. data/lib/rudy/scm.rb +75 -0
  77. data/lib/rudy/scm/git.rb +217 -0
  78. data/lib/rudy/scm/svn.rb +110 -0
  79. data/lib/rudy/utils.rb +365 -0
  80. data/rudy.gemspec +151 -0
  81. data/support/mailtest +40 -0
  82. data/support/randomize-root-password +45 -0
  83. data/support/rudy-ec2-startup +200 -0
  84. data/support/update-ec2-ami-tools +20 -0
  85. data/test/01_mixins/10_hash_test.rb +25 -0
  86. data/test/10_config/00_setup_test.rb +20 -0
  87. data/test/10_config/30_machines_test.rb +69 -0
  88. data/test/15_scm/00_setup_test.rb +20 -0
  89. data/test/15_scm/20_git_test.rb +61 -0
  90. data/test/20_sdb/00_setup_test.rb +16 -0
  91. data/test/20_sdb/10_domains_test.rb +115 -0
  92. data/test/25_ec2/00_setup_test.rb +29 -0
  93. data/test/25_ec2/10_keypairs_test.rb +41 -0
  94. data/test/25_ec2/20_groups_test.rb +131 -0
  95. data/test/25_ec2/30_addresses_test.rb +38 -0
  96. data/test/25_ec2/40_volumes_test.rb +49 -0
  97. data/test/25_ec2/50_snapshots_test.rb +74 -0
  98. data/test/26_ec2_instances/00_setup_test.rb +28 -0
  99. data/test/26_ec2_instances/10_instances_test.rb +83 -0
  100. data/test/26_ec2_instances/50_images_test.rb +13 -0
  101. data/test/30_sdb_metadata/00_setup_test.rb +21 -0
  102. data/test/30_sdb_metadata/10_disks_test.rb +109 -0
  103. data/test/30_sdb_metadata/20_backups_test.rb +102 -0
  104. data/test/coverage.txt +51 -0
  105. data/test/helper.rb +36 -0
  106. metadata +276 -0
data/bin/rudy-ec2 ADDED
@@ -0,0 +1,241 @@
1
+ #!/usr/bin/ruby
2
+
3
+ # = Rudy EC2
4
+ #
5
+ # === A Rudy interface to Amazon EC2
6
+ #
7
+ #
8
+ #
9
+ # See rudy-ec2 -h for usage
10
+ #
11
+
12
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib') # Put our local lib in first place
13
+ #require 'rubygems'
14
+
15
+ require 'rudy'
16
+ require 'rudy/cli'
17
+
18
+ require 'drydock'
19
+
20
+ # Command-line interface for bin/rudy-ec2
21
+ module RudyCLI_EC2
22
+ extend Drydock
23
+
24
+ debug :off
25
+ default :instances
26
+
27
+ # ----------------------------------- AMAZON EC2 COMMANDS --------
28
+ # ------------------------------------------------------------------
29
+
30
+ about "Amazon EC2 Elastic IP addresses"
31
+ usage "rudy-ec2 addresses"
32
+ usage "rudy-ec2 addresses -C"
33
+ usage "rudy-ec2 addresses -A -i instance-id address"
34
+ usage "rudy-ec2 addresses -A -i instance-id -n"
35
+ usage "rudy-ec2 addresses -N address"
36
+ usage "rudy-ec2 addresses -D address"
37
+ option :i, :instance, String, "Instance ID"
38
+ option :n, :newaddress, "Create and assign a new elastic IP"
39
+ action :A, :associate, "Associate an IP address to a running instance"
40
+ action :N, :disassociate, "Disassociate an IP address from an instance"
41
+ action :C, :create, "Request an IP address from Amazon"
42
+ action :D, :destroy, "Return an IP address to Amazon (this is permanent!)"
43
+ argv :ipaddress
44
+ command :addresses => Rudy::CLI::AWS::EC2::Addresses
45
+ command_alias :addresses, :address
46
+ command_alias :addresses, :a
47
+
48
+ about "Amazon EC2 instance console output"
49
+ usage "rudy-ec2 console [-g group] [instance ID]"
50
+ usage "rudy-ec2 [-k path/2/privatekey] console [instance ID]"
51
+ usage "NOTE: Private key is required only for Windows instances"
52
+ option :g, :group, String, "A security group name"
53
+ argv :awsid
54
+ command :consoles => Rudy::CLI::AWS::EC2::Instances
55
+ command_alias :consoles, :console
56
+ command_alias :consoles, :c
57
+
58
+ about "Copy files to or from machines."
59
+ usage "rudy-ec2 copy [-p] [-r] source target"
60
+ usage "rudy-ec2 [-u user] [-k path/2/privatekey] upload local-source target"
61
+ usage "rudy-ec2 download remote-source target"
62
+ usage "NOTE: Use quotes when using a tilda or asterisk in remote paths ('~/')."
63
+ usage "rudy-ec2 download '~/*' /tmp/"
64
+ #option :r, :recursive, "Recursively copy entire directories"
65
+ #option :p, :preserve, "Preserve atimes and ctimes."
66
+ option :g, :group, String, "A security group name"
67
+ option :i, :awsid, String, "An instance ID"
68
+ command :copy => Rudy::CLI::AWS::EC2::Candy
69
+ command_alias :copy, :ul
70
+ command_alias :copy, :dl
71
+ command_alias :copy, :scp
72
+ command_alias :copy, :upload
73
+ command_alias :copy, :download
74
+
75
+ about "Amazon EC2 EC2 Security Groups"
76
+ usage "rudy-ec2 groups"
77
+ usage "rudy-ec2 groups -C [-p ports] [-a addresses] [-r protocols] name"
78
+ usage "rudy-ec2 groups -A [-p ports] [-a addresses] [-r protocols] name"
79
+ usage "rudy-ec2 groups -A -p 81,8000-9000 -a 127.0.0.1,127.0.0.2 name"
80
+ usage "rudy-ec2 groups -A -g default -o 123456789012 name"
81
+ usage "rudy-ec2 groups -R -g default name"
82
+ usage "rudy-ec2 groups -D name"
83
+ option :all, "Display all security groups"
84
+ option :r, :protocols, Array, "List of protocols. One of: tcp (default), udp, icmp"
85
+ option :p, :ports, Array, "List of port ranges (default: 22,80,443)"
86
+ option :a, :addresses, Array, "List of IP addresses (default: your current external IP)"
87
+ option :g, :group, String, "Other group to authorize or revoke. Use with -o!"
88
+ option :o, :owner, String, "Other group owner ID (account number). Use with -g!"
89
+ option :d, :description, String, "A group description"
90
+ action :C, :create, "Create a security group"
91
+ action :D, :destroy, "Destroy a security group"
92
+ action :A, :authorize, "Authorize a rule for a security group"
93
+ action :R, :revoke, "Revoke a rule for a security group"
94
+ argv :name
95
+ command :groups => Rudy::CLI::AWS::EC2::Groups
96
+ command_alias :groups, :group
97
+ command_alias :groups, :g
98
+
99
+ about "Amazon EC2 Machine Images (AMIs)"
100
+ usage "rudy-ec2 images"
101
+ usage "rudy-ec2 images image-id"
102
+ usage "rudy-ec2 images -o 123456789012"
103
+ usage "rudy-ec2 images -o amazon"
104
+ usage "rudy-ec2 images -o self"
105
+ usage "rudy-ec2 images -R bucket/ami-name.manifest.xml"
106
+ option :o, :owner, String, "Amazon Account Number or one of: amazon, self"
107
+ option :l, :all, "Display all registered machine images (warning: slow)"
108
+ #option :p, :private, "Private images only"
109
+ option :b, :bucket, String, "The name of the bucket that will store the image"
110
+ option :n, :name, String, "The name of the image file (to create)"
111
+ option :u, :user, String, "Username to connect as (used for creating an image)"
112
+ action :C, :create, "Create an image"
113
+ #action :P, :prepare, "Prepare a running instance to be used as an image"
114
+ action :R, :register, "Register an image"
115
+ action :D, :destroy, "Deregister an image (does not remove image files from S3)"
116
+ argv :ami
117
+ command :images => Rudy::CLI::AWS::EC2::Images
118
+ command_alias :images, :image
119
+ command_alias :images, :im
120
+
121
+ about "Amazon EC2 Instances"
122
+ usage "rudy-ec2 instances"
123
+ usage "rudy-ec2 instances [-g group-name] [instance-ID]"
124
+ usage "rudy-ec2 instances -C -m ami-235fba4a -s m1.small -k keypair-name"
125
+ usage "rudy-ec2 instances -C -a 255.255.255.255 -k keypair-name"
126
+ usage "rudy-ec2 instances -R instance-ID"
127
+ usage "rudy-ec2 instances -D instance-ID"
128
+ usage "rudy-ec2 instances -R -g group-name"
129
+ usage "rudy-ec2 instances -D -g group-name"
130
+ option :g, :group, String, "The security group name"
131
+ option :m, :ami, String, "The machine image ID (ami)"
132
+ option :s, :size, String, "The instance size (default: m1.small)"
133
+ option :k, :keypair, String, "The SSH keypair to use for launch"
134
+ option :a, :address, String, "The IP address to associate to the new instance"
135
+ option :n, :newaddress, "Create and assign a new elastic IP"
136
+ option :p, :private, "Do not give the instance a public IP address"
137
+ action :C, :create, "Create a machine instance"
138
+ action :R, :restart, "Restart a machine instance"
139
+ action :D, :destroy, "Destroy a machine instance"
140
+ argv :instid
141
+ command :instances => Rudy::CLI::AWS::EC2::Instances
142
+ command_alias :instances, :instance
143
+ command_alias :instances, :in
144
+ command_alias :instances, :i
145
+
146
+ about "Amazon EC2 KeyPairs"
147
+ usage "rudy-ec2 keypairs"
148
+ usage "rudy-ec2 keypairs -C name"
149
+ usage "rudy-ec2 keypairs -D name"
150
+ action :D, :destroy, "Unregister keypair from EC2 (this is permanent!)"
151
+ action :C, :create, "Create and register a keypair with EC2"
152
+ argv :name
153
+ command :keypairs => Rudy::CLI::AWS::EC2::KeyPairs
154
+ command_alias :keypairs, :keypair
155
+ command_alias :keypairs, :k
156
+
157
+ about "Amazon EC2 Snapshots"
158
+ usage "rudy-ec2 snapshots"
159
+ usage "rudy-ec2 snapshots -C -v volume-id"
160
+ usage "rudy-ec2 snapshots -D snapshot-id"
161
+ option :v, :volume, String, "Volume ID"
162
+ action :D, :destroy, "Destroy a snapshot (this is permanent!)"
163
+ action :C, :create, "Create a snapshot"
164
+ argv :snapid
165
+ command :snapshots => Rudy::CLI::AWS::EC2::Snapshots
166
+ command_alias :snapshots, :snapshot
167
+ command_alias :snapshots, :s
168
+
169
+ about "Open an SSH connection"
170
+ usage "rudy-ec2 ssh"
171
+ usage "rudy-ec2 -u root -k path/2/key ssh"
172
+ usage "rudy-ec2 -u root -k path/2/key ssh uname -a"
173
+ usage "rudy-ec2 ssh -g group-name"
174
+ usage "rudy-ec2 ssh -i instance-id"
175
+ option :print, "Only print the SSH command, don't connect"
176
+ option :g, :group, String, "A security group name"
177
+ option :i, :instid, String, "An instance ID"
178
+ argv :cmd
179
+ command :ssh => Rudy::CLI::AWS::EC2::Candy
180
+ command_alias :ssh, :connect
181
+
182
+ about "Amazon EC2 status"
183
+ command :status => Rudy::CLI::AWS::EC2::Candy
184
+
185
+ about "Amazon EC2 Volumes"
186
+ usage "rudy-ec2 volumes"
187
+ usage "rudy-ec2 volumes -C -s size [-d device-path]"
188
+ usage "rudy-ec2 volumes -A volume-id instance-id"
189
+ usage "rudy-ec2 volumes -N volume-id"
190
+ usage "rudy-ec2 volumes -D volume-id"
191
+ option :i, :instance, String, "Instance ID"
192
+ option :s, :size, String, "Size (in GB)"
193
+ option :t, :snapshot, String, "Snapshot ID (snap)"
194
+ option :d, :device, String, "Device path (default: /dev/sdh)"
195
+ action :D, :destroy, "Destroy a volume (this is permanent!)"
196
+ action :C, :create, "Create a volume"
197
+ action :A, :attach, "Attach a volume to a running instance"
198
+ action :N, :detach, "Detach a volume from an instance"
199
+ argv :volid
200
+ command :volumes => Rudy::CLI::AWS::EC2::Volumes
201
+ command_alias :volumes, :volume
202
+ command_alias :volumes, :v
203
+
204
+ about "Availability Zones"
205
+ usage "rudy-ec2 zones"
206
+ argv :name
207
+ command :zones => Rudy::CLI::AWS::EC2::Zones
208
+ command_alias :zones, :zone
209
+ command_alias :zones, :z
210
+
211
+
212
+
213
+ end
214
+
215
+ #puts Rudy::Utils.banner("THIS IS RUBY #{RUBY_VERSION}") if Drydock.debug?
216
+
217
+ # We call Drydock specifically otherwise it will run at_exit. Rye also
218
+ # uses at_exit for shutting down the ssh-agent. Ruby executes at_exit
219
+ # blocks in reverse order so if Drydock is required first, it's block
220
+ # will run after Rye shuts down the ssh-agent.
221
+ begin
222
+ Drydock.run!(ARGV, STDIN) if Drydock.run? && !Drydock.has_run?
223
+ rescue Drydock::ArgError, Drydock::OptError => ex
224
+ STDERR.puts ex.message
225
+ STDERR.puts ex.usage
226
+ rescue Drydock::InvalidArgument => ex
227
+ STDERR.puts ex.message
228
+ rescue Rudy::Error => ex
229
+ STDERR.puts ex.message
230
+ STDERR.puts ex.backtrace if Drydock.debug?
231
+ rescue => ex
232
+ STDERR.puts "ERROR (#{ex.class.to_s}): #{ex.message}"
233
+ STDERR.puts ex.backtrace if Drydock.debug?
234
+ rescue Interrupt
235
+ puts "#{$/}Exiting... "
236
+ exit 1
237
+ rescue SystemExit
238
+ # Don't balk
239
+ end
240
+
241
+
data/bin/rudy-s3 ADDED
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/ruby
2
+
3
+ # = Rudy S3
4
+ #
5
+ # === A Rudy interface to Amazon Simple Storage Service
6
+ #
7
+ #
8
+ #
9
+ # See rudy-s3 -h for usage
10
+ #
11
+
12
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib') # Put our local lib in first place
13
+ #require 'rubygems'
14
+
15
+ require 'rudy'
16
+ require 'rudy/cli'
17
+ require 'drydock'
18
+
19
+ # Command-line interface for bin/rudy-s3
20
+ module RudyCLI_S3
21
+ extend Drydock
22
+
23
+ # ------------------------------------ AMAZON S3 COMMANDS --------
24
+ # ------------------------------------------------------------------
25
+
26
+ about "Amazon S3 Buckets"
27
+ usage "rudy-s3 buckets"
28
+ option :l, :location, String, "Specify a bucket location. One of: us, eu"
29
+ action :C, :create, "Create a bucket"
30
+ action :D, :destroy, "Destroy a bucket"
31
+ argv :name
32
+ command :buckets => Rudy::CLI::AWS::S3::Buckets
33
+ command_alias :buckets, :b
34
+
35
+ #about "Amazon S3 Storage Interface"
36
+ #usage "rudy-s3 store file-path"
37
+ #option :b, :bucket, String, "Bucket name"
38
+ #argv :path
39
+ #command :store => Rudy::CLI::AWS::S3::Store
40
+ #command_alias :store, :s
41
+
42
+
43
+
44
+ # --------------------------------- RUDY-S3 MISCELLANEOUS --------
45
+ # ------------------------------------------------------------------
46
+
47
+ default :buckets
48
+ debug :off
49
+
50
+
51
+ end
52
+
53
+
54
+ #puts Rudy::Utils.banner("THIS IS RUBY #{RUBY_VERSION}") if Drydock.debug?
55
+
56
+ # We call Drydock specifically otherwise it will run at_exit. Rye also
57
+ # uses at_exit for shutting down the ssh-agent. Ruby executes at_exit
58
+ # blocks in reverse order so if Drydock is required first, it's block
59
+ # will run after Rye shuts down the ssh-agent.
60
+ begin
61
+ Drydock.run!(ARGV, STDIN) if Drydock.run? && !Drydock.has_run?
62
+ rescue Drydock::ArgError, Drydock::OptError => ex
63
+ STDERR.puts ex.message
64
+ STDERR.puts ex.usage
65
+ rescue Drydock::InvalidArgument => ex
66
+ STDERR.puts ex.message
67
+ rescue Rudy::Error => ex
68
+ STDERR.puts ex.message
69
+ STDERR.puts ex.backtrace if Drydock.debug?
70
+ rescue => ex
71
+ STDERR.puts "ERROR (#{ex.class.to_s}): #{ex.message}"
72
+ STDERR.puts ex.backtrace if Drydock.debug?
73
+ rescue Interrupt
74
+ puts "#{$/}Exiting... "
75
+ exit 1
76
+ rescue SystemExit
77
+ # Don't balk
78
+ end
79
+
data/bin/rudy-sdb ADDED
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/ruby
2
+
3
+ # = Rudy SDB
4
+ #
5
+ # === A Rudy interface to Amazon Simple Storage Service
6
+ #
7
+ #
8
+ #
9
+ # See rudy-sdb -h for usage
10
+ #
11
+
12
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib') # Put our local lib in first place
13
+ #require 'rubygems'
14
+
15
+ require 'rudy'
16
+ require 'rudy/cli'
17
+ require 'drydock'
18
+
19
+ # Command-line interface for bin/rudy-sdb
20
+ module RudyCLI_SDB
21
+ extend Drydock
22
+
23
+ # ----------------------------------- AMAZON SDB COMMANDS --------
24
+ # ------------------------------------------------------------------
25
+
26
+
27
+ about "Displays the SimpleDB domains associated to your account"
28
+ action :C, :create, "Create a domain"
29
+ action :D, :destroy, "Destroy a domain"
30
+ argv :name
31
+ command :domains => Rudy::CLI::AWS::SDB::Domains
32
+
33
+
34
+ # -------------------------------- RUDY-SDB MISCELLANEOUS --------
35
+ # ------------------------------------------------------------------
36
+
37
+ default :domains
38
+ debug :off
39
+
40
+
41
+ end
42
+
43
+
44
+ #puts Rudy::Utils.banner("THIS IS RUBY #{RUBY_VERSION}") if Drydock.debug?
45
+
46
+ # We call Drydock specifically otherwise it will run at_exit. Rye also
47
+ # uses at_exit for shutting down the ssh-agent. Ruby executes at_exit
48
+ # blocks in reverse order so if Drydock is required first, it's block
49
+ # will run after Rye shuts down the ssh-agent.
50
+ begin
51
+ Drydock.run!(ARGV, STDIN) if Drydock.run? && !Drydock.has_run?
52
+ rescue Drydock::ArgError, Drydock::OptError => ex
53
+ STDERR.puts ex.message
54
+ STDERR.puts ex.usage
55
+ rescue Drydock::InvalidArgument => ex
56
+ STDERR.puts ex.message
57
+ rescue Rudy::Error => ex
58
+ STDERR.puts ex.message
59
+ STDERR.puts ex.backtrace if Drydock.debug?
60
+ rescue => ex
61
+ STDERR.puts "ERROR (#{ex.class.to_s}): #{ex.message}"
62
+ STDERR.puts ex.backtrace if Drydock.debug?
63
+ rescue Interrupt
64
+ puts "#{$/}Exiting... "
65
+ exit 1
66
+ rescue SystemExit
67
+ # Don't balk
68
+ end
69
+
@@ -0,0 +1,10 @@
1
+ # Rudy Configuration Examples
2
+
3
+ *NOTE: The examples are a work in progress*
4
+
5
+ ## Contributions
6
+
7
+ I'm very open to contributions! Rudy supports all Linux-based platforms (with partial Solaris support) and software (rails, sinatra, MySQL, PostgreSQL, etc...) so it's possible to write examples for pretty much anything. If you're interested in writing new examples, I'll gladly accept them and include them here (with credit of course!).
8
+
9
+
10
+
@@ -0,0 +1,19 @@
1
+ # ----------------------------------------------------------- COMMANDS --------
2
+ # The commands block defines shell commands that can be used in routines. The
3
+ # ones defined here are added to the default list defined by Rye::Cmd (Rudy
4
+ # executes all SSH commands via Rye).
5
+ #
6
+ # Usage:
7
+ #
8
+ # allow COMMAND-NAME
9
+ # allow COMMAND-NAME, '/path/2/COMMAND'
10
+ # allow COMMAND-NAME, '/path/2/COMMAND', 'default argument', 'another arg'
11
+ #
12
+ commands do
13
+ allow :apt_get, "apt-get", :y, :q
14
+ allow :gem_install, "/usr/bin/gem", "install", :n, '/usr/bin', :y, :V, "--no-rdoc", "--no-ri"
15
+ allow :gem_sources, "/usr/bin/gem", "sources"
16
+ allow :passenger_install_apache2, "passenger-install-apache2-module", '--auto'
17
+ allow :passenger_install_nginx, "passenger-install-nginx-module", '--auto', '--autodownload'
18
+ allow :apache2ctl
19
+ end
@@ -0,0 +1,32 @@
1
+
2
+ # --------------------------------------------------------- MACHINES --------
3
+ # The machines block describes the "physical" characteristics
4
+ # of your environments.
5
+ machines do
6
+
7
+ # We've defined an environment called "stage" with one role: "app".
8
+ # The configuration inside the env block is available to all its
9
+ # roles. The configuration inside the role blocks is available only
10
+ # to machines in that specific role.
11
+ env :dev, :stage, :prod do
12
+ ami "ami-e348af8a" # Debian 5.0 32-bit, Alestic
13
+ size 'm1.small'
14
+
15
+ role :app do
16
+ # You can define disks for the stage-app machines. Rudy uses
17
+ # this configuration when it executes a routine (see below).
18
+ disks do
19
+ path "/rudy/disk1" do
20
+ size 10
21
+ device "/dev/sdr"
22
+ fstype 'ext3'
23
+ end
24
+ end
25
+
26
+ end
27
+
28
+ end
29
+
30
+ end
31
+
32
+