scalingo_backups_manager 0.8.0 → 0.9.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de3bae8aee21115bc798c52df63e0ddc785e11ab10b2420a762848d1896d50ef
|
4
|
+
data.tar.gz: a1284ed86a12de0029d40d6cc540fd5e2a2e69e64fc598f8ab6bafd64a3d1fc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c58e1ed24cd527487d858bd341ed14e5480431b95245bd062e8adc38beb7130fc9d726fa6a818ae2e879cac83212d2470778b072ce11d3f71edf76b697f922a4
|
7
|
+
data.tar.gz: 00775f8db0dea7792cf701aea40727852f6d6b0e5fe3ec6cfbfea3976eb9f7ade0fe305b0fae6619ba4fb1c86cf99ff4f59a41e73200428397d2e388c9c6bf88
|
@@ -3,6 +3,13 @@ module ScalingoBackupsManager
|
|
3
3
|
|
4
4
|
class Notification
|
5
5
|
|
6
|
+
def self.send_healthchecks_notification(hook_url, message)
|
7
|
+
HTTParty.get(
|
8
|
+
hook_url,
|
9
|
+
headers: { 'Content-Type' => 'application/json' }
|
10
|
+
)
|
11
|
+
end
|
12
|
+
|
6
13
|
def self.send_slack_notification(hook_url, message)
|
7
14
|
HTTParty.post(
|
8
15
|
hook_url,
|
@@ -17,7 +17,6 @@ module ScalingoBackupsManager
|
|
17
17
|
destination_path = filename.split("/")
|
18
18
|
backup_name = destination_path.pop.gsub(".tar.gz", "")
|
19
19
|
destination_path = destination_path.join("/") + backup_name + "/"
|
20
|
-
p destination_path
|
21
20
|
if Dir.exist?(destination_path)
|
22
21
|
puts "Unzipped backup is already present, skipping..."
|
23
22
|
else
|
@@ -26,12 +25,13 @@ module ScalingoBackupsManager
|
|
26
25
|
system untar_cmd
|
27
26
|
end
|
28
27
|
|
29
|
-
rails_db_config = YAML.load(ERB.new(File.read("config/#{opts[:database_config_file]}")).result)[opts[:env]]
|
28
|
+
rails_db_config = YAML.load(ERB.new(File.read("config/#{opts[:database_config_file]}")).result)[opts[:env].to_s]
|
30
29
|
config = {
|
31
30
|
host: rails_db_config["host"],
|
32
31
|
database: rails_db_config["database"],
|
33
32
|
password: rails_db_config["password"],
|
34
33
|
user: rails_db_config["user"],
|
34
|
+
port: rails_db_config["port"]
|
35
35
|
}
|
36
36
|
restore_cmd = ""
|
37
37
|
if config[:password].present?
|
@@ -61,6 +61,7 @@ module ScalingoBackupsManager
|
|
61
61
|
restore_cmd << " -d #{config[:database]} --no-owner"
|
62
62
|
|
63
63
|
puts "*** Restoring backup to Postgres database ***"
|
64
|
+
puts restore_cmd
|
64
65
|
system(restore_cmd)
|
65
66
|
FileUtils.rm_r destination_path unless opts[:skip_rm]
|
66
67
|
end
|
@@ -60,6 +60,9 @@ module ScalingoBackupsManager
|
|
60
60
|
begin
|
61
61
|
sftp.upload!(filepath, "#{remote_dir}/#{filename}")
|
62
62
|
rescue
|
63
|
+
if options.dig(:webhooks, :healthchecks_webhook_url)
|
64
|
+
ScalingoBackupsManager::Notification.send_healthchecks_notification(options.dig(:webhooks, :healthchecks_webhook_url), "An error has occured while uploading backup, see the logs for more information")
|
65
|
+
end
|
63
66
|
if options.dig(:webhooks, :slack_webhook_url)
|
64
67
|
ScalingoBackupsManager::Notification.send_slack_notification(options.dig(:webhooks, :slack_webhook_url), "An error has occured while uploading backup, see the logs for more information")
|
65
68
|
end
|
@@ -1,3 +1,3 @@
|
|
1
1
|
module ScalingoBackupsManager
|
2
|
-
VERSION = "0.
|
3
|
-
end
|
2
|
+
VERSION = "0.9.0"
|
3
|
+
end
|
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.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Clercin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|