ll-innobackup 0.1.21 → 0.1.22
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 +5 -5
- data/lib/ll-innobackup.rb +13 -7
- metadata +20 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: d2ca7b250814e3f83939af845ca2f7db199135f659862baaca1bba4cca6f942e
|
|
4
|
+
data.tar.gz: 3945ea705a4caec96da2ccfda6422e6064605707f0077618d927280329b408ab
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bd758d78a0b5259bd88b6ca13733fa30fccf08e9690aba34f27a3761880d1803002b7ecacb80d7160991d046fedb448c5e23e32608b42d393aa9393d77530a6e
|
|
7
|
+
data.tar.gz: 1e336ff205f29223ddfec8bf52f0bff24411864a57c06db0e7a3a50debf4f9bdf693968fd92740c62af4beb7b115833c20b17d951b34ba2feab1d0873013f83d
|
data/lib/ll-innobackup.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require 'json'
|
|
2
2
|
require 'date'
|
|
3
|
+
require 'aws-sdk-s3'
|
|
3
4
|
|
|
4
5
|
# Run Inmental or Full backups on MySQL
|
|
5
6
|
module LL
|
|
@@ -62,7 +63,8 @@ class InnoBackup
|
|
|
62
63
|
:date,
|
|
63
64
|
:state_files,
|
|
64
65
|
:lock_files,
|
|
65
|
-
:options
|
|
66
|
+
:options,
|
|
67
|
+
:s3
|
|
66
68
|
|
|
67
69
|
def initialize(options = {})
|
|
68
70
|
@now = Time.now
|
|
@@ -71,6 +73,7 @@ class InnoBackup
|
|
|
71
73
|
@lock_files = {}
|
|
72
74
|
@state_files = {}
|
|
73
75
|
@type = backup_type
|
|
76
|
+
@s3 = Aws::S3::Resource.new(region: 'eu-west-1')
|
|
74
77
|
end
|
|
75
78
|
|
|
76
79
|
def aws_log
|
|
@@ -217,10 +220,14 @@ class InnoBackup
|
|
|
217
220
|
"--expected-size=#{expected_full_size}" if type == 'full'
|
|
218
221
|
end
|
|
219
222
|
|
|
220
|
-
def
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
223
|
+
def s3object_uploaded?(bucket_name, object_key, file_path)
|
|
224
|
+
object = @s3.bucket(bucket_name).object(object_key)
|
|
225
|
+
object.upload_file(file_path, {expires: expires_date, thread_count: @options['thread_count']}) do |r|
|
|
226
|
+
return true
|
|
227
|
+
end
|
|
228
|
+
rescue StandardError => e
|
|
229
|
+
STDERR.puts "Error uploading object: #{e.message}"
|
|
230
|
+
return false
|
|
224
231
|
end
|
|
225
232
|
|
|
226
233
|
def valid_commands?
|
|
@@ -234,8 +241,7 @@ class InnoBackup
|
|
|
234
241
|
`#{innobackup_command}`
|
|
235
242
|
@completed_inno = $CHILD_STATUS == 0
|
|
236
243
|
raise InnoBackup::StateError, 'Unable to run innobackup correctly' unless @completed_inno
|
|
237
|
-
|
|
238
|
-
@completed_aws = $CHILD_STATUS == 0
|
|
244
|
+
@completed_aws = s3object_uploaded?(aws_bucket, aws_backup_file, working_file)
|
|
239
245
|
raise InnoBackup::StateError, 'Unable to run aws upload correctly' unless @completed_aws
|
|
240
246
|
return record if success? && completed?
|
|
241
247
|
rescue InnoBackup::StateError => e
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ll-innobackup
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.22
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stuart Harland, LiveLink Technology Ltd
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-01-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -24,6 +24,20 @@ dependencies:
|
|
|
24
24
|
- - '='
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: 4.2.6
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: aws-sdk-s3
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '1'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '1'
|
|
27
41
|
description: A program to conduct innobackup
|
|
28
42
|
email: essjayhch@gmail.com, infra@livelinktechnology.net
|
|
29
43
|
executables:
|
|
@@ -37,7 +51,7 @@ homepage: http://rubygems.org/gems/ll-innobackup
|
|
|
37
51
|
licenses:
|
|
38
52
|
- MIT
|
|
39
53
|
metadata: {}
|
|
40
|
-
post_install_message:
|
|
54
|
+
post_install_message:
|
|
41
55
|
rdoc_options: []
|
|
42
56
|
require_paths:
|
|
43
57
|
- lib
|
|
@@ -52,9 +66,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
52
66
|
- !ruby/object:Gem::Version
|
|
53
67
|
version: '0'
|
|
54
68
|
requirements: []
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
signing_key:
|
|
69
|
+
rubygems_version: 3.1.4
|
|
70
|
+
signing_key:
|
|
58
71
|
specification_version: 4
|
|
59
72
|
summary: Livelink Innobackup Script
|
|
60
73
|
test_files: []
|