mondupe 0.0.18 → 0.0.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/mondupe +12 -12
- data/lib/mondupe.rb +2 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a79d6631458afdf13ec9d697b34bc29c5d22667
|
4
|
+
data.tar.gz: 92374bfcbcceba911d3cbbfa4eeae0decf536691
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c5cd79ec61992e07cf46098bfc1051e36d9dcf7449729a693e28cbe23b06a21660e011ab769cd23016a4af74b93a2c97f21b8cac176df0d8919a9a9326fa1fe
|
7
|
+
data.tar.gz: 893025cabc05f8eba9c676cd16454b7a818d50d48a88787dd628c26158f83586bb96f75d461edf9bde53b4cd288deae13fb062d56831cfbb5bca311791466acf
|
data/bin/mondupe
CHANGED
@@ -13,21 +13,21 @@ opt_parser = OptionParser.new do |opt|
|
|
13
13
|
opt.separator "Commands Description"
|
14
14
|
opt.separator " create - create new mongo host."
|
15
15
|
opt.separator " Requires -n [name]"
|
16
|
-
opt.separator " Optional -i [image] -e [expire_days] -o [owner] -t [type] -a [
|
16
|
+
opt.separator " Optional -i [image] -e [expire_days] -o [owner] -t [type] -a [host_address] -s [size]"
|
17
17
|
opt.separator " delete - delete existing mongo host."
|
18
18
|
opt.separator " Requires -n [name] || -d [id]"
|
19
19
|
opt.separator " bootstrap - push chef-client and configuration to the node."
|
20
|
-
opt.separator " Requires -n [name] -a [
|
20
|
+
opt.separator " Requires -n [name] -a [host_address]"
|
21
21
|
opt.separator " dumps3 - retrieve the database dump from s3."
|
22
|
-
opt.separator " Requires -n [name] -a [
|
22
|
+
opt.separator " Requires -n [name] -a [host_address]"
|
23
23
|
opt.separator " restore - Restore a mongo dump that exists on a host"
|
24
|
-
opt.separator " Requires -n [name] -a [
|
24
|
+
opt.separator " Requires -n [name] -a [host_address]"
|
25
25
|
opt.separator " Optional -t [tmpdir] -u [mongo_username] -p [mongo_password] -c [mongo_authdb]"
|
26
26
|
opt.separator " execute - Execute some java script against database"
|
27
27
|
opt.separator " Requires -n [name] -a [dns_address] -x '[javascript]'"
|
28
28
|
opt.separator " Optional -r [db_name]"
|
29
29
|
opt.separator " expire - (coming soon) Reset the expiration days of a node"
|
30
|
-
opt.separator " Requires ( -n [name] || -d [id] || -a [
|
30
|
+
opt.separator " Requires ( -n [name] || -d [id] || -a [host_address] ) -e [expire_days]"
|
31
31
|
opt.separator " list - (coming soon) List all mongo hosts."
|
32
32
|
opt.separator " help - Get help."
|
33
33
|
opt.separator ""
|
@@ -57,8 +57,8 @@ opt_parser = OptionParser.new do |opt|
|
|
57
57
|
$options[:type] = type
|
58
58
|
end
|
59
59
|
|
60
|
-
opt.on("-a","--
|
61
|
-
$options[:
|
60
|
+
opt.on("-a","--address HOST_ADDRESS","IP or DNS address of node that already exists. Not to be used with creating new nodes") do |address|
|
61
|
+
$options[:host_address] = address
|
62
62
|
end
|
63
63
|
|
64
64
|
opt.on("-d","--id INSTANCE_ID","AWS ID of the instance, must exist already") do |id|
|
@@ -128,7 +128,7 @@ instance_image_id = $options[:image] || ENV['MONDUPE_INSTANCE_IMAGE_ID'] || "ami
|
|
128
128
|
instance_type = $options[:type] || "m3.xlarge"
|
129
129
|
instance_name = $options[:name] || nil
|
130
130
|
instance_owner = $options[:owner] || ENV['USER'] || 'mondupe'
|
131
|
-
|
131
|
+
instance_host_address = $options[:host_address] || nil
|
132
132
|
instance_id = $options[:id] || nil
|
133
133
|
dump_tmp_path = $options[:tmpdir] || '/tmp'
|
134
134
|
expire_days = $options[:expire_days] || 3
|
@@ -168,16 +168,16 @@ when "delete"
|
|
168
168
|
when "bootstrap"
|
169
169
|
puts "bootstrapping node"
|
170
170
|
# Find the instance and create the instance object here
|
171
|
-
Mondupe.new.bootstrap(instance_name, instance_fqdn,
|
171
|
+
Mondupe.new.bootstrap(instance_name, instance_fqdn, instance_host_address, chef_environment, chef_identity_file, chef_run_list, ssh_user, knife_exec)
|
172
172
|
when "dumps3"
|
173
173
|
puts "getting dump"
|
174
|
-
Mondupe.new.get_db_dump_from_s3(
|
174
|
+
Mondupe.new.get_db_dump_from_s3(instance_host_address, s3_bucket_name, dump_tmp_path, ssh_user, dump_file_name)
|
175
175
|
when "restore"
|
176
176
|
puts "Restoring mongo database from dump"
|
177
|
-
Mondupe.new.restore_db(
|
177
|
+
Mondupe.new.restore_db(instance_host_address, dump_tmp_path, ssh_key, ssh_user, dump_file_name, mongo_db_name, mongo_user, mongo_pass, mongo_auth_db)
|
178
178
|
when 'execute'
|
179
179
|
puts "Executing JS against database"
|
180
|
-
Mondupe.new.execute_js(
|
180
|
+
Mondupe.new.execute_js(instance_host_address, ssh_key, ssh_user, java_string, mongo_db_name, mongo_user, mongo_pass, mongo_auth_db)
|
181
181
|
when "terminate"
|
182
182
|
puts "Marking instance for termination"
|
183
183
|
Mondupe.new.terminate_instance(instance_id)
|
data/lib/mondupe.rb
CHANGED
@@ -155,7 +155,8 @@ class Mondupe
|
|
155
155
|
db_connect_string << " --authenticationDatabase \"#{mongo_auth_db}\"" if !mongo_auth_db.nil?
|
156
156
|
puts "Connect String: #{db_connect_string}"
|
157
157
|
puts "#{Time.now.to_s} - Running command on #{instance_dns} against #{mongo_db_name}"
|
158
|
-
`ssh -i #{ssh_key} #{ssh_user}@#{instance_dns} "echo '#{java_command}' | #{db_connect_string}"`
|
158
|
+
db_output = `ssh -i #{ssh_key} #{ssh_user}@#{instance_dns} "echo '#{java_command}' | #{db_connect_string}"`
|
159
|
+
puts db_output
|
159
160
|
if $?.success? then puts "#{Time.now.to_s} - Command execution complete" else abort("Error executing command") end
|
160
161
|
end
|
161
162
|
|