DatabaseCollector
Installation
Add this line to your application's Gemfile:
gem 'database_collector'
And then execute:
$ bundle
Usage
Your connection class must respond to dbms
, database_host
, database_user
, database_password
, database_schema
, database_table
methods.
Your database_table
must have the created_at
column.
DatabaseCollector.configure do |dc|
dc.adapter = ConnectionClass
dc.aws_access_key_id = 'AWS_SECRET_KEY'
dc.aws_secret_access_key = 'AWS_ACCESS_KEY'
dc.aws_region = 'sa-east-1'
dc.aws_root_dir = 'AWS_BUCKET_NAME'
dc.interval = 15 # number of days to keep on database based on created_at
end
DatabaseCollector::Backup.perform
Rake Task
$ rake database:backup
Rails
$ bin/rake database:backup
Whenever
Example schedule.rb file
every 1.day, at: '1am' do
rake "database:backup"
end
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake false
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/database_collector.