dumper 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +8 -10
- data/lib/dumper/stack.rb +5 -0
- data/lib/dumper/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -1,12 +1,10 @@
|
|
1
1
|
# Dumper Agent for Rails
|
2
2
|
|
3
|
-
Dumper is a backup management system that offers a whole new way to
|
4
|
-
|
5
|
-
**This app will be launched soon!**
|
3
|
+
[Dumper](http://dumper.io/) is a backup management system that offers a whole new way to perform automated backups of your databases.
|
6
4
|
|
7
5
|
## Supported Stacks
|
8
6
|
|
9
|
-
* Ruby 1.8.7
|
7
|
+
* Ruby 1.8.7, Ruby 1.9.2 or later
|
10
8
|
* Rails 3.0 or later
|
11
9
|
* MySQL with ActiveRecord
|
12
10
|
* PostgreSQL with ActiveRecord
|
@@ -22,7 +20,7 @@ Add the following line to your Rails project Gemfile:
|
|
22
20
|
gem 'dumper'
|
23
21
|
```
|
24
22
|
|
25
|
-
then create `config/initializers/dumper.rb` and
|
23
|
+
then create `config/initializers/dumper.rb` and add the following line:
|
26
24
|
|
27
25
|
```ruby
|
28
26
|
Dumper::Agent.start(:app_key => 'YOUR_APP_KEY')
|
@@ -36,11 +34,11 @@ You'll find your application is registered and ready to take backups.
|
|
36
34
|
|
37
35
|
## How does it work?
|
38
36
|
|
39
|
-
In a Rails app server process, a new thread is created and periodically checks the Dumper API if a new backup job is scheduled.
|
37
|
+
In a Rails app server process, a new thread is created and periodically checks the Dumper API to see if a new backup job is scheduled.
|
40
38
|
|
41
|
-
When it finds a job, the agent won't run the job inside its own thread, but instead spawns a new process, then
|
39
|
+
When it finds a job, the agent won't run the job inside its own thread, but instead spawns a new process, then goes back to sleep. That way, web requests won't be affected by the long-running backup task, and the task will continue to run even when the parent process is killed in the middle.
|
42
40
|
|
43
|
-
Dumper agent will try to run on every process by default. Which means, for instance, if you have 10 thin instances on production, the agent will run on those 10 instances. We designate the first agent that hits our API as primary, and the rest as secondary. In this case, 1 thin process becomes the primary and other 9 processes become secondaries. Only the primary is responsible for taking backup jobs, so it is guaranteed that there is no duplicate work on your servers. The primary polls our API with
|
41
|
+
Dumper agent will try to run on every process by default. Which means, for instance, if you have 10 thin instances on production, the agent will run on those 10 instances. We designate the first agent that hits our API as primary, and the rest as secondary. In this case, 1 thin process becomes the primary and other 9 processes become secondaries. Only the primary is responsible for taking backup jobs, so it is guaranteed that there is no duplicate work on your servers. The primary polls our API with every 1- to 10-minute interval, while the secondaries poll every hour. If you run fork-based servers like unicorn or passenger, however, the agent thread runs only on the master process, not on child processes.
|
44
42
|
|
45
43
|
We do this for fault tolerance. When something goes wrong and the primary dies, one of the secondaries will take over the primary status and continue to serve.
|
46
44
|
|
@@ -50,7 +48,7 @@ The bottom line is that the agent is designed to be extremely efficient in CPU,
|
|
50
48
|
|
51
49
|
As explained above, the Dumper agent will try to run on every process by default.
|
52
50
|
|
53
|
-
If you want to start the agent on a particular host, pass a block that evaluates to true or false to `start_if` method.
|
51
|
+
If you want to start the agent on a particular host, pass a block that evaluates to true or false to the `start_if` method.
|
54
52
|
|
55
53
|
```ruby
|
56
54
|
Dumper::Agent.start_if(:app_key => 'YOUR_APP_KEY') do
|
@@ -58,7 +56,7 @@ Dumper::Agent.start_if(:app_key => 'YOUR_APP_KEY') do
|
|
58
56
|
end
|
59
57
|
```
|
60
58
|
|
61
|
-
|
59
|
+
Currently Redis support is limited in that you must run the agent on the same host with Redis.
|
62
60
|
|
63
61
|
```ruby
|
64
62
|
Dumper::Agent.start_if(:app_key => 'YOUR_APP_KEY') do
|
data/lib/dumper/stack.rb
CHANGED
@@ -23,6 +23,11 @@ module Dumper
|
|
23
23
|
@rails_env = Rails.env.to_s
|
24
24
|
@rails_version = Rails::VERSION::STRING
|
25
25
|
@is_supported_rails_version = (::Rails::VERSION::MAJOR >= 3)
|
26
|
+
|
27
|
+
if defined?(MongoMapper)
|
28
|
+
MongoMapper.database # Creates the Mongo::DB instance
|
29
|
+
end
|
30
|
+
|
26
31
|
DATABASES.each do |key, klass|
|
27
32
|
database = klass.new
|
28
33
|
next unless database.set_config_for(@rails_env) || database.set_config_for(options[:additional_env])
|
data/lib/dumper/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dumper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|