backy_rb 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +12 -11
- data/lib/backy/pg_dump.rb +15 -5
- data/lib/backy/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7bb1c2b1110d5fe15106b8bb78e8e07201e2318156aa6f67a4349eb92720a06
|
4
|
+
data.tar.gz: 5a8ae6f47b04ac3480cecedf77987166d5d630cc511496a734cddf5f7659e871
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 956ae711507992a7c75a3340d108b2df9e8da541ce9e90d346b1c0249bd22a414a6bf41f5e78f901f8b81ec68fd626a6f4cafbc8833d02a6eaea5f55563a0796
|
7
|
+
data.tar.gz: ca0b9c66ff07d33bd204df31e400690e53ca3a7108d8267eed734e9f5bc3d280046d1033856fbf13f89c297c38821d212ae573f4ea1d30b49eda95eb135bb624
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
All notable changes to `Backy` will be documented in this file.
|
4
4
|
|
5
5
|
## [Unreleased]
|
6
|
+
## [0.2.1] - 2024-06-24
|
7
|
+
### Fixed
|
8
|
+
- Fix bug where `push` is not working because of missing filename
|
9
|
+
|
6
10
|
## [0.2.0] - 2024-06-24
|
7
11
|
### Added
|
8
12
|
- Support for turning off replication
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -68,18 +68,19 @@ Backy can be configured through a .backyrc YAML file. Place this file in your ho
|
|
68
68
|
Example `.backyrc`:
|
69
69
|
|
70
70
|
```yaml
|
71
|
-
|
71
|
+
defaults:
|
72
72
|
use_parallel: true
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
73
|
+
s3:
|
74
|
+
access_key_id: YOUR_ACCESS_KEY
|
75
|
+
secret_access_key: YOUR_SECRET_KEY
|
76
|
+
region: YOUR_REGION
|
77
|
+
bucket: YOUR_BUCKET
|
78
|
+
database:
|
79
|
+
host: DB_HOST
|
80
|
+
port: DB_PORT
|
81
|
+
username: DB_USERNAME
|
82
|
+
password: DB_PASSWORD
|
83
|
+
database_name: DB_NAME
|
83
84
|
```
|
84
85
|
|
85
86
|
## Development
|
data/lib/backy/pg_dump.rb
CHANGED
@@ -14,15 +14,17 @@ module Backy
|
|
14
14
|
setup_backup_directory
|
15
15
|
log_start
|
16
16
|
|
17
|
+
dump_file = nil
|
18
|
+
|
17
19
|
begin
|
18
|
-
handle_replication { backup }
|
20
|
+
handle_replication { dump_file = backup }
|
19
21
|
rescue => e
|
20
22
|
Logger.error("An error occurred during backup: #{e.message}")
|
21
23
|
ensure
|
22
|
-
if replica? && pause_replication?
|
23
|
-
log_replication_resume
|
24
|
-
end
|
24
|
+
log_replication_resume if replica? && pause_replication?
|
25
25
|
end
|
26
|
+
|
27
|
+
dump_file
|
26
28
|
end
|
27
29
|
|
28
30
|
private
|
@@ -75,6 +77,8 @@ module Backy
|
|
75
77
|
Logger.log("Saving to #{dump_file} ... ")
|
76
78
|
|
77
79
|
execute_command(cmd, "error. See #{log_file}")
|
80
|
+
|
81
|
+
dump_file
|
78
82
|
end
|
79
83
|
|
80
84
|
def parallel_backup
|
@@ -91,10 +95,16 @@ module Backy
|
|
91
95
|
execute_command(cleanup_cmd, "Cleanup failed. See #{log_file} for details.")
|
92
96
|
|
93
97
|
Logger.success("Backup process completed. Output file: #{dump_file}")
|
98
|
+
|
99
|
+
dump_file
|
94
100
|
end
|
95
101
|
|
96
102
|
def execute_command(cmd, error_message)
|
97
|
-
|
103
|
+
if system(cmd)
|
104
|
+
Logger.success("done")
|
105
|
+
else
|
106
|
+
Logger.error(error_message)
|
107
|
+
end
|
98
108
|
end
|
99
109
|
|
100
110
|
def current_timestamp
|
data/lib/backy/version.rb
CHANGED