pgbackups_s3 0.0.1 → 0.0.2
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 +46 -2
- data/lib/pgbackups_s3/client.rb +1 -1
- data/pgbackups_s3.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f3e02a429a4865906ce2a2c7e71536b37c4b56f
|
4
|
+
data.tar.gz: 466bf011cb825f7629652cda050b3efb0e401e07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c6e95c5016df6f82d50cd021e8296cf4f58fe15f7364e658ddebeb3d3f76b21ec060cace318ca37317de5c0e5308d710286275494242bc7cd4cfc205fcf01a3
|
7
|
+
data.tar.gz: 945f6f695848976b0c471a3e039041f47a2550568c1f21c5fb1ace1fe7966a8fbfe14ce9827d5a9af45a0132feb9416b1c37af5219d8985e2e171c845a413277
|
data/README.md
CHANGED
@@ -1,7 +1,51 @@
|
|
1
1
|
PgbackupsS3
|
2
2
|
=======================================
|
3
3
|
|
4
|
+
This gem allows you to send postgres dumps from Heroku to an S3 bucket. It also
|
5
|
+
allows you restore your current database from any of the backups on S3.
|
4
6
|
|
5
|
-
|
7
|
+
## Setup
|
6
8
|
|
7
|
-
|
9
|
+
To install on your system
|
10
|
+
|
11
|
+
`gem install pgbackups`
|
12
|
+
|
13
|
+
To install in rails app, add the following line to your Gemfile
|
14
|
+
|
15
|
+
`gem 'pgbackups_s3'`
|
16
|
+
|
17
|
+
Then run: `bundle install`
|
18
|
+
|
19
|
+
Then create the initialzer that will hold all the settings for the packups
|
20
|
+
|
21
|
+
`rails g pgbackups_s3:install`
|
22
|
+
|
23
|
+
Go to `config/initializers/pgbackups_s3.rb` and follow the documentation to get your backups cranking!
|
24
|
+
|
25
|
+
## Using the gem
|
26
|
+
|
27
|
+
### Back dat database up
|
28
|
+
|
29
|
+
To run a backup you can either run it in the rails console:
|
30
|
+
|
31
|
+
`PgbackupsS3.backup`
|
32
|
+
|
33
|
+
or through a rake task
|
34
|
+
|
35
|
+
`rake pgbackups_s3:backup`
|
36
|
+
|
37
|
+
### List all the backups for a certain day
|
38
|
+
|
39
|
+
To list all backups for today just run:
|
40
|
+
|
41
|
+
`PgbackupsS3.list_backups`
|
42
|
+
|
43
|
+
All the values will default to today if there is no input
|
44
|
+
|
45
|
+
To specify a specific day of backups, run:
|
46
|
+
|
47
|
+
`PgbackupsS3.list_backups(YEAR, MONTH, DAY)`
|
48
|
+
|
49
|
+
This command will print out the keys of all the backups
|
50
|
+
|
51
|
+
###
|
data/lib/pgbackups_s3/client.rb
CHANGED
@@ -77,7 +77,7 @@ class PgbackupsS3
|
|
77
77
|
def send_to_s3
|
78
78
|
print "Shipping that sucka to S3\t"
|
79
79
|
key = File.basename(@tmp_file)
|
80
|
-
@s3.buckets[@bucket].objects["#{@directories}/#{Date.today.year}
|
80
|
+
@s3.buckets[@bucket].objects["#{@directories}/#{Date.today.year}/#{Date.today.month}/#{Date.today.day}/#{key}"].write(:file => @tmp_file)
|
81
81
|
puts "Backup uploaded to #{@bucket} bucket."
|
82
82
|
end
|
83
83
|
|
data/pgbackups_s3.gemspec
CHANGED