scalingo_backups_manager 0.6.5 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/.gitignore +2 -1
- data/Gemfile.lock +29 -21
- data/lib/scalingo_backups_manager/cli.rb +16 -11
- data/lib/scalingo_backups_manager/sftp_tools.rb +13 -5
- data/lib/scalingo_backups_manager/version.rb +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22aae190ac267f91679c59c01c34a385d7d31b8859c05c106e280bd8c449bc32
|
4
|
+
data.tar.gz: 4db5340d871f30d632067a274178837561716c289fe57fa72b1cc7a7af6a38cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50c9ee867cfbb4f09c14cc82a7675ebd43c561d87fdaea720cf4ad0455be6aec87dcb022103e82638bc722c2c09f07fe29386c621e05338e30cafd43074eb8a2
|
7
|
+
data.tar.gz: af4e44b07ad73739b00fdb2e77be8c7dd80e8a0fdff376e87cfaf73c3a1e2618e90761adc46c5d61477b78c1730f2c0c3fadf705b2ed8cb5822008230b559bf6
|
data/.DS_Store
ADDED
Binary file
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
scalingo_backups_manager (0.
|
4
|
+
scalingo_backups_manager (0.7.0)
|
5
5
|
httparty (~> 0.18)
|
6
6
|
net-sftp (~> 3.0.0)
|
7
7
|
scalingo (~> 3.0)
|
@@ -10,41 +10,50 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
activesupport (
|
13
|
+
activesupport (7.0.3)
|
14
14
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
15
|
i18n (>= 1.6, < 2)
|
16
16
|
minitest (>= 5.1)
|
17
17
|
tzinfo (~> 2.0)
|
18
|
-
|
19
|
-
concurrent-ruby (1.1.9)
|
18
|
+
concurrent-ruby (1.1.10)
|
20
19
|
diff-lcs (1.4.4)
|
21
|
-
faraday (1.
|
20
|
+
faraday (1.10.0)
|
22
21
|
faraday-em_http (~> 1.0)
|
23
22
|
faraday-em_synchrony (~> 1.0)
|
24
23
|
faraday-excon (~> 1.1)
|
24
|
+
faraday-httpclient (~> 1.0)
|
25
|
+
faraday-multipart (~> 1.0)
|
25
26
|
faraday-net_http (~> 1.0)
|
26
|
-
faraday-net_http_persistent (~> 1.
|
27
|
-
|
27
|
+
faraday-net_http_persistent (~> 1.0)
|
28
|
+
faraday-patron (~> 1.0)
|
29
|
+
faraday-rack (~> 1.0)
|
30
|
+
faraday-retry (~> 1.0)
|
28
31
|
ruby2_keywords (>= 0.0.4)
|
29
32
|
faraday-em_http (1.0.0)
|
30
33
|
faraday-em_synchrony (1.0.0)
|
31
34
|
faraday-excon (1.1.0)
|
35
|
+
faraday-httpclient (1.0.1)
|
36
|
+
faraday-multipart (1.0.3)
|
37
|
+
multipart-post (>= 1.2, < 3)
|
32
38
|
faraday-net_http (1.0.1)
|
33
|
-
faraday-net_http_persistent (1.
|
34
|
-
|
39
|
+
faraday-net_http_persistent (1.2.0)
|
40
|
+
faraday-patron (1.0.0)
|
41
|
+
faraday-rack (1.0.0)
|
42
|
+
faraday-retry (1.0.3)
|
43
|
+
faraday_middleware (1.2.0)
|
35
44
|
faraday (~> 1.0)
|
36
|
-
httparty (0.
|
45
|
+
httparty (0.20.0)
|
37
46
|
mime-types (~> 3.0)
|
38
47
|
multi_xml (>= 0.5.2)
|
39
|
-
i18n (1.
|
48
|
+
i18n (1.10.0)
|
40
49
|
concurrent-ruby (~> 1.0)
|
41
|
-
mime-types (3.
|
50
|
+
mime-types (3.4.1)
|
42
51
|
mime-types-data (~> 3.2015)
|
43
|
-
mime-types-data (3.
|
44
|
-
minitest (5.
|
52
|
+
mime-types-data (3.2022.0105)
|
53
|
+
minitest (5.15.0)
|
45
54
|
multi_json (1.15.0)
|
46
55
|
multi_xml (0.6.0)
|
47
|
-
multipart-post (2.
|
56
|
+
multipart-post (2.2.0)
|
48
57
|
net-sftp (3.0.0)
|
49
58
|
net-ssh (>= 5.0.0, < 7.0.0)
|
50
59
|
net-ssh (6.1.0)
|
@@ -62,16 +71,15 @@ GEM
|
|
62
71
|
diff-lcs (>= 1.2.0, < 2.0)
|
63
72
|
rspec-support (~> 3.10.0)
|
64
73
|
rspec-support (3.10.2)
|
65
|
-
ruby2_keywords (0.0.
|
66
|
-
scalingo (3.0
|
67
|
-
activesupport (>= 5, <
|
74
|
+
ruby2_keywords (0.0.5)
|
75
|
+
scalingo (3.1.0)
|
76
|
+
activesupport (>= 5, < 8)
|
68
77
|
faraday (~> 1.0)
|
69
78
|
faraday_middleware (~> 1.0)
|
70
79
|
multi_json (~> 1.0, >= 1.0.3)
|
71
|
-
thor (1.1
|
80
|
+
thor (1.2.1)
|
72
81
|
tzinfo (2.0.4)
|
73
82
|
concurrent-ruby (~> 1.0)
|
74
|
-
zeitwerk (2.4.2)
|
75
83
|
|
76
84
|
PLATFORMS
|
77
85
|
ruby
|
@@ -82,4 +90,4 @@ DEPENDENCIES
|
|
82
90
|
scalingo_backups_manager!
|
83
91
|
|
84
92
|
BUNDLED WITH
|
85
|
-
2.
|
93
|
+
2.3.13
|
@@ -79,20 +79,24 @@ module ScalingoBackupsManager
|
|
79
79
|
end
|
80
80
|
|
81
81
|
configuration.for_each_addons(searched_application, searched_addon) do |application, addon|
|
82
|
-
|
83
|
-
next unless backups.size > 0
|
84
|
-
backup = backups.first
|
85
|
-
download_link = backup.download_link
|
86
|
-
if download_link
|
82
|
+
begin
|
87
83
|
puts "Downloading #{application.name} last backup"
|
88
|
-
|
89
|
-
|
90
|
-
|
84
|
+
backups = addon.backups
|
85
|
+
next unless backups.size > 0
|
86
|
+
backup = backups.first
|
87
|
+
download_link = backup.download_link
|
88
|
+
if download_link
|
89
|
+
path = ("#{addon.config[:path]}" || "backups/#{addon.addon_provider[:id]}") + "/#{Time.now.strftime("%Y%m%d")}.tar.gz"
|
90
|
+
if File.exist?(path)
|
91
|
+
puts "Backup already download, skipping..."
|
92
|
+
else
|
93
|
+
system "curl #{download_link} -o #{path} --create-dirs -k"
|
94
|
+
end
|
91
95
|
else
|
92
|
-
|
96
|
+
puts "No download link found for #{addon.addon_provider[:id]}, Skipping..."
|
93
97
|
end
|
94
|
-
|
95
|
-
puts "
|
98
|
+
rescue
|
99
|
+
puts "Issue with configuration of #{application.name}"
|
96
100
|
end
|
97
101
|
end
|
98
102
|
end
|
@@ -164,6 +168,7 @@ module ScalingoBackupsManager
|
|
164
168
|
when "daily"
|
165
169
|
sftp.upload_file(path, remote_path, options: opts)
|
166
170
|
files = sftp.list_files(remote_path)
|
171
|
+
p files.length
|
167
172
|
puts "#{step} - Checking daily backups"
|
168
173
|
step += 1
|
169
174
|
if files.size > retention_config[:ttl]
|
@@ -10,16 +10,25 @@ module ScalingoBackupsManager
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def start
|
13
|
-
|
14
|
-
|
13
|
+
if @ftp_host[:password]
|
14
|
+
Net::SFTP.start(@ftp_host[:host], @ftp_host[:user], password: @ftp_host[:password], port: @ftp_host[:port]) do |sftp|
|
15
|
+
yield(sftp) if block_given?
|
16
|
+
end
|
17
|
+
elsif @ftp_host[:private_key_path]
|
18
|
+
Net::SFTP.start(@ftp_host[:host], @ftp_host[:user], key_data: [], keys: @ftp_host[:private_key_path], keys_only: true, port: @ftp_host[:port]) do |sftp|
|
19
|
+
yield(sftp) if block_given?
|
20
|
+
end
|
15
21
|
end
|
16
22
|
end
|
17
23
|
|
18
24
|
def list_files(path)
|
19
25
|
files = []
|
20
26
|
start do |sftp|
|
21
|
-
|
22
|
-
|
27
|
+
begin
|
28
|
+
sftp.dir.glob("#{path}", "*.tar.gz").each do |file|
|
29
|
+
files << file
|
30
|
+
end
|
31
|
+
rescue
|
23
32
|
end
|
24
33
|
end
|
25
34
|
files
|
@@ -36,7 +45,6 @@ module ScalingoBackupsManager
|
|
36
45
|
folder_tree = []
|
37
46
|
path.split("/").each do |folder_name|
|
38
47
|
next if folder_name.blank?
|
39
|
-
|
40
48
|
folder_tree << folder_name
|
41
49
|
begin
|
42
50
|
sftp.mkdir!(folder_tree.join("/"))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scalingo_backups_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Clercin
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 3.0.0
|
69
|
-
description:
|
69
|
+
description:
|
70
70
|
email:
|
71
71
|
- kevin@9troisquarts.com
|
72
72
|
executables:
|
@@ -74,6 +74,7 @@ executables:
|
|
74
74
|
extensions: []
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
|
+
- ".DS_Store"
|
77
78
|
- ".gitignore"
|
78
79
|
- ".rspec"
|
79
80
|
- ".travis.yml"
|
@@ -106,7 +107,7 @@ metadata:
|
|
106
107
|
homepage_uri: https://github.com/9troisquarts/scalingo_backups_manager
|
107
108
|
source_code_uri: https://github.com/9troisquarts/scalingo_backups_manager
|
108
109
|
changelog_uri: https://github.com/9troisquarts/scalingo_backups_manager/CHANGELOG.md
|
109
|
-
post_install_message:
|
110
|
+
post_install_message:
|
110
111
|
rdoc_options: []
|
111
112
|
require_paths:
|
112
113
|
- lib
|
@@ -121,8 +122,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
122
|
- !ruby/object:Gem::Version
|
122
123
|
version: '0'
|
123
124
|
requirements: []
|
124
|
-
rubygems_version: 3.
|
125
|
-
signing_key:
|
125
|
+
rubygems_version: 3.3.7
|
126
|
+
signing_key:
|
126
127
|
specification_version: 4
|
127
128
|
summary: Gem allowing to download backups from scalingo
|
128
129
|
test_files: []
|