backupper 0.7.0 → 0.8.0
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/Gemfile.lock +1 -1
- data/README.md +2 -1
- data/lib/backupper/adapters/mydumper.rb +1 -1
- data/lib/backupper/backupper.rb +5 -3
- data/lib/backupper/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8e8f2f1eea2243c93d2422f759c84abd17ea9638a820da4482df1a49daf62219
|
|
4
|
+
data.tar.gz: cdeb04aa6d21fcfdba7a43d212b98ef40b2377763051d04159c05245390a16e7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 901632efffd97dc884cac2413776ff753eda34a099643c285d9a3f5d18afb5a71e1b00d18dde2538ee5d6534e15a00ac75f8a5e62c283b35f1e46e9d52099528
|
|
7
|
+
data.tar.gz: e7bd2227208c09b53f1330200301259f1858a0a53ac155950d5811e89a7cea7da776032d9550ed8968ff1c310fa32a495d3c22dac16fa1c0b0479f1515967195
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -38,6 +38,7 @@ db1:
|
|
|
38
38
|
db_username: db_user # database username
|
|
39
39
|
db_password: db_Pa$$w0rD # database password
|
|
40
40
|
dump_options: '--single-transaction --quick' # dump command extra options (shell-style quoted or YAML array)
|
|
41
|
+
tmp_dir: '/var/tmp' # remote directory where the dump is staged before the download (default: /tmp)
|
|
41
42
|
|
|
42
43
|
db2:
|
|
43
44
|
disabled: false
|
|
@@ -99,7 +100,7 @@ Inside `command` you never deal with shell escaping: every accessor already retu
|
|
|
99
100
|
|
|
100
101
|
`command` must return a single command string (it is run with `set -o pipefail`, so chaining with `|` and `&&` is fine) and must write the dump to `outfile`. `working_dir` is created before the command runs; both `working_dir` and `outfile` are removed from the server after the download. If two adapters register the same name, the last one loaded wins, so a custom adapter can also replace a built-in one.
|
|
101
102
|
|
|
102
|
-
⚠️ Upgrading from 0.6: custom adapters written as `DumpCommand` module methods no longer work; port each method to a `Backupper::Adapter` subclass as shown above. Also, `mydumper` archives
|
|
103
|
+
⚠️ Upgrading from 0.6: custom adapters written as `DumpCommand` module methods no longer work; port each method to a `Backupper::Adapter` subclass as shown above. Also, `mydumper` archives no longer contain a top-level `<key>__<database>/` directory: the dump files are at the root of the tar, so extract into a dedicated directory (`tar -xf backup.tar -C restore-dir`).
|
|
103
104
|
|
|
104
105
|
## Contributing
|
|
105
106
|
|
|
@@ -12,7 +12,7 @@ class Backupper
|
|
|
12
12
|
params << "--user #{username}"
|
|
13
13
|
params << "--password #{password}" if password
|
|
14
14
|
params << dump_options if dump_options
|
|
15
|
-
return "mydumper --database #{database} #{params.join(' ')} --outputdir #{working_dir} && tar -cf #{outfile} #{working_dir}"
|
|
15
|
+
return "mydumper --database #{database} #{params.join(' ')} --outputdir #{working_dir} && tar -cf #{outfile} -C #{working_dir} ."
|
|
16
16
|
end
|
|
17
17
|
end
|
|
18
18
|
end
|
data/lib/backupper/backupper.rb
CHANGED
|
@@ -60,7 +60,8 @@ class Backupper
|
|
|
60
60
|
dump_options: o['dump_options'],
|
|
61
61
|
sudo: o['sudo'],
|
|
62
62
|
outdir: o['outdir'],
|
|
63
|
-
extra_copy: o['extra_copy']
|
|
63
|
+
extra_copy: o['extra_copy'],
|
|
64
|
+
tmp_dir: o['tmp_dir']
|
|
64
65
|
)
|
|
65
66
|
rescue SSHKit::Runner::ExecuteError, ArgumentError, NotImplementedError => e
|
|
66
67
|
error(k, e.to_s)
|
|
@@ -72,14 +73,15 @@ class Backupper
|
|
|
72
73
|
|
|
73
74
|
private
|
|
74
75
|
|
|
75
|
-
def do_and_download_dump(key:, adapter: 'mysql', url:, password: nil, database:, db_username: 'root', db_password: nil, dump_options: nil, sudo: false, outdir:, extra_copy: nil)
|
|
76
|
+
def do_and_download_dump(key:, adapter: 'mysql', url:, password: nil, database:, db_username: 'root', db_password: nil, dump_options: nil, sudo: false, outdir:, extra_copy: nil, tmp_dir: nil)
|
|
76
77
|
t = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
77
78
|
adapter = Adapter.find(adapter).new(
|
|
78
79
|
database: database,
|
|
79
80
|
username: db_username,
|
|
80
81
|
password: db_password,
|
|
81
82
|
dump_options: dump_options,
|
|
82
|
-
basename: "#{key}__#{database}"
|
|
83
|
+
basename: "#{key}__#{database}",
|
|
84
|
+
tmp_dir: tmp_dir || '/tmp'
|
|
83
85
|
)
|
|
84
86
|
dump_name = "#{Time.now.strftime('%Y-%m-%d_%H-%M-%S')}__#{adapter.filename}"
|
|
85
87
|
path = File.join(outdir, dump_name)
|
data/lib/backupper/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: backupper
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- pioz
|
|
@@ -110,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
110
110
|
- !ruby/object:Gem::Version
|
|
111
111
|
version: '0'
|
|
112
112
|
requirements: []
|
|
113
|
-
rubygems_version: 4.0.
|
|
113
|
+
rubygems_version: 4.0.20
|
|
114
114
|
specification_version: 4
|
|
115
115
|
summary: Tool to backup databases
|
|
116
116
|
test_files: []
|