capistrano-ops 0.2.9 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +24 -15
- data/lib/capistrano/ops/tasks/storage/remove_old_backups.rake +3 -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: 686c30427e0a9b59098e2d10ceeb80b3c1a0d7e69d86bd49e8e15946e29b6437
|
4
|
+
data.tar.gz: 76d1e6fc178e8da2d832bca2240b4bb6254b5e1aa566986b8310b1914953398a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78dce9a9dadc4b2d74651fb96b545918625cd6169ea2995c2f34b71b0ed8d884c60668b6661df92afeed3ce13046dd3ea56a40ac998de5107d566a20eb487c70
|
7
|
+
data.tar.gz: cf770e27adac269ecabba02549cef902e161be6be02ad0e35b753f25d8002a0e7e7439a3ffd89c40e2dfd92e6946002dfd134204f02bcf9d247281c63e88baee
|
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,7 @@ 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? || ENV['KEEP_LOCAL_STORAGE_BACKUPS'] == 'true'
|
8
9
|
|
9
10
|
@env_local_no = ENV['NUMBER_OF_LOCAL_BACKUPS'].present? ? ENV['NUMBER_OF_LOCAL_BACKUPS'] : nil
|
10
11
|
@env_external_no = ENV['NUMBER_OF_EXTERNAL_BACKUPS'].present? ? ENV['NUMBER_OF_EXTERNAL_BACKUPS'] : nil
|
@@ -30,12 +31,12 @@ namespace :storage do
|
|
30
31
|
commandlist = [
|
31
32
|
"cd #{backup_path} && ls -lt ",
|
32
33
|
"grep -E -i #{bash_regex} ",
|
33
|
-
"tail -n +#{@total_local_backups_no + 1} ",
|
34
|
+
"tail -n +#{local_backup ? (@total_local_backups_no + 1) : 0} ",
|
34
35
|
"awk '{print $9}' ",
|
35
36
|
'xargs rm -rf'
|
36
37
|
]
|
37
38
|
|
38
|
-
result = system(commandlist.join(' | ')) if @total_local_backups_no.positive?
|
39
|
+
result = system(commandlist.join(' | ')) if @total_local_backups_no.positive? && local_backup || !local_backup && external_backup
|
39
40
|
puts 'remove_old_backups: local cleanup finished' if result
|
40
41
|
|
41
42
|
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.10
|
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
|