mondupe 0.0.4 → 0.0.5
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.
- checksums.yaml +4 -4
- data/lib/mondupe.rb +8 -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: 37a24f55245052e8247a19ac6136ae03ba45a639
|
4
|
+
data.tar.gz: cc08d1377481e511feaa1978361e4bf86b931035
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1eb9ab405138d2bfe5493f4eef966685a3fdb42f4e09e5a56f3e1a9044bda1a43bc51c346745ae8207bb920c7d97ecf427595856851c273b7d65f88ee225ae62
|
7
|
+
data.tar.gz: a6d365ef47e7a9be6de5d8b33d66097d60eae1d0b1625a22d0dc8f5864b35056c5ce0ceba3525beb8f8b9f9fdbc922b02e91f591b2d43987e318644a2069d8b0
|
data/lib/mondupe.rb
CHANGED
@@ -115,14 +115,21 @@ class Mondupe
|
|
115
115
|
puts "#{Time.now.to_s} - Dropping existing database"
|
116
116
|
`ssh -i #{ssh_key} #{ssh_user}@#{instance_ip} "echo 'db.dropDatabase()' | mongo cde_production"`
|
117
117
|
if $?.success? then puts "#{Time.now.to_s} - Database drop complete" else die("Error dropping database") end
|
118
|
+
puts "Extracting database dump archive file..."
|
119
|
+
`ssh -i #{ssh_key} #{ssh_user}@#{instance_ip} "cd #{dump_tmp_path}; tar xf #{dump_file_name}"`
|
120
|
+
if $?.success? then puts "#{Time.now.to_s} - Extraction complete!" else die("Error extracting archive") end
|
118
121
|
puts "Restoring Mongo Database from extracted dump: #{File.join(dump_tmp_path, "cde_production")}"
|
119
|
-
`ssh -i #{ssh_key} #{ssh_user}@#{instance_ip} "
|
122
|
+
`ssh -i #{ssh_key} #{ssh_user}@#{instance_ip} "time mongorestore #{File.join(dump_tmp_path, "cde_production")}"`
|
123
|
+
if $?.success? then puts "#{Time.now.to_s} - Database restore complete!" else die("Error restoring databse") end
|
120
124
|
puts "Removing database archive file"
|
121
125
|
`ssh -i #{ssh_key} #{ssh_user}@#{instance_ip} "rm -rf #{File.join(dump_tmp_path, dump_file_name)}"`
|
126
|
+
if $?.success? then puts "#{Time.now.to_s} - Archive removed!" else die("Error removing archive") end
|
122
127
|
puts "#{Time.now.to_s} - Removing saved searches"
|
123
128
|
`ssh -i #{ssh_key} #{ssh_user}@#{instance_ip} "mongo cde_production --eval \\"db.users.update({save_searches: {$ne: null}}, {$unset: {save_searches: ''}}, {multi: true})\\""`
|
129
|
+
if $?.success? then puts "#{Time.now.to_s} - Saved searches removed" else die("Error removing saved searches") end
|
124
130
|
puts "#{Time.now.to_s} - Cleaning up our mess..."
|
125
131
|
`ssh -i #{ssh_key} #{ssh_user}@#{instance_ip} "rm -rf #{File.join(dump_tmp_path, 'cde_production')}"`
|
132
|
+
if $?.success? then puts "#{Time.now.to_s} - Mess cleaned up!" else die("Error cleaning up after myself...") end
|
126
133
|
end
|
127
134
|
|
128
135
|
def terminate(instance_id)
|