Project

pg_drive

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
This gem backs up postgres and stores the backup in google drive
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.12
>= 0
~> 10.0
~> 3.0

Runtime

>= 0
< 6.0.0, > 4.0.0
 Project Readme

PgDrive

This library is intended to be a minimalist backup solution for Postgres, Rails and Goodle Drive. Basically a free aletrnative to dumper.

Installation

Add this line to your application's Gemfile:

gem 'pg_drive'

And then execute:

$ bundle

Or install it yourself as:

$ gem install pg_drive

You need to create a new project and credential in order to use google drive. Make sure the credential is for "Oauth Client" and the application type is "Other". Set the following environment variables:

ENV['PG_DRIVE_GOOGLE_KEY']="Your credential client id"
ENV['PG_DRIVE_GOOGLE_SECRET']="Your credential secret"

These values should be easy to find after you created new credentials in google's developer console.

After that you should run the following command inside rails console and follow the instructions.

PgDrive.setup_credentials

This process is will generate a new token so the app could use a specific user's google drive account to store the backup files.

Usage

PgDrive.perform

Creates a new backup and uploads it to google drive. You can run this command in your favorite queueing system and favorite scheduler.

Notes

Keep in mind the backup dump and zipping are all done in memory. If your database is more than 50mb you should find a better solution.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/tsubery/pg_drive.

License

The gem is available as open source under the terms of the MIT License.