webtranslateit-safe 0.4.10 → 0.4.11
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/CHANGELOG +5 -0
- data/README.markdown +1 -10
- data/lib/web_translate_it/safe/config/builder.rb +3 -5
- data/lib/web_translate_it/safe/config/node.rb +2 -2
- data/lib/web_translate_it/safe.rb +1 -3
- metadata +3 -18
- data/lib/web_translate_it/safe/cloudfiles.rb +0 -83
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9ecdf78b8c44bcbf64d9096a3dc20d434867719635c1104f14423aacd40172d6
|
|
4
|
+
data.tar.gz: ce5f71e6ddcbe3e335084ce700a2749ebf936b86b7a02786ee534ed2480b5edd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d27bffcae503f8a8725a42dec46c8b09ce313f1bd45aa0a6df25aa8e18e33816fb39b83d2215b489b3c517850e874b6393c073a0029e43d2310abf15b3e88d1c
|
|
7
|
+
data.tar.gz: 950b3366db7917bc402cc3d0986f03c012b706fe604cfd275d5e42e3241cf449b5309a83352aa6a2903f2ffca48ef5f9e4b6154fc166e49c659f6ec65a2ac87c
|
data/CHANGELOG
CHANGED
data/README.markdown
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# webtranslateit-safe
|
|
2
2
|
|
|
3
|
-
Simple database and filesystem backups with S3
|
|
3
|
+
Simple database and filesystem backups with Amazon S3 support (with optional encryption).
|
|
4
4
|
|
|
5
5
|
This is a fork of now abandonned [astrails-safe](https://github.com/astrails/safe) that we’ve been using since 2010. It is now unmaintained and not compatible with ruby 3.2, so we forked it.
|
|
6
6
|
|
|
@@ -121,14 +121,6 @@ safe do
|
|
|
121
121
|
path "servers/alpha/:kind/:id"
|
|
122
122
|
end
|
|
123
123
|
|
|
124
|
-
cloudfiles do
|
|
125
|
-
user "..........."
|
|
126
|
-
api_key "................................."
|
|
127
|
-
container "safe_backup"
|
|
128
|
-
path ":kind/" # this is default
|
|
129
|
-
service_net false
|
|
130
|
-
end
|
|
131
|
-
|
|
132
124
|
sftp do
|
|
133
125
|
host "sftp.astrails.com"
|
|
134
126
|
user "astrails"
|
|
@@ -150,7 +142,6 @@ safe do
|
|
|
150
142
|
keep do
|
|
151
143
|
local 20
|
|
152
144
|
s3 100
|
|
153
|
-
cloudfiles 100
|
|
154
145
|
sftp 100
|
|
155
146
|
end
|
|
156
147
|
|
|
@@ -72,12 +72,10 @@ module WebTranslateIt
|
|
|
72
72
|
|
|
73
73
|
end
|
|
74
74
|
|
|
75
|
-
simple_value :verbose, :dry_run, :local_only, :path, :command,
|
|
76
|
-
:
|
|
77
|
-
:api_key, :container, :socket, :service_net, :repo_path, :use_scp
|
|
75
|
+
simple_value :verbose, :dry_run, :local_only, :path, :command, :options, :user, :host, :port,
|
|
76
|
+
:password, :key, :secret, :bucket, :socket, :service_net, :repo_path, :use_scp
|
|
78
77
|
multi_value :skip_tables, :exclude, :files
|
|
79
|
-
mixed_value :s3, :local, :
|
|
80
|
-
:mongodump
|
|
78
|
+
mixed_value :s3, :local, :sftp, :mysqldump, :tar, :gpg, :keep, :pgdump, :tar, :mongodump
|
|
81
79
|
collection :database, :archive, :repo
|
|
82
80
|
|
|
83
81
|
private
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
require 'aws/s3'
|
|
2
|
-
require 'cloudfiles'
|
|
3
2
|
require 'net/sftp'
|
|
4
3
|
require 'net/scp'
|
|
5
4
|
require 'tmpdir'
|
|
@@ -31,7 +30,6 @@ require 'web_translate_it/safe/pigz'
|
|
|
31
30
|
require 'web_translate_it/safe/sink'
|
|
32
31
|
require 'web_translate_it/safe/local'
|
|
33
32
|
require 'web_translate_it/safe/s3'
|
|
34
|
-
require 'web_translate_it/safe/cloudfiles'
|
|
35
33
|
require 'web_translate_it/safe/sftp'
|
|
36
34
|
|
|
37
35
|
# Keeps mkmf from littering STDOUT
|
|
@@ -57,7 +55,7 @@ module WebTranslateIt
|
|
|
57
55
|
next unless collection = config[*path]
|
|
58
56
|
|
|
59
57
|
collection.each do |name, c|
|
|
60
|
-
klass.new(name, c).backup.run(c, :gpg, :pigz, :gzip, :local, :s3, :
|
|
58
|
+
klass.new(name, c).backup.run(c, :gpg, :pigz, :gzip, :local, :s3, :sftp)
|
|
61
59
|
end
|
|
62
60
|
end
|
|
63
61
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: webtranslateit-safe
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.11
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Edouard Briere
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2023-07-
|
|
12
|
+
date: 2023-07-27 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: aws-s3
|
|
@@ -25,20 +25,6 @@ dependencies:
|
|
|
25
25
|
- - ">="
|
|
26
26
|
- !ruby/object:Gem::Version
|
|
27
27
|
version: '0'
|
|
28
|
-
- !ruby/object:Gem::Dependency
|
|
29
|
-
name: cloudfiles
|
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
|
31
|
-
requirements:
|
|
32
|
-
- - ">="
|
|
33
|
-
- !ruby/object:Gem::Version
|
|
34
|
-
version: '0'
|
|
35
|
-
type: :runtime
|
|
36
|
-
prerelease: false
|
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
38
|
-
requirements:
|
|
39
|
-
- - ">="
|
|
40
|
-
- !ruby/object:Gem::Version
|
|
41
|
-
version: '0'
|
|
42
28
|
- !ruby/object:Gem::Dependency
|
|
43
29
|
name: net-scp
|
|
44
30
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -70,7 +56,7 @@ dependencies:
|
|
|
70
56
|
description: |
|
|
71
57
|
WebTranslateIt-Safe is a simple tool to backup databases (MySQL and PostgreSQL) and files.
|
|
72
58
|
Backups can be stored locally or remotely and can be encrypted.
|
|
73
|
-
Remote storage is supported on Amazon S3
|
|
59
|
+
Remote storage is supported on Amazon S3 or just plain SFTP/SCP.
|
|
74
60
|
email:
|
|
75
61
|
- support@webtranslateit.com
|
|
76
62
|
executables:
|
|
@@ -84,7 +70,6 @@ files:
|
|
|
84
70
|
- lib/web_translate_it/safe.rb
|
|
85
71
|
- lib/web_translate_it/safe/archive.rb
|
|
86
72
|
- lib/web_translate_it/safe/backup.rb
|
|
87
|
-
- lib/web_translate_it/safe/cloudfiles.rb
|
|
88
73
|
- lib/web_translate_it/safe/config/builder.rb
|
|
89
74
|
- lib/web_translate_it/safe/config/node.rb
|
|
90
75
|
- lib/web_translate_it/safe/gpg.rb
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
module WebTranslateIt
|
|
2
|
-
|
|
3
|
-
module Safe
|
|
4
|
-
|
|
5
|
-
class Cloudfiles < Sink
|
|
6
|
-
|
|
7
|
-
MAX_CLOUDFILES_FILE_SIZE = 5_368_709_120
|
|
8
|
-
|
|
9
|
-
def active?
|
|
10
|
-
container && user && api_key
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
protected
|
|
14
|
-
|
|
15
|
-
def path
|
|
16
|
-
@path ||= expand(config[:cloudfiles, :path] || config[:local, :path] || ':kind/:id')
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
# UGLY: we need this function for the reason that
|
|
20
|
-
# we can't double mock on ruby 1.9.2, duh!
|
|
21
|
-
# so we created this func to mock it all together
|
|
22
|
-
def get_file_size(path)
|
|
23
|
-
File.stat(path).size
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def save # rubocop:todo Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/MethodLength, Metrics/PerceivedComplexity
|
|
27
|
-
raise 'pipe-streaming not supported for S3.' unless @backup.path
|
|
28
|
-
|
|
29
|
-
# needed in cleanup even on dry run
|
|
30
|
-
cf = CloudFiles::Connection.new(user, api_key, true, service_net) unless local_only?
|
|
31
|
-
puts "Uploading #{container}:#{full_path} from #{@backup.path}" if verbose? || dry_run?
|
|
32
|
-
return if dry_run? || local_only?
|
|
33
|
-
|
|
34
|
-
if get_file_size(@backup.path) > MAX_CLOUDFILES_FILE_SIZE
|
|
35
|
-
warn "ERROR: File size exceeds maximum allowed for upload to Cloud Files (#{MAX_CLOUDFILES_FILE_SIZE}): #{@backup.path}"
|
|
36
|
-
return
|
|
37
|
-
end
|
|
38
|
-
benchmark = Benchmark.realtime do
|
|
39
|
-
cf_container = cf.create_container(container)
|
|
40
|
-
o = cf_container.create_object(full_path, true)
|
|
41
|
-
o.write(File.open(@backup.path))
|
|
42
|
-
end
|
|
43
|
-
puts '...done' if verbose?
|
|
44
|
-
puts("Upload took #{format('%.2f', benchmark)} second(s).") if verbose?
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
def cleanup # rubocop:todo Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
|
48
|
-
return if local_only?
|
|
49
|
-
|
|
50
|
-
return unless keep = config[:keep, :cloudfiles]
|
|
51
|
-
|
|
52
|
-
puts "listing files: #{container}:#{base}*" if verbose?
|
|
53
|
-
cf = CloudFiles::Connection.new(user, api_key, true, service_net) unless local_only?
|
|
54
|
-
cf_container = cf.container(container)
|
|
55
|
-
files = cf_container.objects(prefix: base).sort
|
|
56
|
-
|
|
57
|
-
cleanup_with_limit(files, keep) do |f|
|
|
58
|
-
puts "removing Cloud File #{container}:#{f}" if dry_run? || verbose?
|
|
59
|
-
cf_container.delete_object(f) unless dry_run? || local_only?
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
def container
|
|
64
|
-
config[:cloudfiles, :container]
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
def user
|
|
68
|
-
config[:cloudfiles, :user]
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
def api_key
|
|
72
|
-
config[:cloudfiles, :api_key]
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
def service_net
|
|
76
|
-
config[:cloudfiles, :service_net] || false
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
end
|