safety_net_heroku 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +28 -19
- data/lib/safety_net_heroku.rb +0 -1
- data/lib/safety_net_heroku/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: 0bde90f66614acbce4d3b9b7e8a0ee25e31275c0b624bfa04f0186b7a14a464b
|
4
|
+
data.tar.gz: 6e022e24f351c98211fbdce14205ff5f0c0551b810215ec9069f1a7f5c660c3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 460ad3c85f4d4dbad723eb75dc953e65100c2f53bdfba25a1ad641ff7143305602f5658367eed1cc1c6063d2c685a53c08297fbdf68a8a7c6087f2da637b7345
|
7
|
+
data.tar.gz: 10a6b195697c9518fcbcd44625187febd919365f23838465334e022d44bf1715af28a054b2f88b38ddbf3e7a0d1fe9f4caf04d6503636e5ed115d6f1cf0fafe1
|
data/README.md
CHANGED
@@ -1,39 +1,48 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/safety_net_heroku`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
1
|
+
A simple gem for backing up a MongoDB database to AWS when hosted on Heroku using a Sidekiq worker.
|
6
2
|
|
7
3
|
## Installation
|
8
4
|
|
9
|
-
Add this line to your application's Gemfile:
|
10
|
-
|
11
5
|
```ruby
|
12
6
|
gem 'safety_net_heroku'
|
13
7
|
```
|
14
8
|
|
15
|
-
|
9
|
+
## Usage
|
16
10
|
|
17
|
-
|
11
|
+
Create a new Safety Net Heroku initializer:
|
18
12
|
|
19
|
-
|
13
|
+
```ruby
|
14
|
+
# safety_net_heroku.rb
|
20
15
|
|
21
|
-
|
16
|
+
SafetyNetHeroku.config[:database_name] = 'database_name'
|
17
|
+
SafetyNetHeroku.config[:aws_region] = 's3_region'
|
18
|
+
SafetyNetHeroku.config[:aws_bucket] = 's3_bucket'
|
19
|
+
SafetyNetHeroku.config[:aws_backups_directory] = s3_directory'
|
22
20
|
|
23
|
-
|
21
|
+
```
|
24
22
|
|
25
|
-
|
23
|
+
In your sidekiq initializer, import the Sidekiq worker:
|
26
24
|
|
27
|
-
|
25
|
+
```ruby
|
26
|
+
# sidekiq.rb
|
27
|
+
|
28
|
+
require 'safety_net_heroku/backup_database_worker'
|
29
|
+
```
|
30
|
+
Add the worker to your sidekiq schedule as a cron job:
|
28
31
|
|
29
|
-
|
32
|
+
```ruby
|
33
|
+
# sidekiq_schedule.yml
|
34
|
+
|
35
|
+
backup_database:
|
36
|
+
cron: "0 3 * * *"
|
37
|
+
class: "SafetyNetHeroku::BackupDatabaseWorker"
|
38
|
+
```
|
30
39
|
|
31
|
-
|
40
|
+
#### Your database will now be backed up to the AWS directory specified periodically based on your cron settings! 🎉
|
32
41
|
|
33
|
-
##
|
42
|
+
## Author
|
34
43
|
|
35
|
-
|
44
|
+
Dalton Hinterscher, daltonhint4@gmail.com
|
36
45
|
|
37
46
|
## License
|
38
47
|
|
39
|
-
|
48
|
+
Safety Net Heroku is available under the MIT license. See the LICENSE file for more info.
|
data/lib/safety_net_heroku.rb
CHANGED