bard-backup 0.3.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bard/backup/{controller.rb → local_backhoe.rb} +5 -3
- data/lib/bard/backup/s3_dir.rb +9 -0
- data/lib/bard/backup/version.rb +1 -1
- data/lib/bard/backup.rb +4 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71a87dace6348cc41462c0192446af581cb9253d218d4c32c0c98667fe26c73a
|
4
|
+
data.tar.gz: 86eac09b1520f87f7bedd20bff84afd94496416d715947ea49f6047fdc45ed72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40fa5aa6fa1ee989cad053b08a529173376ebb3d18ee38d72024a5bbe5a0fe0cd222698664791490edc799200e77f7df7685eec8d561c995925f597a0121f36b
|
7
|
+
data.tar.gz: 384b78be14d95ee94dafd9941242818b84b073acc11e6833ace1cd011f95583630aeef27d22428c5a1b9864175989bbe40d292196c1908d884461310f138aa81
|
@@ -1,10 +1,12 @@
|
|
1
|
+
require "backhoe"
|
2
|
+
|
1
3
|
module Bard
|
2
4
|
module Backup
|
3
|
-
class
|
4
|
-
def call
|
5
|
+
class LocalBackhoe
|
6
|
+
def self.call s3_dir, now
|
5
7
|
filename = "#{now.iso8601}.sql.gz"
|
6
8
|
path = "/tmp/#{filename}"
|
7
|
-
|
9
|
+
Backhoe.dump path
|
8
10
|
s3_dir.mv path
|
9
11
|
end
|
10
12
|
end
|
data/lib/bard/backup/s3_dir.rb
CHANGED
@@ -21,6 +21,15 @@ module Bard
|
|
21
21
|
})
|
22
22
|
end
|
23
23
|
|
24
|
+
def presigned_url file_path
|
25
|
+
presigner = Aws::S3::Presigner.new(client: client)
|
26
|
+
presigner.presigned_url(
|
27
|
+
:put_object,
|
28
|
+
bucket: bucket_name,
|
29
|
+
key: [folder_prefix, File.basename(file_path)].compact.join("/"),
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
24
33
|
def mv file_path, body: File.read(file_path)
|
25
34
|
put file_path, body: body
|
26
35
|
FileUtils.rm file_path
|
data/lib/bard/backup/version.rb
CHANGED
data/lib/bard/backup.rb
CHANGED
@@ -1,14 +1,12 @@
|
|
1
|
-
require "bard/backup/controller"
|
2
|
-
require "bard/backup/deleter"
|
3
1
|
require "bard/backup/s3_dir"
|
4
|
-
require "
|
2
|
+
require "bard/backup/local_backhoe"
|
3
|
+
require "bard/backup/deleter"
|
5
4
|
|
6
5
|
module Bard
|
7
6
|
module Backup
|
8
|
-
def self.call s3_path, access_key:, secret_key:, region: "us-west-2", now: Time.now.utc
|
9
|
-
dumper = Backhoe
|
7
|
+
def self.call s3_path, access_key:, secret_key:, region: "us-west-2", now: Time.now.utc, strategy: LocalBackhoe
|
10
8
|
s3_dir = S3Dir.new(path: s3_path, access_key:, secret_key:, region:)
|
11
|
-
|
9
|
+
strategy.call(s3_dir, now)
|
12
10
|
Deleter.new(s3_dir, now).call
|
13
11
|
end
|
14
12
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bard-backup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Micah Geisel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backhoe
|
@@ -81,8 +81,8 @@ files:
|
|
81
81
|
- Rakefile
|
82
82
|
- lib/bard-backup.rb
|
83
83
|
- lib/bard/backup.rb
|
84
|
-
- lib/bard/backup/controller.rb
|
85
84
|
- lib/bard/backup/deleter.rb
|
85
|
+
- lib/bard/backup/local_backhoe.rb
|
86
86
|
- lib/bard/backup/s3_dir.rb
|
87
87
|
- lib/bard/backup/version.rb
|
88
88
|
- sig/bard/backup.rbs
|