pgbackups-archive 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 66159d34051e8b3601dd2e6127efa3fabfc8fed8
4
+ data.tar.gz: 4887b601937eac8dbb67cb6eef1f11bc32136498
5
+ SHA512:
6
+ metadata.gz: 3606f30de997bf25e907b15d3acfc8dffeced918ce196cc049425faa26cea98f5fda77705039f2e32790ea1c38d7c423de14d0bf780f272d45860b1eef994c2a
7
+ data.tar.gz: 553b6b98e34b0cacfad4f296b20756dec5504ec2264a4ec79642e25075864d323140aaaa24cb469c7deb678f735a7058a9905220e30c4422b74ffc9d2962e440
@@ -0,0 +1 @@
1
+ pgbackups-archive
@@ -0,0 +1 @@
1
+ ruby-1.9.3
data/Gemfile CHANGED
@@ -1,7 +1,8 @@
1
- source :rubygems
1
+ source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
5
  group :test do
6
- gem "thincloud-test", "~> 1.0.0.pre"
6
+ gem "thincloud-test", github: "newleaders/thincloud-test", branch: "rails4"
7
+ gem "minitest-reporters", "~> 1.0.0"
7
8
  end
@@ -1,108 +1,125 @@
1
+ GIT
2
+ remote: git://github.com/newleaders/thincloud-test.git
3
+ revision: 98a0dc247ef25b85379514309f8ff1cf1be239ac
4
+ branch: rails4
5
+ specs:
6
+ thincloud-test (2.0.0.alpha2)
7
+ cane (~> 2.6.0)
8
+ guard (~> 1.8.0)
9
+ guard-minitest (~> 1.0.0.rc.2)
10
+ minitest (>= 4.2)
11
+ mocha (~> 0.14.0)
12
+ simplecov (~> 0.8.0.pre)
13
+ terminal-notifier-guard (~> 1.5.3)
14
+ thor (~> 0.18.1)
15
+
1
16
  PATH
2
17
  remote: .
3
18
  specs:
4
- pgbackups-archive (0.1.0)
19
+ pgbackups-archive (0.2.1)
5
20
  bundler (>= 1.2.3)
6
21
  fog (>= 1.4.0)
7
- heroku (~> 2.34.0)
22
+ heroku (>= 2.34.0)
8
23
  rake (>= 0.9.2.2)
9
24
 
10
25
  GEM
11
- remote: http://rubygems.org/
26
+ remote: https://rubygems.org/
12
27
  specs:
13
- addressable (2.3.2)
28
+ addressable (2.3.5)
14
29
  ansi (1.4.3)
15
- builder (3.1.4)
16
- cane (2.5.2)
30
+ builder (3.2.2)
31
+ cane (2.6.1)
17
32
  parallel
18
- coderay (1.0.8)
19
- excon (0.16.10)
20
- fog (1.9.0)
33
+ coderay (1.1.0)
34
+ docile (1.1.1)
35
+ excon (0.25.3)
36
+ ffi (1.9.3)
37
+ fog (1.15.0)
21
38
  builder
22
- excon (~> 0.14)
39
+ excon (~> 0.25.0)
23
40
  formatador (~> 0.2.0)
24
41
  mime-types
25
42
  multi_json (~> 1.0)
26
- net-scp (~> 1.0.4)
43
+ net-scp (~> 1.1)
27
44
  net-ssh (>= 2.1.3)
28
- nokogiri (~> 1.5.0)
45
+ nokogiri (~> 1.5)
29
46
  ruby-hmac
30
47
  formatador (0.2.4)
31
- guard (1.6.2)
32
- listen (>= 0.6.0)
48
+ guard (1.8.3)
49
+ formatador (>= 0.2.4)
50
+ listen (~> 1.3)
33
51
  lumberjack (>= 1.0.2)
34
52
  pry (>= 0.9.10)
35
- terminal-table (>= 1.4.3)
36
53
  thor (>= 0.14.6)
37
- guard-minitest (0.5.0)
38
- guard (>= 0.4)
39
- hashie (1.2.0)
40
- heroku (2.34.0)
54
+ guard-minitest (1.0.1)
55
+ guard (>= 1.8)
56
+ minitest (>= 2.1)
57
+ hashie (2.0.5)
58
+ heroku (3.1.0)
41
59
  heroku-api (~> 0.3.7)
42
60
  launchy (>= 0.3.2)
43
61
  netrc (~> 0.7.7)
44
62
  rest-client (~> 1.6.1)
45
63
  rubyzip
46
- heroku-api (0.3.7)
47
- excon (~> 0.16.10)
48
- launchy (2.1.2)
64
+ heroku-api (0.3.15)
65
+ excon (~> 0.25.1)
66
+ launchy (2.4.2)
49
67
  addressable (~> 2.3)
50
- listen (0.7.2)
51
- lumberjack (1.0.2)
68
+ listen (1.3.1)
69
+ rb-fsevent (>= 0.9.3)
70
+ rb-inotify (>= 0.9)
71
+ rb-kqueue (>= 0.2)
72
+ lumberjack (1.0.4)
52
73
  metaclass (0.0.1)
53
- method_source (0.8.1)
54
- mime-types (1.20.1)
55
- minitest (4.5.0)
56
- minitest-reporters (0.14.7)
74
+ method_source (0.8.2)
75
+ mime-types (2.0)
76
+ mini_portile (0.5.2)
77
+ minitest (5.1.0)
78
+ minitest-reporters (1.0.0)
57
79
  ansi
58
80
  builder
59
- minitest (>= 2.12, < 5.0)
81
+ minitest (>= 5.0)
60
82
  powerbar
61
- mocha (0.13.2)
83
+ mocha (0.14.0)
62
84
  metaclass (~> 0.0.1)
63
- multi_json (1.3.6)
64
- net-scp (1.0.4)
65
- net-ssh (>= 1.99.1)
66
- net-ssh (2.6.3)
85
+ multi_json (1.8.2)
86
+ net-scp (1.1.2)
87
+ net-ssh (>= 2.6.5)
88
+ net-ssh (2.7.0)
67
89
  netrc (0.7.7)
68
- nokogiri (1.5.6)
69
- parallel (0.6.2)
90
+ nokogiri (1.6.0)
91
+ mini_portile (~> 0.5.0)
92
+ parallel (0.9.1)
70
93
  powerbar (1.0.11)
71
94
  ansi (~> 1.4.0)
72
95
  hashie (>= 1.1.0)
73
- pry (0.9.11.4)
74
- coderay (~> 1.0.5)
96
+ pry (0.9.12.4)
97
+ coderay (~> 1.0)
75
98
  method_source (~> 0.8)
76
99
  slop (~> 3.4)
77
- rake (10.0.3)
100
+ rake (10.1.0)
78
101
  rb-fsevent (0.9.3)
102
+ rb-inotify (0.9.2)
103
+ ffi (>= 0.5.0)
104
+ rb-kqueue (0.2.0)
105
+ ffi (>= 0.5.0)
79
106
  rest-client (1.6.7)
80
107
  mime-types (>= 1.16)
81
108
  ruby-hmac (0.4.0)
82
- rubyzip (0.9.9)
83
- simplecov (0.7.1)
84
- multi_json (~> 1.0)
85
- simplecov-html (~> 0.7.1)
86
- simplecov-html (0.7.1)
87
- slop (3.4.3)
109
+ rubyzip (1.1.0)
110
+ simplecov (0.8.2)
111
+ docile (~> 1.1.0)
112
+ multi_json
113
+ simplecov-html (~> 0.8.0)
114
+ simplecov-html (0.8.0)
115
+ slop (3.4.7)
88
116
  terminal-notifier-guard (1.5.3)
89
- terminal-table (1.4.5)
90
- thincloud-test (1.0.0.pre)
91
- cane (~> 2.5.2)
92
- guard (~> 1.6.1)
93
- guard-minitest (~> 0.5.0)
94
- minitest (~> 4.5.0)
95
- minitest-reporters (~> 0.14.7)
96
- mocha (~> 0.13.2)
97
- rb-fsevent (~> 0.9.1)
98
- simplecov (~> 0.7.1)
99
- terminal-notifier-guard (~> 1.5.3)
100
- thor (~> 0.17.0)
101
- thor (0.17.0)
117
+ thor (0.18.1)
102
118
 
103
119
  PLATFORMS
104
120
  ruby
105
121
 
106
122
  DEPENDENCIES
123
+ minitest-reporters (~> 1.0.0)
107
124
  pgbackups-archive!
108
- thincloud-test (~> 1.0.0.pre)
125
+ thincloud-test!
data/README.md CHANGED
@@ -4,7 +4,7 @@ A means of automating Heroku's pgbackups and archiving them to Amazon S3 via the
4
4
 
5
5
  ## Overview
6
6
 
7
- The `pgbackups:archive` rake task that this gem provides will capture a pgbackup, wait for it to complete, then store it within the Amazon S3 bucket you specify. This rake task can be scheduled via the Heroku Scheduler, thus producing automated, offsite, backups.
7
+ The `pgbackups:archive` rake task this gem provides will capture a pgbackup, wait for it to complete, then store it within the Amazon S3 bucket you specify. This rake task can be scheduled via the Heroku Scheduler, thus producing automated, offsite, backups.
8
8
 
9
9
  The rake task will use pgbackups' `--expire` flag to remove the oldest pgbackup Heroku is storing when there are no free slots remaining.
10
10
 
@@ -12,43 +12,62 @@ You can configure retention settings at the Amazon S3 bucket level from within t
12
12
 
13
13
  ## Use
14
14
 
15
+ ### Determine which Heroku app to run the task under
16
+
17
+ #### Option 1 - Add `pgbackups-archive` to your existing application
18
+
15
19
  Add the gem to your Gemfile and bundle:
16
20
 
17
21
  gem "pgbackups-archive"
18
22
  bundle install
19
23
 
20
- Install Heroku addons:
24
+ #### Option 2 - Add `pgbackups-archive` to a standalone application
25
+
26
+ * Create a new Heroku application to dedicate to backing up your database.
27
+ * Clone [pgackups-archive-app](https://github.com/kbaum/pgbackups-archive-app) push to your new Heroku app.
28
+ * Add a `PGBACKUPS_DATABASE_URL` environment variable to your backup app that points to your main app's `DATABASE_URL`, or other follower URL, so that `pgbackups-archive` knows which database to backup.
29
+
30
+ This option is generally recommended over Option 1, particularly if your application has larger slug size and therefore higher memory requirements. This is because the streaming download & upload of the backup file will utilize a certain amount of memory beyond what an instance of your application uses and if you're close to the threshold of your Dyno size as it is, this increment could put the instance over the limit and cause it to encounter a memory allocation error. By running a dedicated Heroku app to run `pgbackups-archive` the task will have ample room at the 1X Dyno level to stream the backup files.
31
+
32
+ ### Install Heroku addons
21
33
 
22
34
  heroku addons:add pgbackups
23
35
  heroku addons:add scheduler:standard
24
36
 
25
- Apply environment variables:
37
+ ### Apply environment variables
26
38
 
27
39
  heroku config:add PGBACKUPS_AWS_ACCESS_KEY_ID="XXX"
28
40
  heroku config:add PGBACKUPS_AWS_SECRET_ACCESS_KEY="YYY"
29
41
  heroku config:add PGBACKUPS_BUCKET="myapp-backups"
30
42
  heroku config:add PGBACKUPS_REGION="us-west-2"
43
+ heroku config:add PGBACKUPS_DATABASE_URL="your main app's DATABASE_URL or other follower URL here"
31
44
 
32
- By default backups work of your primary database or the value of ENV['DATABASE_URL'], but database backups from your primary can impact the performance of your application. Optionally set an alternate database to perform backups on with:
33
-
34
- heroku config:add PGBACKUPS_DATABASE_URL="your_follower_database_url_here"
45
+ * `PGBACKUPS_DATABASE_URL` can be set either to `DATABASE_URL` or a follower database you setup if you would prefer to not backup from your primary databse for performance reasons.
46
+ * If `PGBACKUPS_DATABASE_URL` is omitted, `pgbackups-archive` will default to the `DATABASE_URL` of the Heroku app it runs under. This setting will be required going forward, so you'll want to have it set.
47
+ * As mentioned above, the `PGBACKUPS_DATABASE_URL` is mandatory if you are the using Option 2 above.
48
+ * A good security measure would be to use a dedicated set of AWS credentials with a security policy only allowing access to the bucket you're specifying. See this Pro Tip on [Assigning an AWS IAM user access to a single S3 bucket](http://coderwall.com/p/dwhlma).
35
49
 
36
-
37
- Note: A good security measure would be to use a dedicated set of AWS credentials with a security policy only allowing access to the bucket you're specifying. See this Pro Tip on [Assigning an AWS IAM user access to a single S3 bucket](http://coderwall.com/p/dwhlma).
38
-
39
- Add the rake task to scheduler:
50
+ ### Add the rake task to scheduler
40
51
 
41
52
  heroku addons:open scheduler
42
53
 
43
54
  Then specify `rake pgbackups:archive` as a task you would like to run at any of the available intervals.
44
55
 
45
- ## Loading the Rake task
56
+ ### Loading the Rake task
46
57
 
47
58
  If you're using this gem in a Rails 3 app the rake task will be automatically loaded via a Railtie.
48
59
 
49
60
  If you're using this gem with a Rails 2 app, or non-Rails app, add the following to your Rakefile:
50
61
 
51
- require "pgbackups-archive"
62
+ ```ruby
63
+ require "pgbackups-archive"
64
+ ```
65
+
66
+ ## Testing
67
+
68
+ This gem uses [thincloud-test](https://github.com/newleaders/thincloud-test) to manage its test suite configuration. This provides MiniTest, Guard and friends. To run the test suite, use the `guard` command and save a file or hit enter to run the full suite.
69
+
70
+ Use the [pgbackups-archive-dummy](https://github.com/kjohnston/pgbackups-archive-dummy) test harness to setup a dummy database on Heroku to test against.
52
71
 
53
72
  ## Disclaimer
54
73
 
@@ -72,6 +91,7 @@ Many thanks go to the following who have contributed to making this gem even bet
72
91
  * Ruby 1.8-compatible hash syntax.
73
92
  * [Karl Baum (@kbaum)](https://github.com/kbaum)
74
93
  * Custom setting for database to backup.
94
+ * Streaming support to handle large backup files.
75
95
 
76
96
  ## License
77
97
 
@@ -1,3 +1,3 @@
1
1
  module PgbackupsArchive
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
14
14
 
15
15
  s.add_dependency "bundler", ">= 1.2.3"
16
16
  s.add_dependency "fog", ">= 1.4.0"
17
- s.add_dependency "heroku", "~> 2.34.0"
17
+ s.add_dependency "heroku", ">= 2.34.0"
18
18
  s.add_dependency "rake", ">= 0.9.2.2"
19
19
 
20
20
  s.files = `git ls-files`.split("\n")
@@ -131,6 +131,12 @@ describe Heroku::Client::PgbackupsArchive do
131
131
  end
132
132
 
133
133
  describe "#environment" do
134
+ describe "when Rails is not present" do
135
+ it "should default to nil" do
136
+ backup.send(:environment).must_equal nil
137
+ end
138
+ end
139
+
134
140
  describe "when Rails is present" do
135
141
  before do
136
142
  class Rails
@@ -144,12 +150,6 @@ describe Heroku::Client::PgbackupsArchive do
144
150
  backup.send(:environment).must_equal "test"
145
151
  end
146
152
  end
147
-
148
- describe "when Rails is not present" do
149
- it "should default to nil" do
150
- backup.send(:environment).must_equal nil
151
- end
152
- end
153
153
  end
154
154
 
155
155
  describe "#file" do
metadata CHANGED
@@ -1,78 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pgbackups-archive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
5
- prerelease:
4
+ version: 0.2.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Kenny Johnston
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-11 00:00:00.000000000 Z
11
+ date: 2013-12-06 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: 1.2.3
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: 1.2.3
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: fog
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: 1.4.0
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: 1.4.0
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: heroku
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ~>
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: 2.34.0
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ~>
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: 2.34.0
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rake
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: 0.9.2.2
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: 0.9.2.2
78
69
  description: A means of automating Heroku's pgbackups and archiving them to Amazon
@@ -84,7 +75,8 @@ extensions: []
84
75
  extra_rdoc_files: []
85
76
  files:
86
77
  - .gitignore
87
- - .rvmrc
78
+ - .ruby-gemset
79
+ - .ruby-version
88
80
  - .travis.yml
89
81
  - Gemfile
90
82
  - Gemfile.lock
@@ -108,27 +100,26 @@ files:
108
100
  - test/support/mocha.rb
109
101
  homepage: http://github.com/kjohnston/pgbackups-archive
110
102
  licenses: []
103
+ metadata: {}
111
104
  post_install_message:
112
105
  rdoc_options: []
113
106
  require_paths:
114
107
  - lib
115
108
  required_ruby_version: !ruby/object:Gem::Requirement
116
- none: false
117
109
  requirements:
118
- - - ! '>='
110
+ - - '>='
119
111
  - !ruby/object:Gem::Version
120
112
  version: '0'
121
113
  required_rubygems_version: !ruby/object:Gem::Requirement
122
- none: false
123
114
  requirements:
124
- - - ! '>='
115
+ - - '>='
125
116
  - !ruby/object:Gem::Version
126
117
  version: '0'
127
118
  requirements: []
128
119
  rubyforge_project:
129
- rubygems_version: 1.8.25
120
+ rubygems_version: 2.1.11
130
121
  signing_key:
131
- specification_version: 3
122
+ specification_version: 4
132
123
  summary: A means of automating Heroku's pgbackups and archiving them to Amazon S3
133
124
  via the fog gem.
134
125
  test_files:
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm use 1.9.3@pgbackups-archive --create