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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6bcd9c73d5e46de14f981d0fc742f5142c9f66d5c4553ebe19face5c98d95626
4
- data.tar.gz: '0708bc10f83d92061a9c16febaf56319b5bba9eed397529f7ce0bc00ec1e7bcc'
3
+ metadata.gz: 8e8f2f1eea2243c93d2422f759c84abd17ea9638a820da4482df1a49daf62219
4
+ data.tar.gz: cdeb04aa6d21fcfdba7a43d212b98ef40b2377763051d04159c05245390a16e7
5
5
  SHA512:
6
- metadata.gz: 77c91c30b33c1ea38a07537027e021f6be9ecd91878858701caaf452321d1a8244551360327f6e80d412996833cf69402021eb5d07b693fb6af4f1ed3491b79f
7
- data.tar.gz: c56d8476dd7b7eea3f4fcc307a1311020630b132a564159759d763d0ea8b3ac180c2582c9c7f808a424ff6e32c57436974fa79eca1d2e8a4588adb24eca0d516
6
+ metadata.gz: 901632efffd97dc884cac2413776ff753eda34a099643c285d9a3f5d18afb5a71e1b00d18dde2538ee5d6534e15a00ac75f8a5e62c283b35f1e46e9d52099528
7
+ data.tar.gz: e7bd2227208c09b53f1330200301259f1858a0a53ac155950d5811e89a7cea7da776032d9550ed8968ff1c310fa32a495d3c22dac16fa1c0b0479f1515967195
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- backupper (0.7.0)
4
+ backupper (0.7.1)
5
5
  mail (~> 2.9)
6
6
  sshkit (~> 1.25)
7
7
 
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 now store the dump under its full remote path (`tmp/<key>__<database>/...`) instead of a top-level `<key>__<database>/` directory.
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
@@ -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)
@@ -1,3 +1,3 @@
1
1
  class Backupper
2
- VERSION = '0.7.0'.freeze
2
+ VERSION = '0.8.0'.freeze
3
3
  end
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.7.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.15
113
+ rubygems_version: 4.0.20
114
114
  specification_version: 4
115
115
  summary: Tool to backup databases
116
116
  test_files: []