backuper 2.0.5 → 2.0.6
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/VERSION +1 -1
- data/lib/backuper.rb +29 -0
- metadata +5 -7
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.6
|
data/lib/backuper.rb
CHANGED
@@ -73,6 +73,35 @@ class Backuper
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
+
def perform_mongodb_backup
|
77
|
+
if mongodb_params == {}
|
78
|
+
puts "Skipping MongoDB backup as no configurtion given"
|
79
|
+
return
|
80
|
+
end
|
81
|
+
|
82
|
+
timestamp = "#{Time.now.strftime('%Y-%m-%d-%s')}"
|
83
|
+
local_current_backup_path = "#{local_backup_base_path}/mongodb/#{timestamp}"
|
84
|
+
local_latest_backup_path = Dir["#{local_backup_base_path}/mongodb/*"].sort.last
|
85
|
+
|
86
|
+
unless File.exist?("#{local_backup_base_path}/mongodb")
|
87
|
+
system "mkdir #{local_backup_base_path}/mongodb"
|
88
|
+
end
|
89
|
+
|
90
|
+
# Local backup
|
91
|
+
|
92
|
+
puts "Performing local backup of database '#{mysql_params['database']}' as user '#{mysql_params['username']}'"
|
93
|
+
system "mkdir #{local_current_backup_path}"
|
94
|
+
system "nice -n 10 mongodump #{mongodb_params['database']} --out #{local_current_backup_path}"
|
95
|
+
|
96
|
+
# Cleanup of old versions
|
97
|
+
|
98
|
+
Dir["#{local_backup_base_path}/mongodb/*"].sort.reverse.each_with_index do |backup_version, index|
|
99
|
+
if index >= max_kept_backups
|
100
|
+
system "rm -rf #{backup_version}"
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
76
105
|
def perform_remote_sync
|
77
106
|
puts "Performing remote backup sync"
|
78
107
|
system "nice -n 10 rsync -azH --delete #{local_backup_base_path} #{remote_backup_ssh_info}"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: backuper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 2.0.
|
9
|
+
- 6
|
10
|
+
version: 2.0.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "Aur\xC3\xA9lien Malisart"
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-05-31 00:00:00
|
19
|
-
default_executable:
|
18
|
+
date: 2011-05-31 00:00:00 Z
|
20
19
|
dependencies: []
|
21
20
|
|
22
21
|
description: simple server backup tool
|
@@ -34,7 +33,6 @@ files:
|
|
34
33
|
- VERSION
|
35
34
|
- backuper.gemspec
|
36
35
|
- lib/backuper.rb
|
37
|
-
has_rdoc: true
|
38
36
|
homepage: http://github.com/aurels/backuper
|
39
37
|
licenses: []
|
40
38
|
|
@@ -64,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
62
|
requirements: []
|
65
63
|
|
66
64
|
rubyforge_project:
|
67
|
-
rubygems_version: 1.5
|
65
|
+
rubygems_version: 1.8.5
|
68
66
|
signing_key:
|
69
67
|
specification_version: 3
|
70
68
|
summary: simple server backup tool
|