capistrano-ops 0.2.9 → 0.2.11
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 +4 -4
- data/README.md +24 -15
- data/lib/capistrano/ops/tasks/storage/remove_old_backups.rake +4 -2
- data/lib/capistrano/ops/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2744c35793b74ff96ed5933892458ed3bbb86d33b93b4a9aab119996ab099048
|
4
|
+
data.tar.gz: 8245cc91a46097474588d94f4b935dc0f2c83090bf1818c7da4e6f37662bfaa0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ddc408fdde37cbc926b36ce1fd3dce989a2aa6c4a73e61a700af581c02b3432274b49837784d182fa1f07ea48cb1ca253e8c6e9647d5aadbe6313d8c319bb57f
|
7
|
+
data.tar.gz: 14c1223afe87285ced3ce3790ef73b3b515a2912dd62cfd15da8e08ea2bebee3945c0773ba2af423bfc6753756a3dbd3f7d22acebcdf3de5117c6051c0934615
|
data/README.md
CHANGED
@@ -5,35 +5,43 @@ The capistrano-ops gem is a valuable library, tailor-made for Rails DevOps profe
|
|
5
5
|
## Main Features:
|
6
6
|
|
7
7
|
🗃️ **Database and Storage Backups:**
|
8
|
-
|
9
|
-
|
8
|
+
|
9
|
+
- Create, pull, and manage backups of your Postgres database and server storage.
|
10
|
+
- Delegation of old backup removal for both Postgres database and server storage.
|
10
11
|
|
11
12
|
🛠️ **Configuration Management:**
|
12
|
-
|
13
|
-
|
13
|
+
|
14
|
+
- Compare application.yml files between local and server environments using figaro_yml:compare.
|
15
|
+
- Fetch server environment variables set via Figaro with figaro_yml:get.
|
14
16
|
|
15
17
|
📜 **Logging and Task Management:**
|
16
|
-
|
17
|
-
-
|
18
|
-
|
18
|
+
|
19
|
+
- Real-time viewing of Rails server logs.
|
20
|
+
- Showcase the server app's crontab generated with the 'whenever' gem.
|
21
|
+
- Ability to invoke server-specific rake tasks.
|
19
22
|
|
20
23
|
🔔 **Notification Integrations:**
|
21
|
-
|
22
|
-
|
24
|
+
|
25
|
+
- Set up notifications through Slack or generic Webhooks.
|
26
|
+
- Customize notification levels (info/error).
|
23
27
|
|
24
28
|
⚙️ **Backup Settings Customization:**
|
25
|
-
|
26
|
-
|
27
|
-
|
29
|
+
|
30
|
+
- Define the number of backups retained, both locally and externally.
|
31
|
+
- Toggle backup tasks and external backups.
|
32
|
+
- S3 integration for backup storage, including customization of bucket, region, and endpoint details.
|
28
33
|
|
29
34
|
📅 **Schedule Tasks:**
|
30
|
-
|
35
|
+
|
36
|
+
- Couple with the 'whenever' gem to schedule daily backup creation and old backup removal.
|
31
37
|
|
32
38
|
🔗 **Slack & Webhook Integrations:**
|
33
|
-
|
39
|
+
|
40
|
+
- Integrate seamlessly with Slack or use webhooks for notifications, alerting you on essential operations or any potential issues.
|
34
41
|
|
35
42
|
☁️ **Backup Providers:**
|
36
|
-
|
43
|
+
|
44
|
+
- S3 and other S3-compatible services are supported to ensure your data remains secure and accessible.
|
37
45
|
|
38
46
|
## Requirements
|
39
47
|
|
@@ -116,6 +124,7 @@ production:
|
|
116
124
|
| NUMBER_OF_EXTERNAL_BACKUPS | number of backups to keep externally (default: nil) | `number` |
|
117
125
|
| BACKUPS_ENABLED | enable/disable backup task (default: Rails.env == 'production') | `boolean` |
|
118
126
|
| EXTERNAL_BACKUP_ENABLED | enable/disable external backup (default: false) (only if 'BACKUPS_ENABLED', needs additional setup) | `boolean` |
|
127
|
+
| KEEP_LOCAL_STORAGE_BACKUPS | keep local storage backups (default: Rails.env == 'production') | `boolean` |
|
119
128
|
| DEFAULT_URL | notification message title (default: "#{database} Backup") | `string` |
|
120
129
|
| NOTIFICATION_TYPE | for notification (default: nil) | `string` (`webhook`/`slack`) |
|
121
130
|
| NOTIFICATION_LEVEL | for notification (default: nil) | `string` (`info`/`error`) |
|
@@ -5,6 +5,8 @@ namespace :storage do
|
|
5
5
|
backup_path = Rails.root.join(Rails.env.development? ? 'tmp/backups' : '../../shared/backups').to_s
|
6
6
|
backups_enabled = Rails.env.production? || ENV['BACKUPS_ENABLED'] == 'true'
|
7
7
|
external_backup = Rails.env.production? || ENV['EXTERNAL_BACKUP_ENABLED'] == 'true'
|
8
|
+
local_backup = Rails.env.production?
|
9
|
+
local_backup = ENV['KEEP_LOCAL_STORAGE_BACKUPS'] == 'true' if ENV['KEEP_LOCAL_STORAGE_BACKUPS'].present?
|
8
10
|
|
9
11
|
@env_local_no = ENV['NUMBER_OF_LOCAL_BACKUPS'].present? ? ENV['NUMBER_OF_LOCAL_BACKUPS'] : nil
|
10
12
|
@env_external_no = ENV['NUMBER_OF_EXTERNAL_BACKUPS'].present? ? ENV['NUMBER_OF_EXTERNAL_BACKUPS'] : nil
|
@@ -30,12 +32,12 @@ namespace :storage do
|
|
30
32
|
commandlist = [
|
31
33
|
"cd #{backup_path} && ls -lt ",
|
32
34
|
"grep -E -i #{bash_regex} ",
|
33
|
-
"tail -n +#{@total_local_backups_no + 1} ",
|
35
|
+
"tail -n +#{local_backup ? (@total_local_backups_no + 1) : 0} ",
|
34
36
|
"awk '{print $9}' ",
|
35
37
|
'xargs rm -rf'
|
36
38
|
]
|
37
39
|
|
38
|
-
result = system(commandlist.join(' | ')) if @total_local_backups_no.positive?
|
40
|
+
result = system(commandlist.join(' | ')) if @total_local_backups_no.positive? && local_backup || !local_backup && external_backup
|
39
41
|
puts 'remove_old_backups: local cleanup finished' if result
|
40
42
|
|
41
43
|
if ENV['BACKUP_PROVIDER'].present? && external_backup
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-ops
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Crusius
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-s3
|