heroku_super_backup 0.0.1.1rc → 0.0.2.rc
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.
- data/LICENSE +1 -1
- data/README.md +13 -48
- data/lib/heroku_super_backup/heroku_super_backup.sample.rb +2 -1
- data/lib/heroku_super_backup/version.rb +1 -1
- data/lib/heroku_super_backup.rb +9 -2
- metadata +7 -7
data/LICENSE
CHANGED
data/README.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
# Heroku Cloud Backup
|
|
2
1
|
|
|
3
|
-
|
|
2
|
+
# Heroku Super Backup
|
|
3
|
+
|
|
4
|
+
It's originally a fork from heroku_cloud_backup gem, currently it supports multiple storage provider and and initializer config for the storage credentials.
|
|
5
|
+
|
|
6
|
+
The `heroku_super_backup` gem adds a rake task to your project that will take backups stored with Heroku's [PGBackup addon](http://devcenter.heroku.com/articles/pgbackups) and upload them to the cloud.
|
|
4
7
|
|
|
5
8
|
## Installation
|
|
6
9
|
|
|
@@ -17,58 +20,29 @@ If you want this to run daily, you'll need to enable the Heroku cron addon:
|
|
|
17
20
|
For Rails 3 and later, add this to your Gemfile:
|
|
18
21
|
|
|
19
22
|
gem 'heroku_backup_task'
|
|
20
|
-
gem '
|
|
23
|
+
gem 'heroku_super_backup'
|
|
21
24
|
|
|
22
25
|
For Rails 2.1 and later, add this to your in your environment.rb:
|
|
23
26
|
|
|
24
27
|
config.gem 'heroku_backup_task'
|
|
25
|
-
config.gem '
|
|
28
|
+
config.gem 'heroku_super_backup'
|
|
26
29
|
|
|
27
30
|
In your Rakefile:
|
|
28
31
|
|
|
29
32
|
require "heroku_backup_task"
|
|
30
|
-
require "
|
|
33
|
+
require "heroku_super_backup"
|
|
31
34
|
task :cron do
|
|
32
35
|
HerokuBackupTask.execute
|
|
33
|
-
|
|
36
|
+
HerokuSuperBackup.execute
|
|
34
37
|
end
|
|
35
38
|
|
|
36
39
|
## Usage
|
|
40
|
+
Steps:
|
|
37
41
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
HCB_PROVIDER (aws, rackspace, google) - Add which provider you're using. **Required**
|
|
41
|
-
|
|
42
|
-
heroku config:add HCB_PROVIDER='aws' # or 'google' or 'rackspace'
|
|
43
|
-
|
|
44
|
-
HCB_BUCKET (alphanumberic characters, dashes, period, underscore are allowed, between 3 and 255 characters long) - Select a bucket name to upload to. This the bucket or root directory that your files will be stored in. If the bucket doesn't exist, it will be created. **Required**
|
|
45
|
-
|
|
46
|
-
heroku config:add HCB_BUCKET='mywebsite'
|
|
47
|
-
|
|
48
|
-
HCB_PREFIX (Defaults to "db") - The direction prefix for where the backups are stored. This is so you can store your backups within a specific sub directory within the bucket. heroku_cloud_backup will also append the ENV var of the database to the path, so you can backup multiple databases, by their ENV names. **Optional**
|
|
49
|
-
|
|
50
|
-
heroku config:add HCB_PREFIX='backups/pg'
|
|
42
|
+
1. Rake heroku:create_initializer
|
|
51
43
|
|
|
52
|
-
|
|
44
|
+
2. Go to config/initalizers/heroku_super_backup.rb and edit the CLOUD_CREDENTIALS.
|
|
53
45
|
|
|
54
|
-
heroku config:add HCB_MAX=10
|
|
55
|
-
|
|
56
|
-
Depending on which provider you specify, you'll need to provide different login credentials.
|
|
57
|
-
|
|
58
|
-
For Amazon:
|
|
59
|
-
|
|
60
|
-
heroku config:add HCB_KEY1="aws_access_key_id"
|
|
61
|
-
heroku config:add HCB_KEY2="aws_secret_access_key"
|
|
62
|
-
|
|
63
|
-
For Rackspace:
|
|
64
|
-
|
|
65
|
-
heroku config:add HCB_KEY1="rackspace_username"
|
|
66
|
-
heroku config:add HCB_KEY2="rackspace_api_key"
|
|
67
|
-
|
|
68
|
-
For Google Storage:
|
|
69
|
-
|
|
70
|
-
heroku config:add HCB_KEY1="google_storage_secret_access_key"
|
|
71
|
-
heroku config:add HCB_KEY2="google_storage_access_key_id"
|
|
72
46
|
|
|
73
47
|
You can run this manually like this:
|
|
74
48
|
|
|
@@ -81,16 +55,7 @@ I would recommend you create a temporarily public url from your cloud storage. I
|
|
|
81
55
|
|
|
82
56
|
heroku pgbackups:restore 'http://my-bucket-name.s3.amazonaws.com/db/DATABASE_URL/2011-06-09-014500.dump?authparameters'
|
|
83
57
|
|
|
84
|
-
## Note on Patches/Pull Requests
|
|
85
|
-
|
|
86
|
-
* Fork the project.
|
|
87
|
-
* Make your feature addition or bug fix.
|
|
88
|
-
* Add tests for it. This is important so I don't break it in a
|
|
89
|
-
future version unintentionally.
|
|
90
|
-
* Commit, do not mess with rakefile, version, or history.
|
|
91
|
-
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
|
92
|
-
* Send me a pull request. Bonus points for topic branches.
|
|
93
58
|
|
|
94
59
|
### Copyright
|
|
95
60
|
|
|
96
|
-
Copyright (c)
|
|
61
|
+
Copyright (c) 2012 RedGuava. See LICENSE for details.
|
data/lib/heroku_super_backup.rb
CHANGED
|
@@ -45,7 +45,8 @@ module HerokuSuperBackup
|
|
|
45
45
|
@provider = credential[:provider] || raise(HerokuSuperBackup::Errors::NotFound.new("Please provide a 'provider' on the CLOUD_CREDENTIALS variable."))
|
|
46
46
|
@key1 = credential[:key1] || raise(HerokuSuperBackup::Errors::NotFound.new("Please provide a 'HCB_KEY1' on the CLOUD_CREDENTIALS variable."))
|
|
47
47
|
@key2 = credential[:key2] || raise(HerokuSuperBackup::Errors::NotFound.new("Please provide a 'HCB_KEY2' CLOUD_CREDENTIALS variable."))
|
|
48
|
-
|
|
48
|
+
@encrypted = credential[:encrypted] || "false"
|
|
49
|
+
|
|
49
50
|
b = client.get_backups.last
|
|
50
51
|
raise HerokuSuperBackup::Errors::NoBackups.new("You don't have any pgbackups. Please run heroku pgbackups:capture first.") unless b
|
|
51
52
|
|
|
@@ -92,7 +93,13 @@ module HerokuSuperBackup
|
|
|
92
93
|
name = "#{created_at.strftime('%Y-%m-%d-%H%M%S')}.dump"
|
|
93
94
|
begin
|
|
94
95
|
log "creating #{@backup_path}/#{b["from_name"]}/#{name}"
|
|
95
|
-
directory.files.
|
|
96
|
+
file = directory.files.new(:key => "#{@backup_path}/#{b["from_name"]}/#{name}", :body => open(public_url))
|
|
97
|
+
if @provider = "aws" and encrypt
|
|
98
|
+
options = {"x-amz-server-side-encryption"=>"AES256"}
|
|
99
|
+
else
|
|
100
|
+
options = {}
|
|
101
|
+
end
|
|
102
|
+
file.save(options)
|
|
96
103
|
rescue Exception => e
|
|
97
104
|
raise HerokuSuperBackup::Errors::UploadError.new(e.message)
|
|
98
105
|
end
|
metadata
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: heroku_super_backup
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
5
|
-
prerelease:
|
|
4
|
+
version: 0.0.2.rc
|
|
5
|
+
prerelease: 6
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
8
8
|
- RedGuava
|
|
@@ -10,11 +10,11 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2012-02-
|
|
13
|
+
date: 2012-02-13 00:00:00.000000000Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: fog
|
|
17
|
-
requirement: &
|
|
17
|
+
requirement: &70287640142040 !ruby/object:Gem::Requirement
|
|
18
18
|
none: false
|
|
19
19
|
requirements:
|
|
20
20
|
- - ! '>='
|
|
@@ -22,10 +22,10 @@ dependencies:
|
|
|
22
22
|
version: 0.7.2
|
|
23
23
|
type: :runtime
|
|
24
24
|
prerelease: false
|
|
25
|
-
version_requirements: *
|
|
25
|
+
version_requirements: *70287640142040
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: heroku
|
|
28
|
-
requirement: &
|
|
28
|
+
requirement: &70287640141500 !ruby/object:Gem::Requirement
|
|
29
29
|
none: false
|
|
30
30
|
requirements:
|
|
31
31
|
- - ! '>='
|
|
@@ -33,7 +33,7 @@ dependencies:
|
|
|
33
33
|
version: 2.1.4
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
|
-
version_requirements: *
|
|
36
|
+
version_requirements: *70287640141500
|
|
37
37
|
description: PG backups into the cloud with fog
|
|
38
38
|
email:
|
|
39
39
|
- info@redguava.com.au
|